Page 1 of 1

LInux server Partitions monitoring using Nagios

Posted: Wed Dec 27, 2017 1:23 am
by Sudhaharan
HI,

Please any one suggest the steps for define to monitor the linux server partitions in Nagios server and NRPE (Ex: /dev/sda1 ,/dev/xvda1)

-Thanks,
Sudhaharan.M

Re: LInux server Partitions monitoring using Nagios

Posted: Wed Dec 27, 2017 9:30 am
by mcapra
check_volume is a good plugin for this. It uses df for its metrics.

Code: Select all

[root@capra-docker ~]# /tmp/check_volume.sh -v /dev/sda1 -c 95 -w 90
/dev/sda1 is at 19% capacity, 184M of 1014M
[root@capra-docker ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   17G  6.2G   11G  37% /
devtmpfs             1.9G     0  1.9G   0% /dev
tmpfs                1.9G     0  1.9G   0% /dev/shm
tmpfs                1.9G  8.4M  1.9G   1% /run
tmpfs                1.9G     0  1.9G   0% /sys/fs/cgroup
/dev/sda1           1014M  184M  831M  19% /boot
tmpfs                380M     0  380M   0% /run/user/0
As for configuring it with NRPE, give this documentation a look and let us know if any part of it doesn't work or is unclear:
https://support.nagios.com/kb/article/n ... d-612.html

I understand that the documentation says "Nagios XI" a lot, but the same concepts are applicable to Nagios Core.

Re: LInux server Partitions monitoring using Nagios

Posted: Wed Dec 27, 2017 11:21 am
by dwhitfield
Do you already have NRPE installed? It's hard to know exactly where to start, but once you have NRPE installed, if you could send your nrpe.cfg we can take a look at see if it is configured properly. Are you currently monitoring anything else through NRPE on the device you are monitoring?


This is from the document @mcapra gave you, but it's worth highlighting since you aren't using XI and I don't know how familiar you are with NRPE:
Commands are defined in the nrpe.cfg file, this is commonly located at /usr/local/nagios/etc/nrpe.cfg.

They may also be defined in an additional .cfg file referenced in the nrpe.cfgfile, for example:

include_dir=/usr/local/nagios/etc/nrpe



What does a command definition look like? Using the example above, the check_users command is defined as follows:

command[check_users]=/usr/local/nagios/libexec/check_users $ARG1$



The line begins with the word command, this is how the config file knows this line is a command definition

The word between the [square brackets] is the actual command "name"

Everything after the = is the actual plugin that is being executed, along with any arguments

This example only accepts one argument. Arguments are defined as $ARGx$ where x is the argument number received
Please let us know if you run into any further difficulty.

Re: LInux server Partitions monitoring using Nagios

Posted: Wed Jan 03, 2018 5:44 am
by Sudhaharan
HI,

Thanks for your reply. I have checked and i can able to show the output in the local machine. But, how can i configure in Nagios to monitor the remote host partitions.

-Thanks,
Sudhaharan.M

Re: LInux server Partitions monitoring using Nagios

Posted: Wed Jan 03, 2018 3:56 pm
by cdienger
The check_disk_smb can be used:

/usr/local/nagios/libexec/check_disk_smb remote_ip share_volume username password

Re: LInux server Partitions monitoring using Nagios

Posted: Thu Jan 04, 2018 1:36 am
by Sudhaharan
HI,

I have checked, i think this check_disk_smb is suitable for Samba shared drives only. But, my requirement is to monitor the remote linux servers partitions which mounted on remote server(Ex: /mnt/hdpx1 )

-Thanks,
Sudhaharan.M

Re: LInux server Partitions monitoring using Nagios

Posted: Thu Jan 04, 2018 12:35 pm
by kyang
If you wanted to use the check_volume plugin that @mcapra suggested then it would be a good idea to have NRPE installed.

Code: Select all

[root@localhost libexec]# ./check_nrpe -H 192.168.4.174 -c check_volume -a '-v /run -w 94 -c 99'
/run is at 5% capacity, 40M of 918M

[root@localhost libexec]# ./check_nrpe -H 192.168.4.174 -c check_volume -a '-v /dev/sda1 -w 94 -c 99'
/dev/sda1 is at 52% capacity, 255M of 497M

Checked on my remote host.

Code: Select all

[root@centos7x64 libexec]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   18G  3.7G   14G  21% /
devtmpfs                 908M     0  908M   0% /dev
tmpfs                    918M     0  918M   0% /dev/shm
tmpfs                    918M   40M  879M   5% /run
tmpfs                    918M     0  918M   0% /sys/fs/cgroup
/dev/sda1                497M  255M  243M  52% /boot
tmpfs                    184M     0  184M   0% /run/user/0
[root@centos7x64 libexec]# hostname -I
192.168.4.174
All I did was have the check_volume plugin on the remote host.
Added a MISC command to the nrpe.cfg file.

Code: Select all

### MISC SYSTEM METRICS ###
command[check_volume]=/usr/local/nagios/libexec/check_volume $ARG1$
Let us know if this helps.