A Nagios script for monitoring disks

Source: Internet
Author: User

u_per= ' df-h |sed-n ' $i "p|sed-n" s/\%//"P|awk ' {print $} '
p_p= ' df-h-p|sed-n ' $i" P|aw K ' {print $6} '
If ["$u _per"-gt ""   ];then
Echo-n "$p _p CRITICAL $u _per% $ava   "
sta[$i ]=2
Elif ["$u _per"-gt "];then
echo-n" $p _p warning! $u _per% $ava    "
sta[$i]=1
Else
echo-n" $p _p OK $u _per% $ava    "
sta[$i]=0
Fi
Done
N=0
for J in ' seq 2 $row '
do
If ["${sta[$j]}"-gt $n   ];then
n=${sta[$j]}
Fi
done< Br>exit $n

2. After saving, modify the permissions of the script
chmod +x/usr/lib/nagios/plugins//check_disk.sh (on client)
3. Then edit the/etc/nagios/nrpe.cfg file
VIM/ETC/NAGIOS/NRPE.CFG # Add a line: (on client)
command[check_disk]=/usr/lib/nagios/plugins/check_disk.sh
Save, restart Nrpe service
/etc/init.d/nrpe restart (on client)
4. The way to detect if the script is working correctly is to execute the following command to the server side:
Check_nrpe-h 192.168.210.12-c Check_disk (on server)
If normal, it will output a row of disk detection data, or may be error.
5. Add the appropriate service to the server
192.168.210.12.CFG # Add the following:
Define Service{
Use Generic-service
HOST_NAME 192.168.0.12
Service_description Check_disk
Check_command Check_nrpe!check_disk
Max_check_attempts 5
Normal_check_interval 1
}
6. Restart the Nagios service
/etc/init.d/nagios restart (on server)


A Nagios script for monitoring disks

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.