PNP4nagios
cp -r modules/* /usr/share/icingaweb2/modules/
ln -s /usr/local/pnp4nagios/etc/* /etc/pnp4nagios/
#vim /etc/pnp4nagios/npcd.cfg
#vim /etc/pnp4nagios/process_perfdata.cfg
|
library “perfdata”
object PerfdataWriter “perfdata” {
service_format_template = “DATATYPE::SERVICEPERFDATA\tTIMET::$icinga.timet$\tHOSTNAME::$host.name$\tSERVICEDESC::$service.name$\tSERVICEPERFDATA::$service.
perfdata$\tSERVICECHECKCOMMAND::$service.check_command$$pnp_check_arg1$\tHOSTSTATE::$host.state$\tHOSTSTATETYPE::$host.state_type$\tSERVICESTATE::$service.
state$\tSERVICESTATETYPE::$service.state_type$”
}
template Service “pnp-svc” {
action_url = “/pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$”
vars.pnp_check_arg1 = “”
}
apply Service “nrpe_traffic” {
import “generic-service”
import “pnp-svc”
check_command = “nrpe”
assign where host.name == “kddi-pxe”
assign where host.name == “kddi-deploy”
vars.nrpe_timeout = 240
vars.nrpe_command = “check_traffic”
vars.pnp_check_arg1 = “!$nrpe_command$”
}
CUSTOM_TEMPLATE = 0,1
DATATYPE = GAUGE
USE_MAX_ON_CREATE = 0
<?php
#
Copyright (c) 2006-2010 Joerg Linge (http://www.pnp4nagios.org)
Plugin: check_bmon
Output: TRAFFIC OK|in=131.9Bps; out=185Bps;
$opt[1] = “–vertical-label \”Bytes/s\” –title \”$servicedesc\” “;
$def[1] = “DEF:var1=$RRDFILE[1]:$DS[1]:AVERAGE “ ;
$def[1] .= “DEF:var2=$RRDFILE[2]:$DS[2]:AVERAGE “ ;
$def[1] .= “CDEF:var3=var2,-1,* “ ;
$def[1] .= “AREA:var1#00ff00:\”in\” “ ;
$def[1] .= “GPRINT:var1:LAST:\”%.1lf %SBytes last\” “ ;
$def[1] .= “GPRINT:var1:AVERAGE:\”%.1lf %SBytes avg\” “ ;
$def[1] .= “GPRINT:var1:MAX:\”%.1lf %SBytes max\n\” “ ;
$def[1] .= “AREA:var2#0066FF:\”out\” “ ;
$def[1] .= “AREA:var3#0066FF:\”out\” “ ;
$def[1] .= “GPRINT:var2:LAST:\”%.1lf %SBytes last\” “ ;
$def[1] .= “GPRINT:var2:AVERAGE:\”%.1lf %SBytes avg\” “ ;
$def[1] .= “GPRINT:var2:MAX:\”%.1lf %SBytes max\” “;
?>
```
pnp template 文档
https://docs.pnp4nagios.org/pnp-0.6/tpl_custom
icinga2官方集成pnp4nagios模板攻略
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/chapter/addons-plugins?highlight-search=pnp4nagios#addons-graphing-pnp-custom-templates