Page 1 of 1

PNP4nagios Template for a service

Posted: Mon Dec 22, 2014 7:27 am
by akhtarbhat
Hi Everyone,

Need your assistance to write a custom pnp template to draw a graph in nagios :

Scenario :

Just want to draw a line for a service.

1 means service is UP
0 means service is down.

I don't want any average or anything.

Please assist me how can I achieve this ?

Regards

Re: PNP4nagios Template for a service

Posted: Mon Dec 22, 2014 4:15 pm
by scottwilkerson
I don't believe a custom template is necessary, isn't this what the default template writes out?

Or something like this

Code: Select all

<?php

$opt[1] = "--lower=$MIN[1] --vertical-label \"State\"  --title \"State\" ";

$def[1] =  "DEF:var1=$rrdfile:$DS[1]:MAX " ;
$def[1] .= "LINE1:var1#000000:\"\" " ;

if ($WARN[1] != "") {
        $def[1] .= "HRULE:$WARN[1]#FFFF00 ";
}
if ($CRIT[1] != "") {
        $def[1] .= "HRULE:$CRIT[1]#FF0000 ";
}

$def[1] .= "GPRINT:var1:LAST:\"%.0lf $UNIT[1] LAST \" "; 
$def[1] .= "GPRINT:var1:MAX:\"%.0lf $UNIT[1] MAX \" "; 
?>