<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';">Hi!</span></font><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';"><o:p> <br></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB">I’m checking cpu status
using check_mrtg command and i always get STATE_UNKNOWN when the state is Ok. I
have modified the check_mrtg.c file like this:<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font style="font-size: 10pt;" size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB">int<o:p></o:p></span></font></p><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> main (int argc, char **argv)<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> {<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> /* int result = STATE_UNKNOWN; */<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> int result = STATE_OK;<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> FILE *fp;<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> int line;<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"> char input_buffer[MAX_INPUT_BUFFER];<o:p></o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB"><o:p> </o:p></span></font></pre><pre><font size="2" face="Courier New"><span style="font-size: 10pt;" lang="EN-GB">etc…<o:p></o:p></span></font></pre>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB">But the problem is not
solved, I always get the service status like this:</span></font><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> <br></o:p></span></font></p>
<table class="MsoNormalTable" style="width: 100%;" width="100%" border="0" cellpadding="0">
<tbody>
<tr>
<td style="padding: 0.75pt;">
<table class="MsoNormalTable" style="width: 100%;" width="100%" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding: 0cm;">
<table class="MsoNormalTable" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding: 0cm;">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">CPU LOAD VIA
MRTG<o:p></o:p></span></font></p></td></tr></tbody></table>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><o:p></o:p></span></font></p></td>
<td style="padding: 0cm;">
<div align="right">
<table class="MsoNormalTable" border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding: 0cm;">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><o:p> </o:p></span></font></p></td></tr></tbody></table></div>
<p class="MsoNormal" style="text-align: right;" align="right"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><o:p></o:p></span></font></p></td></tr></tbody></table>
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;"><o:p></o:p></span></font></p></td>
<td style="padding: 0.75pt;">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">UNKNOWN<o:p></o:p></span></font></p></td>
<td style="padding: 0.75pt;" nowrap="nowrap">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">05-14-2009 11:35:31<o:p></o:p></span></font></p></td>
<td style="padding: 0.75pt;" nowrap="nowrap">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">0d 0h 11m 27s<o:p></o:p></span></font></p></td>
<td style="padding: 0.75pt;">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">5/5<o:p></o:p></span></font></p></td>
<td style="padding: 0.75pt;">
<p class="MsoNormal"><font size="3" face="Times New Roman"><span style="font-size: 12pt;">Max. value =
1 <o:p></o:p></span></font></p></td></tr></tbody></table>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB">This is what I have added
at /usr/local/nagios/etc/objects/commands.cfg:<o:p></o:p></span></font></p>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB"># 'check_local_mrtgcpu'
command definition<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">define
command{<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB"> command_name
check_local_mrtgcpu<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB"> command_line
$USER1$/check_mrtg -F $ARG1$ -a $ARG2$ -v $ARG3$ -w $ARG4$ -c $ARG5$ -e
$ARG6$<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB"> }</span></font><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p></o:p></span></font></p>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB">And the service added to
/usr/local/nagios/etc/objects/switch.cfg:<o:p></o:p></span></font></p>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">################################################<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB"># Monitor CPU LOAD on
FIREWALL using MRTG GRAPHS<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">################################################<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">define
service{<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
use generic-service ; Inherit values from a
template<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
host_name TICS_FIREWALL<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
service_description CPU LOAD VIA MRTG<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
check_command
check_local_mrtgcpu!/var/www/html/mrtg/172.17.17.3_cpu.log!MAX!1!90!75!5<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
max_check_attempts 5<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
check_interval 5<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
retry_interval 5<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
check_period 24x7<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
notification_interval 5<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
notification_period 24x7<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
notification_options w,c,r<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
notifications_enabled 1<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB">
contact_groups admins<o:p></o:p></span></font></p>
<p class="MsoNormal"><font size="2" face="Courier New"><span style="font-size: 10pt; font-family: 'Courier New';" lang="EN-GB"> }</span></font><font size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p></o:p></span></font></p>
<p class="MsoNormal"><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB"><o:p> </o:p></span></font><font style="font-size: 10pt;" size="2" face="Trebuchet MS"><span style="font-size: 10pt; font-family: 'Trebuchet MS';" lang="EN-GB">What am I doing wrong?? The
nagios plugins I’m using are 1.4.12 thanks very
much</span></font></p><p class="MsoNormal">AiGoR!<br></p><br /><hr />¿Eres del Madrid, del Barça, del Atleti...? Apoya a tu equipo en la <a href='http://opiniones.msn.es/default.aspx/Futbol/Atletico-de-Madrid ' target='_new'>Zona Fan de MSN Deportes</a></body>
</html>