<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Again, as I and Patrick have said, your host's check_command is only
getting run when a service is deemed to have problems.<br>
<br>
You're getting the difference in the uptime output in Nagios and the
console because Nagios hasn't run the uptime command for the host for
over a day.<br>
If you're not retaining status information, then when you restart
Nagios, it re-runs all it's checks, hence why it then gets updated. 
After that it is only run when a service fails.<br>
<br>
What I still don't understand is how your uptime command ensures the
router is up?  If the router is not up, then Nagios won't be running
(as you're running it on the same host) so it seems quite pointless
really.  If the Lanlink checks that the LAN interface is up and
connected - that makes sense, but then a check_ping to 127.0.0.1 as
your host check_command would give the same result as the uptime, then
you could have an "Uptime" service with your check_uptime command.  <br>
<br>
That way you could be confident that the status detail in Nagios is
reasonably up-to-date.<br>
<br>
Andy.<br>
<br>
sujith h wrote:
<blockquote
 cite="mide4a2c74c0702280153g463c9f89pb0b5bd944f96c3ce@mail.gmail.com"
 type="cite">Ok let me explain the scenario in detail. <br>
I have  my router in which nagios is installed.<br>
I have to monitor a few services like Lanstatus of <br>
net1 interface, Webserver, and DNS.<br>
Well now for this I have a host.cfg and services.cfg file<br>
where I had configured this way<span style="text-decoration: underline;">:</span><br
 style="text-decoration: underline;">
  <span style="text-decoration: underline;">Host.cfg</span><br>
define hostgroup{
  <br>
    hostgroup_name          Enpaq<br>
    alias                   Enpaq<br>
    members                 sujith<br>
}<br>
  <br>
define host{<br>
    host_name               sujith<br>
    alias                   Enpaq Router<br>
    address                 <a href="http://127.0.0.1">127.0.0.1</a><br>
    max_check_attempts      1<br>
    check_command           check_uptime<br>
    check_period            24x7<br>
    contact_groups          admin<br>
    notification_interval   0<br>
    notification_period     24x7<br>
    notification_options    d,u,r,f<br>
}<br>
  <br>
And <span style="text-decoration: underline;">services.cfg<br>
  </span>define service{<br>
    host_name               sujith
  <br>
    service_description     LAN LINK<br>
    check_command           check_link!net1<br>
    max_check_attempts      1<br>
    normal_check_interval   1<br>
    retry_check_interval    1<br>
    check_period            24x7
  <br>
    notification_interval   2<br>
    notification_period     24x7<br>
    notification_options    w,u,c,r,f<br>
    contact_groups          admin<br>
}<br>
  <span style="text-decoration: underline;"><br>
  </span>define service{
  <br>
    host_name               sujith<br>
    service_description     WEB SERVER<br>
    check_command           check_procs!1:!1:!apache2!SNSlSsRl<br>
    max_check_attempts      1<br>
    normal_check_interval   1<br>
    retry_check_interval    1
  <br>
    check_period            24x7<br>
    notification_interval   2<br>
    notification_period     24x7<br>
    notification_options    w,u,c,r,f<br>
    contact_groups          admin<br>
}<br>
  <br>
  <br>
define service{<br>
    host_name               sujith
  <br>
    service_description     DNS<br>
    check_command           check_dig!sujith.elina.in<br>
    max_check_attempts      1<br>
    normal_check_interval   1<br>
    retry_check_interval    1<br>
    check_period            24x7
  <br>
    notification_interval   2<br>
    notification_period     24x7<br>
    notification_options    w,u,c,r,f<br>
    contact_groups          admin<br>
}<br>
  <br>
This is all about the 2 files. And let me give the output also.
  <br>
When I type the command uptime in my router I see like this:<br>
sujith@sujith:~$uptime<br>
 15:15:50 up 4 days,  4:54,  1 user,  load average: 0.76, 0.70, 0.59<br>
  <br>
And when I see the nagios page for the Host Detail section, the Status
Information shows me:
  <br>
  <br>
20:17:46 up 3 days, 9:56, 1 user, load average: 0.89, 0.86, 0.71 
  <br>
  <br>
But the output that I had given you is from the running nagios page.<br>
If i would restart nagios then everything will be ok for a while.<br>
This is what I want to know why this output comes like this.<br>
Again in the /var/nagios/status.dat file is there which when I do
  <br>
ls -lt command , it shows me that its getting updated in each and<br>
every minute. Now if u again have any doubt on what I am trying to<br>
tell please do mail me. Again I do repeat that when I do <br>
/usr/local/nagios/bin/nagios -v /etc/nagios/etc/nagios.cfg <br>
It doesn't give me any error. But this misbehaviour is worrying<br>
me....<br>
  <br>
  <br>
Sujith<br>
  <br>
Bangalore<br>
  <br>
  <div><span class="gmail_quote">On 2/28/07, <b
 class="gmail_sendername">Andy Shellam (Mailing Lists)</b> <<a
 href="mailto:andy.shellam-lists@mailnetwork.co.uk">andy.shellam-lists@mailnetwork.co.uk</a>>
wrote:</span>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
    <div bgcolor="#ffffff" text="#000000">I think you need to explain
what you're trying to do overall, as this
isn't making any sense to me!<br>
    <br>
You cannot possibly determine which server is responding using it's
uptime output.<br>
A more sensible option surely would be it's hostname?<br>
    <br>
#!/bin/bash<br>
hostname<br>
exit 0<br>
    <br>
However you're going to run into a lot of trouble trying to use Nagios
to monitor a server using its dynamic IP address.<br>
I think to start with you need to be looking at a solution such as
Dynamic DNS (e.g. No-IP, DynDNS for commercial services, or Bind with
DNSSEC/TSIG if you use Bind within your organisation.)<br>
Your machines would then change their DNS address when they detect
their IP address has changed, and you would definite it's dynamic DNS
hostname as the host_name directive to Nagios.<br>
Only thing you'd have to watch would be if your DNS service fails,
Nagios will fail on everything.<br>
    <br>
Re your last e-mail, please give example outputs of what you see on the
command-line and what Nagios says.<br>
    <br>
Andy.<br>
    <br>
sujith h wrote:
    <blockquote
 cite="http://mide4a2c74c0702280105w7b0a70a5v5d75868d497a65f6@mail.gmail.com"
 type="cite">
      <div><span class="e" id="q_11107a3f9d577fde_1">Actually the
problem with the ping is that we are giving
dynamic IP address<br>
so when the ip address changes its difficult to know who is responding
to the<br>
ping.  And so we moved to ssh and uptime...<br>
      <br>
Sujith<br>
      <br>
Bangalore.<span style="font-style: italic;"></span><br>
      <br>
      </span></div>
      <div>
      <div><span class="e" id="q_11107a3f9d577fde_3"><span
 class="gmail_quote">On 2/28/07, <b class="gmail_sendername">sujith h</b>
<<a href="mailto:sujith.linux@gmail.com" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
sujith.linux@gmail.com</a>>
wrote: </span> </span></div>
      <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
        <div><span class="e" id="q_11107a3f9d577fde_5">Hi
Andy,<br>
        <br>
Actually my problem is that it works for some 1 day or more. But after
that I get these sort of <br>
results. So thats what makes me worry... <br>
        <br>
Sujith<br>
Bangalore </span></div>
        <div><span><br>
        <br>
        <div>
        <div><span class="e" id="q_11107a3f9d577fde_7"><span
 class="gmail_quote">On 2/28/07, <b class="gmail_sendername">Andy
Shellam (Mailing Lists)</b> <<a
 href="mailto:andy.shellam-lists@mailnetwork.co.uk" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
andy.shellam-lists@mailnetwork.co.uk </a>> wrote:</span> </span></div>
        <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
          <div bgcolor="#ffffff" text="#000000">
          <div><span class="e" id="q_11107a3f9d577fde_9">As Patrick
said, this
plugin (as a host check) will only get run if a
service goes into a non-OK state, therefore showing old information
until it a service fails.<br>
          <br>
I have exactly the same plugin (written myself with a couple of
differences to yours) which runs as a service called "Uptime" on every
host - this way it is always run every 5 minutes and shows up-to-date
info.<br>
          <br>
The host check is a simple check_ping.<br>
          <br>
HTH<br>
          <br>
Andy.<br>
          <br>
sujith h wrote: </span></div>
          <blockquote
 cite="http://mide4a2c74c0702272303h7ea3d898w2ccaaf5f29a4727c@mail.gmail.com"
 type="cite">
            <div><span class="e" id="q_11107a3f9d577fde_11">
            <div><span><br>
No am running this plugin for host check only<br>
            <br>
Sujith<br>
            </span></div>
            <div>
            <div><span><span class="gmail_quote">On 2/28/07, <b
 class="gmail_sendername">Morris, Patrick</b> <<a
 href="mailto:patrick.morris@hp.com" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">
patrick.morris@hp.com </a>> wrote:</span>
            <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">>
when I click the Host Detail I can see that<br>
> in the status information section we have a different output..
such <br>
aser<br>
> 20:17:46 up 3 days, 9:56, 1 user, load average: 0.89, 0.86, 0.71<br>
              <br>
> Here u can see that am not getting the output synchronized.<br>
              <br>
>               But the problem I had found with uptime only in <br>
> the Host Detail. The Service Details<br>
>               are running good as if now.<br>
              <br>
Are you running this command as both a host check and a service check?<br>
If so, that's why you're seeing different output. The host check will <br>
only run if a service on it goes to a non-OK state, and probably hasn't<br>
run for a few days, when the host had only been up for two minutes.<br>
              <br>
It looks like you've defined the same plugin for two checks. If that's <br>
the case, they are never going to match.<br>
              <br>
            </blockquote>
            </span></div>
            </div>
            <br>
            </span></div>
            <span class="q">
            <pre><hr size="4" width="90%"><span>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your



opinions on IT & business topics through brief surveys-and earn cash
<a
 href="http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">


http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV</a></span>


  </pre>
            <pre><hr size="4" width="90%"><span>
_______________________________________________
Nagios-users mailing list
<a href="mailto:Nagios-users@lists.sourceforge.net" target="_blank"
 onclick="return top.js.OpenExtLink(window,event,this)">Nagios-users@lists.sourceforge.net


</a>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users"
 target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.sourceforge.net/lists/listinfo/nagios-users</a></span>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null

!DSPAM:37,45e52941103001189734924!
  </pre>
            </span></blockquote>
          <span class="q"> <br>
          <br>
          <pre cols="72">-- 
Andy Shellam
NetServe Support Team

the Mail Network
"an alternative in a standardised world"

p: +44 (0) 121 288 0832/0839
m: +44 (0) 7818 000834</pre>
          </span></div>
        </blockquote>
        </div>
        <br>
        </span></div>
      </blockquote>
      </div>
      <br>
!DSPAM:37,45e545e1103007241816293!
    </blockquote>
    <span class="q"><br>
    <br>
    <pre cols="72">-- 
Andy Shellam
NetServe Support Team

the Mail Network
"an alternative in a standardised world"

p: +44 (0) 121 288 0832/0839
m: +44 (0) 7818 000834</pre>
    </span></div>
  </blockquote>
  </div>
  <br>
!DSPAM:37,45e55161103009057313425!
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Andy Shellam
NetServe Support Team

the Mail Network
"an alternative in a standardised world"

p: +44 (0) 121 288 0832/0839
m: +44 (0) 7818 000834</pre>
</body>
</html>