Google+

miércoles, 3 de octubre de 2012

Plantilla check_iostat para PNP4Nagios


He creado esta plantilla PHP para el plugin check_iostat. Se divide en dos partes la TPS y la escritura, lectura en MB por segundo. El resultado es el que muestra la siguiente imagen



Pegar lo siguiente en vuestra carpeta templates de PNP4Nagios, con el nombre check_iostat.php

<?php
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

PNP Template for check_iostat
Author: Ismael Puerto (http://linuxtargz.blogspot.com/)
*/

$opt[1] = "--title \"$hostname / $NAGIOS_DISP_SERVICEDESC \" ";

$def[1] = "DEF:tps=$rrdfile:$DS[1]:AVERAGE " ;
$def[1] .= "COMMENT:\"\\t\\tLAST\\t\\t\\tAVERAGE\\t\\t\\tMAX\\n\" " ;
$def[1] .= "LINE1:tps#E80C3E:\"tps \" ";
$def[1] .= "GPRINT:tps:LAST:\"%6.2lf $LABEL[1]\\t\\t\" ";
$def[1] .= "GPRINT:tps:AVERAGE:\"%6.2lf $LABEL[1]\\t\\t\" ";
$def[1] .= "GPRINT:tps:MAX:\"%6.2lf $LABEL[1] \\n\" ";

$opt[2] = "--vertical-label \"MB/S\" --title \"$hostname / $NAGIOS_DISP_SERVICEDESC \" ";
$def[2] = "DEF:MB_read_s=$rrdfile:$DS[2]:AVERAGE " ;
$def[2] .= "DEF:MB_written_s=$rrdfile:$DS[3]:AVERAGE " ;
$def[2] .= "COMMENT:\"\\t\\t\\t\\tLAST\\t\\tAVERAGE\\t\\tMAX\\n\" " ;

$def[2] .= "LINE2:MB_read_s#E8630C:\"MB_read/s\\t\\t\":STACK " ;
$def[2] .= "GPRINT:MB_read_s:LAST:\"%6.2lf MB/s \" ";
$def[2] .= "GPRINT:MB_read_s:AVERAGE:\"%6.2lf MB/s \" ";
$def[2] .= "GPRINT:MB_read_s:MAX:\"%6.2lf MB/s \\n\" ";

$def[2] .= "LINE2:MB_written_s#008000:\"MB_written/s\\t\":STACK  ";
$def[2] .= "GPRINT:MB_written_s:LAST:\"%6.2lf MB/s \" ";
$def[2] .= "GPRINT:MB_written_s:AVERAGE:\"%6.2lf MB/s \" ";
$def[2] .= "GPRINT:MB_written_s:MAX:\"%6.2lf MB/s \" ";
?>