[rrd-users] pnp4nagios php cdef Grand Total

Matt.Garrett at shell.com Matt.Garrett at shell.com
Mon Sep 20 15:24:33 CEST 2010


Folks

 

A little off topic but maybe someone can help.

 

Using pnp4nagios php template to loop through all rrds of a certain
type, which works fine.

However I would like to get the Grand Total of all rrds

 

I know CDEF is the answer and can do this using php hard coding but just
cannot find out how to get this to work inside a php foreach loop

e.g

CDEF:total=var1,var2,+,var3,+

 

The php code I have been using is:

 

foreach($services as $key=>$val){

    #

    # get the data for a given Host/Service

    $data = $this->tplGetData($val['host'],$val['service']);

     #

        $hostname   = rrd::cut($data['MACRO']['HOSTNAME']);

    $def[0]    .= rrd::def("var$key" , $data['DS'][0]['RRDFILE'],
$data['DS'][0]['DS'] );

    $def[0]    .= rrd::line1("var$key", rrd::color($key), $hostname);

    $def[0]    .= rrd::gprint("var$key", array("LAST", "MAX"));

}

?>

 

Matthew

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-users/attachments/20100920/f13f66d6/attachment.htm 


More information about the rrd-users mailing list