Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm: detect if raid devices present #172

Merged
merged 4 commits into from
Sep 1, 2017
Merged

dm: detect if raid devices present #172

merged 4 commits into from
Sep 1, 2017

Conversation

glensc
Copy link
Owner

@glensc glensc commented Aug 9, 2017

Fixes: #138, #158, #142, #170


Existing systems having dm active:

  • sudo rules already existed, continues to run

Existing systems having dm inactive (no raids present):

  • sudo rules still missing, plugin will not activate dm plugin

@glensc
Copy link
Owner Author

glensc commented Aug 31, 2017

without updated sudo rules (because dm is not active), this would yield sudo warnings, but does not affect exit code:

# sudo -H -u nagios ./check_raid-4.0.7-3-g304ec8c.pl 

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no askpass program specified, try setting SUDO_ASKPASS

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

sudo: no askpass program specified, try setting SUDO_ASKPASS
OK: arcconf:[Controller:Optimal, Logical Device 0(sodom):Optimal, Drives: 3LQ1WG5N,3LQ1WGC0=Online]

# echo $?
0

@glensc
Copy link
Owner Author

glensc commented Aug 31, 2017

some alternative solution to avoid sudo errors:

  1. run sudo -l
  2. process that output for matching commands

this way the plugin won't produce sudo warnings on stderr (some nagios versions include stderr in plugin output afaik)

# sudo -H -u nagios sudo -l
Matching Defaults entries for nagios on xylia:
    !tty_tickets, !requiretty, !tty_tickets

User nagios may run the following commands on xylia:
    (root) NOPASSWD: /usr/bin/ipmitool sdr dump /var/spool/nagios/check_ipmi.sdr
    (root) NOPASSWD: /usr/bin/ipmitool -S /var/spool/nagios/check_ipmi.sdr sdr
    (root) NOPASSWD: /sbin/arcconf GETSTATUS 1
    (root) NOPASSWD: /sbin/arcconf GETCONFIG * AL
    (root) NOPASSWD: /usr/sbin/iptables -n -t filter -L INPUT

@glensc
Copy link
Owner Author

glensc commented Aug 31, 2017

to create test env for lvm-dm tests, follow this note: #130 (comment)

modprobe dm-mod 
modprobe dm-raid
modprobe dm-mirror 
modprobe raid1
modprobe raid5
modprobe raid6

LVC="lvcreate -L 28m --alloc anywhere"
$LVC --type raid1 -n raid1 sys
$LVC --type raid5 -n raid5 -i 2 sys
$LVC --type raid6 -n raid6 -i 3 sys
$LVC --type mirror -n mirror-mirrorlog-core --mirrorlog core sys
$LVC --type mirror -n mirror-mirrorlog-disk --mirrorlog disk sys
$LVC --type mirror -n mirror-mirrorlog-mirrored --mirrorlog mirrored sys

dmsetup table |grep -e raid -e mirror |sort

to remove those devices:

lvremove /dev/sys/mirror-mirrorlog-core -f
lvremove /dev/sys/mirror-mirrorlog-disk -f
lvremove /dev/sys/mirror-mirrorlog-mirrored -f
lvremove /dev/sys/raid1 -f
lvremove /dev/sys/raid5 -f
lvremove /dev/sys/raid6 -f

@glensc
Copy link
Owner Author

glensc commented Sep 1, 2017

made sudo less noisy if sudo rules not present: 9552372

# sudo -H -u nagios ./check_raid.sh
sudo: a password is required
sudo: a password is required
check_raid UNKNOWN - No active plugins (No RAID found)

@glensc glensc changed the title WIP: dm: detect if raid devices present dm: detect if raid devices present Sep 1, 2017
@glensc
Copy link
Owner Author

glensc commented Sep 1, 2017

i think this is better what is out there now. so merging

@glensc glensc merged commit b147d08 into master Sep 1, 2017
@glensc glensc deleted the dm-detect branch September 1, 2017 18:48
@glensc
Copy link
Owner Author

glensc commented Sep 21, 2017

some users report that such approach is still not good. sudo will spam root mail about unmatched sudo accesses:

mantis.example.org : Sep 21 14:48:27 : nagios : a password is required ; TTY=pts/0 ; PWD=/etc/nagios/nrpe.d ; USER=root ; COMMAND=/sbin/dmsetup status
mantis.example.org : Sep 21 14:48:27 : nagios : a password is required ; TTY=pts/0 ; PWD=/etc/nagios/nrpe.d ; USER=root ; COMMAND=/sbin/dmsetup status --noflush

Repository owner locked as resolved and limited conversation to collaborators Oct 1, 2019
Repository owner deleted a comment from derBobby Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consistency for --noraid: No controller vs No Volumes; software RAID implications
1 participant