Monitor netstat connection states using nagios.

asam30 at gmail.com asam30 at gmail.com
Fri Apr 10 09:38:37 CEST 2009


Hi Giorgio,

I tried all the ways to fix the problem but still no luck. Do not know how
to run the custom scripts, i will explain in detail here, please someone
guide me here,

Nagios server:

Running the below command, this command will go to nagios client
(172.16.17.18) and execute check_netstat script. The netstat script will
check for port 80 listen status also if there are any TIME_WAIT connections
happens, then it should alert us (WARNING - STATUS= TIME_WAIT port status on
airlin  | WARNING - STATUS=TIME_WAIT port status on airlin). For testing I
made some connections happend to be listen on port 80 and as TIME_WAIT
status. But it still reports as (OK, which means this is reporting
incorrectly)

[nagios at lnx-nagios ~]$  /usr/local/nagios/libexec/check_nrpe -H 172.16.17.18
-c check_netstat
OK - The port is up and running NO established connections on airlin


on Nagios client:,

I executed below command here, and this reports exactly correct as there are
some TIME_WAIT  listening on port 80

[nagios at airlin nagios]$ netstat -an | grep 80
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN
tcp        0      0 172.16.17.18:80         10.10.19.85:2293
TIME_WAIT

[nagios at airlin nagios]$ /usr/local/nagios/libexec/check_netstat
WARNING - STATUS= TIME_WAIT port status on airlin  | WARNING -
STATUS=TIME_WAIT port status on airlin.

The same warning message should appear when I execute first command on
nagios server but it reports incorrectly as (OK, no port status)....

I am running above commands as nagios user because this as preivileges to
run nrpe.

the check_nrpe , nrpe , check_netstat owned by nagios:nagios on both the
servers.

in /etc/sudoers file I wrote below line on both the servers

nagios ALL=/bin/netstat

and

[root at airlin libexec]# sudo -u nagios sudo -l
Password:
User nagios may run the following commands on this host:
    (root) /bin/netstat

in the check_netstat script I wrote the netstat command as,

netstat  -an  | grep 80 > synport12

should I add sudo here???

Please help your valuable suggestions......
thanks








On Thu, Apr 9, 2009 at 8:52 PM, Giorgio Zarrelli <giorgio at zarrelli.org>wrote:

> Hi
>
> As I told before, that netstat command won't work "out of the box", with an
> unprivileged user.
>
> Giorgio
>
> Marc Powell (marc at ena.com) scritto:
> >
> >
> > On Apr 9, 2009, at 8:26 AM, asam30 at gmail.com wrote:
> >
> > > Hi,
> > >
> > > I did copy the scipt to the remote host as check_netstat and used
> > > check_nrpe method to excute from nagios server. It looks when
> > > executing the command on remote server works well,
> > >
> > > [root at airlin libexec]# /usr/local/nagios/libexec/check_netstat
> > > WARNING - STATUS= TIME_WAIT port status on airlin | WARNING -
> > > STATUS=TIME_WAIT port status on airlin
> >
> > You're testing as root here. Test as the user nrpe runs as. It could
> > very well be a difference in privileges...
> >
> > --
> > Marc
> >
> >
> >
> ------------------------------------------------------------------------------
> > This SF.net email is sponsored by:
> > High Quality Requirements in a Collaborative Environment.
> > Download a free trial of Rational Requirements Composer Now!
> > http://p.sf.net/sfu/www-ibm-com
> > _______________________________________________
> > Nagios-users mailing list
> > Nagios-users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/nagios-users
> > ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> > ::: Messages without supporting info will risk being sent to /dev/null
> >
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> High Quality Requirements in a Collaborative Environment.
> Download a free trial of Rational Requirements Composer Now!
> http://p.sf.net/sfu/www-ibm-com
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
> reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
>



-- 
Shankar Asam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.monitoring-lists.org/archive/users/attachments/20090410/459b0e67/attachment.html>
-------------- next part --------------
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
-------------- next part --------------
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null


More information about the Users mailing list