SNMP file system monitoring question

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
andrewatmacys
Posts: 114
Joined: Tue Feb 06, 2018 9:25 am

SNMP file system monitoring question

Post 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!
kyang

Re: SNMP file system monitoring question

Post 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
andrewatmacys
Posts: 114
Joined: Tue Feb 06, 2018 9:25 am

Re: SNMP file system monitoring question

Post by andrewatmacys »

That did work, thank you very much!
kyang

Re: SNMP file system monitoring question

Post by kyang »

Great!

Are we okay to lock this thread? Or did you have any more questions on this?
andrewatmacys
Posts: 114
Joined: Tue Feb 06, 2018 9:25 am

Re: SNMP file system monitoring question

Post 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.
kyang

Re: SNMP file system monitoring question

Post 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!
andrewatmacys
Posts: 114
Joined: Tue Feb 06, 2018 9:25 am

Re: SNMP file system monitoring question

Post 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.
kyang

Re: SNMP file system monitoring question

Post 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.
andrewatmacys
Posts: 114
Joined: Tue Feb 06, 2018 9:25 am

Re: SNMP file system monitoring question

Post by andrewatmacys »

I will try this and let you know how it works! Thank you for your help!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: SNMP file system monitoring question

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked