PNP4nagios Template for a service

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
akhtarbhat
Posts: 1
Joined: Thu Nov 27, 2014 2:55 am

PNP4nagios Template for a service

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: PNP4nagios Template for a service

Post 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 \" "; 
?>
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked