Page 1 of 2
SNMP file system monitoring question
Posted: Tue Feb 20, 2018 2:28 pm
by andrewatmacys
This is an example of a file system being monitored through the SNMP Linux wizard, but we want to be able to monitor the file systems without pulling them, essentially pulling them all in one check. Is this possible through the use of a /wildcard$ in the place of the /archive$ to dynamically monitor all the file systems on any given server because of the variety of file systems.
$USER1$/check_snmp_storage_wizard.pl -H $HOSTADDRESS$ $ARG1$
--login=$USER10$ --passwd=$USER11$ --privpass=$USER12$ --protocols=sha,aes -m "^/archive$"
Thank you for any help in advance, it is greatly appreciated!
Re: SNMP file system monitoring question
Posted: Tue Feb 20, 2018 4:38 pm
by kyang
Does using the
/ work for you?
Code: Select all
[root@localhost libexec]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
37G 6.3G 29G 18% /
tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/sda1 477M 123M 329M 28% /boot
My example:
Code: Select all
[root@localhost libexec]# /usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 192.168.4.125 -C xxxx --v2c -m '/' -w 80 -c 90 -f
/boot: 26%used(122MB/476MB) /dev/shm: 0%used(0MB/1443MB) /: 17%used(6353MB/37709MB) (<80%) : OK | '/boot'=122MB;381;429;0;476 '/dev/shm'=0MB;1154;1299;0;1443 '/'=6353MB;30167;33938;0;37709
Re: SNMP file system monitoring question
Posted: Wed Feb 21, 2018 11:13 am
by andrewatmacys
That did work, thank you very much!
Re: SNMP file system monitoring question
Posted: Wed Feb 21, 2018 11:17 am
by kyang
Great!
Are we okay to lock this thread? Or did you have any more questions on this?
Re: SNMP file system monitoring question
Posted: Wed Feb 21, 2018 1:39 pm
by andrewatmacys
I did have one more question, probably pretty simple as well.
Is there a way to exclude a file/directory from the above command? Essentially I'd like to check all files except one file/directory on the server I'm monitoring.
Re: SNMP file system monitoring question
Posted: Wed Feb 21, 2018 3:15 pm
by kyang
You might have to play around with the help options a bit. This is what I have though.
Code: Select all
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
37G 6.3G 29G 18% /
tmpfs 1.5G 0 1.5G 0% /dev/shm
/dev/sda1 477M 123M 329M 28% /boot
I used
-e &
-q.
Code: Select all
-e, --exclude
Select all storages except the one(s) selected by -m
No action on storage type selection
-q, --storagetype=[Other|Ram|VirtualMemory|FixedDisk|RemovableDisk|FloppyDisk
CompactDisk|RamDisk|FlashMemory|NetworkDisk]
Also check the storage type in addition of the name
Code: Select all
/usr/local/nagios/libexec/check_snmp_storage_wizard.pl -H 192.168.4.125 -C xxxx --v2c -m '/dev/shm' -e -q Disk -w 80 -c 90 -f
/boot: 26%used(122MB/476MB) /: 17%used(6376MB/37709MB) (<80%) : OK | '/boot'=122MB;381;429;0;476 '/'=6376MB;30167;33938;0;37709
Here's my example.
Let's say I didn't want to check
/dev/shm then I put -m in front of it. If I add the
-e that means I check all storages except the one select by
-m which is
/dev/shm
I used the
-q Disk because if I didn't then it would return all storages. I'm not sure what metric you want, so that is up to you. I just based it off of the filesystem.
Let me know if this helps!
Re: SNMP file system monitoring question
Posted: Thu Feb 22, 2018 10:42 am
by andrewatmacys
That works wonderfully for a single directory, is there a way to exclude multiple? I've tried a few different ways but have not had success in excluding any but the first listed.
Re: SNMP file system monitoring question
Posted: Thu Feb 22, 2018 2:23 pm
by kyang
I actually did many attempts and had no luck as well.
I don't think this plugin will exclude multiple directories.
However, there is one that I saw that does do it.
Code: Select all
./check_usolved_disk.php -H 192.168.4.125 -C StrOngCOmmunity -V 2c -O Linux -w 80 -c 90 -E '/dev/shm,/boot'
Disks OK // / (16.9%) Excluded: /dev/shm,/boot
/ - Size: 36.83 GB / Used: 6.22 GB (16.9% used)
Code: Select all
[root@localhost libexec]# ./check_usolved_disk.php -H 192.168.4.125 -C StrOngCOmmunity -V 2c -O Linux -w 80 -c 90 -E '/dev/shm'
Disks OK // / (16.9%), /boot (25.5%) Excluded: /dev/shm
/ - Size: 36.83 GB / Used: 6.22 GB (16.9% used)
/boot - Size: 0.47 GB / Used: 0.12 GB (25.5% used)
Here is an example to exclude one. So the difference is you can pass another one using a comma.
https://exchange.nagios.org/directory/P ... ks/details
I hope this is a solution for you.
Re: SNMP file system monitoring question
Posted: Fri Feb 23, 2018 7:34 am
by andrewatmacys
I will try this and let you know how it works! Thank you for your help!
Re: SNMP file system monitoring question
Posted: Fri Feb 23, 2018 12:23 pm
by scottwilkerson
andrewatmacys wrote:I will try this and let you know how it works! Thank you for your help!
No problem, let us know if you have any further hurdles.