centreon公司推出的check plugin pack

文档

http://documentation.centreon.com/docs/centreon-plugins/en/latest/
(epel)
# yum install nagios-plugins nrpe nagios-plugins-fping nagios-plugins-icmp
# rpm -ql nrpe
/etc/nagios/nrpe.cfg
/etc/nrpe.d
/etc/rc.d/init.d/nrpe
/etc/sysconfig/nrpe
/usr/sbin/nrpe
/usr/share/doc/nrpe-2.15
/usr/share/doc/nrpe-2.15/Changelog
/usr/share/doc/nrpe-2.15/LEGAL
/usr/share/doc/nrpe-2.15/NRPE.pdf
/usr/share/doc/nrpe-2.15/README
/usr/share/doc/nrpe-2.15/README.SSL
/usr/share/doc/nrpe-2.15/SECURITY
/var/run/nrpe

# rpm -ql nagios-common
/etc/nagios
/usr/lib64/nagios
/usr/lib64/nagios/plugins
/var/spool/nagios

# rpm -ql nagios-plugins
/usr/lib64/nagios/plugins/negate
/usr/lib64/nagios/plugins/urlize
/usr/lib64/nagios/plugins/utils.sh
/usr/share/doc/nagios-plugins-1.4.16
/usr/share/doc/nagios-plugins-1.4.16/ACKNOWLEDGEMENTS
/usr/share/doc/nagios-plugins-1.4.16/AUTHORS
/usr/share/doc/nagios-plugins-1.4.16/BUGS
/usr/share/doc/nagios-plugins-1.4.16/CODING
/usr/share/doc/nagios-plugins-1.4.16/COPYING
/usr/share/doc/nagios-plugins-1.4.16/ChangeLog
/usr/share/doc/nagios-plugins-1.4.16/FAQ
/usr/share/doc/nagios-plugins-1.4.16/LEGAL
/usr/share/doc/nagios-plugins-1.4.16/NEWS
/usr/share/doc/nagios-plugins-1.4.16/README
/usr/share/doc/nagios-plugins-1.4.16/README.Fedora
/usr/share/doc/nagios-plugins-1.4.16/REQUIREMENTS
/usr/share/doc/nagios-plugins-1.4.16/SUPPORT
/usr/share/doc/nagios-plugins-1.4.16/THANKS
/usr/share/locale/de/LC_MESSAGES/nagios-plugins.mo
/usr/share/locale/fr/LC_MESSAGES/nagios-plugins.mo

安装

cd /usr/lib64/nagios/plugins
git clone http://git.centreon.com/centreon-plugins.git
yum install perl net-snmp-perl
yum install perl-XML-LibXML perl-JSON perl-libwww-perl perl-XML-XPath perl-Net-Telnet perl-Net-DNS perl-DBI perl-DBD-MySQL perl-DBD-Pg

使用

# list
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=list-interfaces
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=list-partitions
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=list-storages
perl centreon_plugins.pl --plugin=os::linux::local::plugin --list-mode

# traffic
perl centreon_plugins.pl --plugin=os::linux::local::plugin --statefile-dir=/tmp --mode=traffic --no-loopback --units=%  --name=p1p1 --speed=10000 --critical-in=20 --critical-out=20
perl centreon_plugins.pl --plugin=os::linux::local::plugin --statefile-dir=/tmp --mode=traffic --no-loopback --units=%  --name=em1 --speed=1000 --critical-in=80 --critical-out=80
perl centreon_plugins.pl --plugin=os::linux::local::plugin --statefile-dir=/tmp --mode=traffic --no-loopback --units=%  --name=bond0 --speed=2000 --critical-in=90 --critical-out=90

# memory
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=memory --warning=90 --critical=90

# cpu
perl centreon_plugins.pl --plugin=os::linux::local::plugin  --statefile-dir=/tmp --mode=cpu --warning=99 --critical=99

# diskio-sda1: root
perl centreon_plugins.pl --plugin=os::linux::local::plugin  --statefile-dir=/tmp --mode=diskio --name=sda1 --warning-utils=90 --critical-utils=90
# diskio-sda2: opt
perl centreon_plugins.pl --plugin=os::linux::local::plugin  --statefile-dir=/tmp --mode=diskio --name=sda3 --warning-utils=90 --critical-utils=90
# diskio-sdb1: data or /opt/online01
perl centreon_plugins.pl --plugin=os::linux::local::plugin  --statefile-dir=/tmp --mode=diskio --name=sdb1 --warning-utils=90 --critical-utils=90

# load
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=load --warning=24 --critical=24

# storage root > 5,000,000,000 Byte
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=storage --free --units=B --name=/ --warning=@5000000000 --critical=@5000000000

# storage opt > 10,000,000,000 Byte
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=storage --free --units=B --name=/opt --warning=@10000000000 --critical=@10000000000

# storage data or online01 > 30,000,000,000 Byte
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=storage --free --units=B --name=/opt/online01 --warning=@30000000000 --critical=@30000000000

# 当前值永远处在比较式左方,阀值永远处于比较式右方,如果要反转表达式逻辑的话,阀值前加@。
# 参考程序centreon::plugins::perfdata,方法get_perfdata_for_output & threshold_check,变量arobase

# connections
perl centreon_plugins.pl --plugin=os::linux::local::plugin --mode=connections --warning=20000 --critical=20000
# /etc/nagios/nrpe.d/base.cfg
command[cpu]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --statefile-dir=/tmp --plugin=os::linux::local::plugin --mode=cpu --warning=$ARG1$ --critical=$ARG2$
command[memory]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --plugin=os::linux::local::plugin --mode=memory --warning=$ARG1$ --critical=$ARG2$
command[load]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --plugin=os::linux::local::plugin --mode=load --warning=$ARG1$ --critical=$ARG2$
command[connections]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --plugin=os::linux::local::plugin --mode=connections
command[diskio]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --statefile-dir=/tmp --plugin=os::linux::local::plugin --mode=diskio --name=$ARG1$
command[storage]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --statefile-dir=/tmp --plugin=os::linux::local::plugin --mode=storage --free --units=B --name=$ARG1$ --warning=@$ARG2$ --critical=@$ARG3$
command[traffic]=/usr/lib64/nagios/plugins/centreon-plugins/centreon_plugins.pl --statefile-dir=/tmp --plugin=os::linux::local::plugin --mode=traffic --no-loopback --units=% --name=$ARG1$ --speed=$ARG2$ --warning-in=$ARG3$ --warning-out=$ARG4$ --critical-in=$ARG5$ --critical-out=$ARG6$

你可能感兴趣的:(plugin)