check_mem issues with graph
Posted: Mon May 12, 2014 3:25 pm
I have started to use a custom check_mem for monitoring memory & swap usage on my linux hosts. I'm working off of https://github.com/whereisaaron/linux-c ... ios-plugin which is based on http://exchange.nagios.org/directory/Pl ... sh/details. I've added a little bit to include swap usage.
I am having an issue with the graph as it's just showing up as a dead image. The plugin includes a custom graph template which I have installed but it does not seem to be working. I've made sure it's not my additions that broke the graph as it did not work before I started to massage the code.
I also know it's not the name of the graph template as if I put in the default template code into the file it creates the default pnp4nagios graph.
The graph template looks like this:
I am having an issue with the graph as it's just showing up as a dead image. The plugin includes a custom graph template which I have installed but it does not seem to be working. I've made sure it's not my additions that broke the graph as it did not work before I started to massage the code.
I also know it's not the name of the graph template as if I put in the default template code into the file it creates the default pnp4nagios graph.
The graph template looks like this:
Code: Select all
<?php
$ds_name[1] = "sysinfo";
$opt[1] = "--vertical-label \"Bytes\" -l0 --title \"Memory usage for $hostname / $servicedesc\" ";
# Total Memory
$def[1] = "DEF:mem_total=$RRDFILE[1]:$DS[1]:AVERAGE " ;
# Used Memory
$def[1] .= "DEF:mem_used=$RRDFILE[1]:$DS[2]:AVERAGE " ;
# Cache
$def[1] .= "DEF:mem_cache=$RRDFILE[1]:$DS[3]:AVERAGE " ;
# Buffer
$def[1] .= "DEF:mem_buffer=$RRDFILE[1]:$DS[4]:AVERAGE " ;
# Memory Cache
$def[1] .= rrd::cdef("mem_cache_tmp", "mem_cache,mem_buffer,+,mem_used,+");
$def[1] .= rrd::area("mem_cache_tmp", "#DCDDD5", "Disk Cache");
$def[1] .= "GPRINT:mem_cache:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_cache:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_cache" . ':AVERAGE:"%3.2lf %sB Average \j" ';
# Memory Buffer
$def[1] .= rrd::cdef("mem_buffer_tmp", "mem_buffer,mem_used,+");
$def[1] .= rrd::area("mem_buffer_tmp", "#3E606F", "I/O Buffers");
$def[1] .= "GPRINT:mem_buffer:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_buffer:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_buffer" . ':AVERAGE:"%3.2lf %sB Average \j" ';
# Memory Used
$def[1] .= rrd::area("mem_used", "#193441", "Processes");
$def[1] .= "GPRINT:mem_used:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_used:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_used" . ':AVERAGE:"%3.2lf %sB Average \j" ';
# Memory Total
$def[1] .= rrd::line1("mem_total", "#000000", "Total");
$def[1] .= "GPRINT:mem_total:LAST:\"%3.2lf %sB Last \" ";
$def[1] .= "GPRINT:mem_total:MAX:\"%3.2lf %sB Max \" ";
$def[1] .= "GPRINT:mem_total" . ':AVERAGE:"%3.2lf %sB Average \j" ';
if ($WARN[2] != "") {
$def[1] .= "HRULE:$WARN[2]#ffff00:\"Warning threshold for Processes\j\" ";
}
if ($CRIT[2] != "") {
$def[1] .= "HRULE:$CRIT[2]#ff0000:\"Critical threshold for Processes\" ";
}
?>