<div class="gmail_quote">Hi All,<br><br>I've tried all suggestions and there are not worked. Please find the files/permissions, provide any help would be appreciated<br><br>SCRIPT<br>*************************************************************************<br>
<br>#!/bin/sh<div class="im"><br><br>
STATE_OK=0<br>STATE_WARNING=1<br>STATE_CRITICAL=2<br>STATE_UNKNOWN=3<br><br></div><div class="im">netstat -an | grep 80 > synport12<br></div>err=`cat synport12 | grep -i TIME_WAIT | wc -l |awk '{print $1}'`<div class="im">
<br>if [ $err -gt 0 ]<br>then<br>
echo "WARNING - STATUS= TIME_WAIT port status on $HOSTNAME | "WARNING - STATUS=TIME_WAIT port status on $HOSTNAME<br>exit $STATE_CRITICAL<br>else<br></div>echo "OK - The port is up and running NO established connections on $HOSTNAME"<br>
exit $STATE_OK<br>fi<br><br>*******************************************************************************<br><br>ON nagios server<br>*******************<br>[nagios@lnx-nagios libexec]$ pwd<br>/usr/local/nagios/libexec<br>
<br>drwxrwxr-x 2 nagios nagios 4.0K Apr 9 18:37 .<br>drwxrwxr-x 8 nagios nagios 4.0K Dec 26 12:43 ..<br>-rwxr-xr-x 1 nagios nagios 53K Aug 7 2008 check_apt<br>-rwxr-xr-x 1 nagios nagios 2.3K Aug 7 2008 check_breeze<br>
-rwxr-xr-x 1 nagios nagios 63K Aug 7 2008 check_by_ssh<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_clamd -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 38K Aug 7 2008 check_cluster<br>-r-sr-xr-x 1 root nagios 65K Aug 7 2008 check_dhcp<br>
-rwxr-xr-x 1 nagios nagios 59K Aug 7 2008 check_dig<br>-rwxr-xr-x 1 nagios nagios 89K Aug 7 2008 check_disk<br>-rwxr-xr-x 1 nagios nagios 8.0K Aug 7 2008 check_disk_smb<br>-rwxr-xr-x 1 nagios nagios 64K Aug 7 2008 check_dns<br>
-rwxr-xr-x 1 nagios nagios 34K Aug 7 2008 check_dummy<br>-rwxr-xr-x 1 nagios nagios 3.1K Aug 7 2008 check_file_age<br>-rwxr-xr-x 1 nagios nagios 6.3K Aug 7 2008 check_flexlm<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_ftp -> check_tcp<br>
-rwxr-xr-x 1 nagios nagios 141K Aug 7 2008 check_http<br>-r-sr-xr-x 1 root nagios 71K Aug 7 2008 check_icmp<br>-rwxr-xr-x 1 nagios nagios 43K Aug 7 2008 check_ide_smart<br>-rwxr-xr-x 1 nagios nagios 15K Aug 7 2008 check_ifoperstatus<br>
-rwxr-xr-x 1 nagios nagios 13K Aug 7 2008 check_ifstatus<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_imap -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 7.3K Aug 7 2008 check_ircd<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_jabber -> check_tcp<br>
-rwxr-xr-x 1 nagios nagios 53K Aug 7 2008 check_ldap<br>lrwxrwxrwx 1 root root 10 Aug 7 2008 check_ldaps -> check_ldap<br>-rwxr-xr-x 1 nagios nagios 49K Aug 7 2008 check_load<br>-rwxr-xr-x 1 nagios nagios 6.0K Aug 7 2008 check_log<br>
-rwxr-xr-x 1 nagios nagios 20K Aug 7 2008 check_mailq<br>-rwxr-xr-x 1 nagios nagios 44K Aug 7 2008 check_mrtg<br>-rwxr-xr-x 1 nagios nagios 43K Aug 7 2008 check_mrtgtraf<br>-rwxr-xr-x 1 nagios nagios 63K Aug 7 2008 check_mysql<br>
-rwxr-xr-x 1 nagios nagios 59K Aug 7 2008 check_mysql_query<br>-rwxr-xr-x 1 nagios nagios 50K Aug 7 2008 check_nagios<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_nntp -> check_tcp<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_nntps -> check_tcp<br>
-rwxr-xr-x 1 nagios nagios 53K Aug 8 2008 check_nrpe<br>-rwxr-xr-x 1 nagios nagios 64K Aug 7 2008 check_nt<br>-rwxr-xr-x 1 nagios nagios 67K Aug 7 2008 check_ntp<br>-rwxr-xr-x 1 nagios nagios 61K Aug 7 2008 check_ntp_peer<br>
-rwxr-xr-x 1 nagios nagios 60K Aug 7 2008 check_ntp_time<br>-rwxr-xr-x 1 nagios nagios 84K Aug 7 2008 check_nwstat<br>-rwxr-xr-x 1 nagios nagios 8.3K Dec 17 14:22 check_oracle<br>-rwxr-xr-x 1 nagios nagios 54K Aug 7 2008 check_overcr<br>
-rwxr-xr-x 1 nagios nagios 68K Aug 7 2008 check_ping<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_pop -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 67K Aug 7 2008 check_procs<br>-rwxr-xr-x 1 nagios nagios 52K Aug 7 2008 check_real<br>
-rwxr-xr-x 1 nagios nagios 9.5K Aug 7 2008 check_rpc<br>-rwxr-xr-x 1 nagios nagios 1.2K Aug 7 2008 check_sensors<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_simap -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 99K Aug 7 2008 check_smtp<br>
lrwxrwxrwx 1 root root 9 Aug 7 2008 check_spop -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 49K Aug 7 2008 check_ssh<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_ssmtp -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 52K Aug 7 2008 check_swap<br>
-rwxr-xr-x 1 nagios nagios 88K Aug 7 2008 check_tcp<br>-rwxr-xr-x 1 nagios nagios 52K Aug 7 2008 check_time<br>lrwxrwxrwx 1 root root 9 Aug 7 2008 check_udp -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 59K Aug 7 2008 check_ups<br>
-rwxr-xr-x 1 nagios nagios 48K Aug 7 2008 check_users<br>-rwxr-xr-x 1 nagios nagios 3.0K Aug 7 2008 check_wave<br>-rwxr-xr-x 1 nagios nagios 49K Aug 7 2008 negate<br>-rwxr-xr-x 1 nagios nagios 86K Aug 8 2008 nrpe<br>
-rwxr-xr-x 1 nagios nagios 7.1K Aug 8 2008 nrpe.cfg<br>-rwxr-xr-x 1 nagios nagios 47K Aug 7 2008 urlize<br>-rwxr-xr-x 1 nagios nagios 2.1K Aug 7 2008 <a href="http://utils.pm" target="_blank">utils.pm</a><br>-rwxr-xr-x 1 nagios nagios 862 Aug 7 2008 utils.sh<br>
<br><br>On Nagios client<br>********************<br><br>[nagios@airlin libexec]$ pwd<br>/usr/local/nagios/libexec<br><br>total 2828<br>-rwxr-xr-x 1 root root 169277 Jul 28 2008 check_apt<br>-rwxr-xr-x 1 root root 2265 Jul 28 2008 check_breeze<br>
-rwxr-xr-x 1 root root 57891 Jul 28 2008 check_by_ssh<br>lrwxrwxrwx 1 root root 9 Jul 28 2008 check_clamd -> check_tcp<br>-rwxr-xr-x 1 root root 34870 Jul 28 2008 check_cluster<br>
-r-sr-xr-x 1 root root 59896 Jul 28 2008 check_dhcp<br>-rwxr-xr-x 1 root root 53316 Jul 28 2008 check_dig<br>-rwxr-xr-x 1 root root 202136 Jul 28 2008 check_disk<br>-rwxr-xr-x 1 root root 8163 Jul 28 2008 check_disk_smb<br>
-rwxr-xr-x 1 root root 58043 Jul 28 2008 check_dns<br>-rwxr-xr-x 1 root root 30895 Jul 28 2008 check_dummy<br>-rwxr-xr-x 1 root root 3143 Jul 28 2008 check_file_age<br>-rwxr-xr-x 1 root root 6395 Jul 28 2008 check_flexlm<br>
lrwxrwxrwx 1 root root 9 Jul 28 2008 check_ftp -> check_tcp<br>-rwxr-xr-x 1 root root 257943 Jul 28 2008 check_http<br>-r-sr-xr-x 1 root root 64965 Jul 28 2008 check_icmp<br>
-rwxr-xr-x 1 root root 39055 Jul 28 2008 check_ide_smart<br>-rwxr-xr-x 1 root root 15310 Jul 28 2008 check_ifoperstatus<br>-rwxr-xr-x 1 root root 12853 Jul 28 2008 check_ifstatus<br>
lrwxrwxrwx 1 root root 9 Jul 28 2008 check_imap -> check_tcp<br>-rwxr-xr-x 1 root root 7429 Jul 28 2008 check_ircd<br>lrwxrwxrwx 1 root root 9 Jul 28 2008 check_jabber -> check_tcp<br>
-rwxr-xr-x 1 root root 48777 Jul 28 2008 check_ldap<br>lrwxrwxrwx 1 root root 10 Jul 28 2008 check_ldaps -> check_ldap<br>-rwxr-xr-x 1 root root 43795 Jul 28 2008 check_load<br>
-rwxr-xr-x 1 root root 6062 Jul 28 2008 check_log<br>-rwxr-xr-x 1 root root 20367 Jul 28 2008 check_mailq<br>-rwxr-xr-x 1 root root 40486 Jul 28 2008 check_mrtg<br>-rwxr-xr-x 1 root root 39055 Jul 28 2008 check_mrtgtraf<br>
-rwxr-xr-x 1 root root 45592 Jul 28 2008 check_nagios<br>-rwxr-xr-x 1 nagios nagios 444 Apr 10 12:37 check_netstat<br>lrwxrwxrwx 1 root root 9 Jul 28 2008 check_nntp -> check_tcp<br>
lrwxrwxrwx 1 root root 9 Jul 28 2008 check_nntps -> check_tcp<br>-rwxr-xr-x 1 nagios nagios 55872 Jul 28 2008 check_nrpe<br>-rwxr-xr-x 1 root root 57239 Jul 28 2008 check_nt<br>
-rwxr-xr-x 1 root root 60513 Jul 28 2008 check_ntp<br>-rwxr-xr-x 1 root root 55544 Jul 28 2008 check_ntp_peer<br>-rwxr-xr-x 1 root root 53548 Jul 28 2008 check_ntp_time<br>-rwxr-xr-x 1 root root 75669 Jul 28 2008 check_nwstat<br>
-rwxr-xr-x 1 root root 8366 Jul 28 2008 check_oracle<br>-rwxr-xr-x 1 root root 49971 Jul 28 2008 check_overcr<br>-rwxr-xr-x 1 root root 47093 Jul 28 2008 check_pgsql<br>-rwxr-xr-x 1 root root 62651 Jul 28 2008 check_ping<br>
lrwxrwxrwx 1 root root 9 Jul 28 2008 check_pop -> check_tcp<br>-rwxr-xr-x 1 root root 61001 Jul 28 2008 check_procs<br>-rwxr-xr-x 1 root root 47725 Jul 28 2008 check_real<br>
-rwxr-xr-x 1 root root 9707 Jul 28 2008 check_rpc<br>-rwxr-xr-x 1 root root 1176 Jul 28 2008 check_sensors<br>lrwxrwxrwx 1 root root 9 Jul 28 2008 check_simap -> check_tcp<br>
-rwxr-xr-x 1 root root 215773 Jul 28 2008 check_smtp<br>lrwxrwxrwx 1 root root 9 Jul 28 2008 check_spop -> check_tcp<br>-rwxr-xr-x 1 root root 44229 Jul 28 2008 check_ssh<br>
lrwxrwxrwx 1 root root 9 Jul 28 2008 check_ssmtp -> check_tcp<br>-rwxr-xr-x 1 root root 47371 Jul 28 2008 check_swap<br>-rwxr-xr-x 1 root root 82929 Jul 28 2008 check_tcp<br>
-rwxr-xr-x 1 root root 47012 Jul 28 2008 check_time<br>lrwxrwxrwx 1 root root 9 Jul 28 2008 check_udp -> check_tcp<br>-rwxr-xr-x 1 root root 54897 Jul 28 2008 check_ups<br>
-rwxr-xr-x 1 root root 42488 Jul 28 2008 check_users<br>-rwxr-xr-x 1 root root 3019 Jul 28 2008 check_wave<br>-rwxr-xr-x 1 root root 44410 Jul 28 2008 negate<br>-rwxr-xr-x 1 nagios nagios 83120 Jul 28 2008 nrpe<br>
-rwxrwxrwx 1 nagios nagios 8336 Apr 9 14:34 nrpe.cfg<br>-rw-r--r-- 1 root root 484 Apr 9 17:50 synport<br>-rw-r--r-- 1 nagios nagios 162 Apr 10 13:59 synport12<br>-rwxr-xr-x 1 root root 41991 Jul 28 2008 urlize<br>
-rwxr-xr-x 1 root root 2070 Jul 28 2008 <a href="http://utils.pm" target="_blank">utils.pm</a><br>-rwxr-xr-x 1 root root 862 Jul 28 2008 utils.sh<br><br><br>On nagios server<br>*******************<br>
<br>
[nagios@lnx-nagios xinetd.d]$ pwd<br>/etc/xinetd.d<br><br><br>[nagios@lnx-nagios xinetd.d]$ cat nrpe<br># default: on<br> # description: NRPE<br> service nrpe<br> {<br> flags = REUSE<br> socket_type = stream<br>
wait = no<br> user = nagios<br> groups = yes<br> server = /usr/local/nagios/libexec/nrpe<br> server_args = -c /usr/local/nagios/libexec/nrpe.cfg --inetd<br> log_on_failure += USERID<br>
disable = no<br> # Change this to your primary Nagios server<br> only_from = 10.10.13.34<br> }<br><br><br>Thanks for your patience<br><br>-Shankar<div><div></div><div class="h5"><br><br><br><br><br>
<div class="gmail_quote">On Fri, Apr 10, 2009 at 1:28 PM, Giorgio Zarrelli <span dir="ltr"><<a href="mailto:giorgio@zarrelli.org" target="_blank">giorgio@zarrelli.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi,<br>
<br>
It won't work this way. If you define<br>
<br>
nagios ALL=/bin/netstat<br>
<br>
The script will hang, waiting for you to input a password for the user. Modify<br>
it to this string:<br>
<br>
nagios ALL=NOPASSWD:/bin/netstat<br>
<br>
Please, send me a copy of your script an ls -lah of your plugin libexec<br>
directory content and a<br>
<br>
cat /etc/xinetd.d/nrpe<br>
<div><br>
Giorgio<br>
<br>
<br>
<a href="mailto:asam30@gmail.com" target="_blank">asam30@gmail.com</a> scritto:<br>
><br>
</div><div><div></div><div>> Hi Giorgio,<br>
><br>
> I tried all the ways to fix the problem but still no luck. Do not know how<br>
> to run the custom scripts, i will explain in detail here, please someone<br>
> guide me here,<br>
><br>
> Nagios server:<br>
><br>
> Running the below command, this command will go to nagios client<br>
> (172.16.17.18) and execute check_netstat script. The netstat script will<br>
> check for port 80 listen status also if there are any TIME_WAIT connections<br>
> happens, then it should alert us (WARNING - STATUS= TIME_WAIT port status on<br>
> airlin | WARNING - STATUS=TIME_WAIT port status on airlin). For testing I<br>
> made some connections happend to be listen on port 80 and as TIME_WAIT<br>
> status. But it still reports as (OK, which means this is reporting<br>
> incorrectly)<br>
><br>
> [nagios@lnx-nagios ~]$ /usr/local/nagios/libexec/check_nrpe -H 172.16.17.18<br>
> -c check_netstat<br>
> OK - The port is up and running NO established connections on airlin<br>
><br>
><br>
> on Nagios client:,<br>
><br>
> I executed below command here, and this reports exactly correct as there are<br>
> some TIME_WAIT listening on port 80<br>
><br>
> [nagios@airlin nagios]$ netstat -an | grep 80<br>
> tcp 0 0 <a href="http://0.0.0.0:80" target="_blank">0.0.0.0:80</a> 0.0.0.0:* LISTEN<br>
> tcp 0 0 <a href="http://172.16.17.18:80" target="_blank">172.16.17.18:80</a> <a href="http://10.10.19.85:2293" target="_blank">10.10.19.85:2293</a><br>
> TIME_WAIT<br>
><br>
> [nagios@airlin nagios]$ /usr/local/nagios/libexec/check_netstat<br>
> WARNING - STATUS= TIME_WAIT port status on airlin | WARNING -<br>
> STATUS=TIME_WAIT port status on airlin.<br>
><br>
> The same warning message should appear when I execute first command on<br>
> nagios server but it reports incorrectly as (OK, no port status)....<br>
><br>
> I am running above commands as nagios user because this as preivileges to<br>
> run nrpe.<br>
><br>
> the check_nrpe , nrpe , check_netstat owned by nagios:nagios on both the<br>
> servers.<br>
><br>
> in /etc/sudoers file I wrote below line on both the servers<br>
><br>
> nagios ALL=/bin/netstat<br>
><br>
> and<br>
><br>
> [root@airlin libexec]# sudo -u nagios sudo -l<br>
> Password:<br>
> User nagios may run the following commands on this host:<br>
> (root) /bin/netstat<br>
><br>
> in the check_netstat script I wrote the netstat command as,<br>
><br>
> netstat -an | grep 80 > synport12<br>
><br>
> should I add sudo here???<br>
><br>
> Please help your valuable suggestions......<br>
> thanks<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> On Thu, Apr 9, 2009 at 8:52 PM, Giorgio Zarrelli <<a href="mailto:giorgio@zarrelli.org" target="_blank">giorgio@zarrelli.org</a>>wrote:<br>
><br>
> > Hi<br>
> ><br>
> > As I told before, that netstat command won't work "out of the box", with an<br>
> > unprivileged user.<br>
> ><br>
> > Giorgio<br>
> ><br>
> > Marc Powell (<a href="mailto:marc@ena.com" target="_blank">marc@ena.com</a>) scritto:<br>
> > ><br>
> > ><br>
> > > On Apr 9, 2009, at 8:26 AM, <a href="mailto:asam30@gmail.com" target="_blank">asam30@gmail.com</a> wrote:<br>
> > ><br>
> > > > Hi,<br>
> > > ><br>
> > > > I did copy the scipt to the remote host as check_netstat and used<br>
> > > > check_nrpe method to excute from nagios server. It looks when<br>
> > > > executing the command on remote server works well,<br>
> > > ><br>
> > > > [root@airlin libexec]# /usr/local/nagios/libexec/check_netstat<br>
> > > > WARNING - STATUS= TIME_WAIT port status on airlin | WARNING -<br>
> > > > STATUS=TIME_WAIT port status on airlin<br>
> > ><br>
> > > You're testing as root here. Test as the user nrpe runs as. It could<br>
> > > very well be a difference in privileges...<br>
> > ><br>
> > > --<br>
> > > Marc<br>
> > ><br>
> > ><br>
> > ><br>
> > ------------------------------------------------------------------------------<br>
> > > This SF.net email is sponsored by:<br>
> > > High Quality Requirements in a Collaborative Environment.<br>
> > > Download a free trial of Rational Requirements Composer Now!<br>
> > > <a href="http://p.sf.net/sfu/www-ibm-com" target="_blank">http://p.sf.net/sfu/www-ibm-com</a><br>
> > > _______________________________________________<br>
> > > Nagios-users mailing list<br>
> > > <a href="mailto:Nagios-users@lists.sourceforge.net" target="_blank">Nagios-users@lists.sourceforge.net</a><br>
> > > <a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
> > > ::: Please include Nagios version, plugin version (-v) and OS when<br>
> > reporting any issue.<br>
> > > ::: Messages without supporting info will risk being sent to /dev/null<br>
> > ><br>
> ><br>
> ><br>
> ><br>
> > ------------------------------------------------------------------------------<br>
> > This SF.net email is sponsored by:<br>
> > High Quality Requirements in a Collaborative Environment.<br>
> > Download a free trial of Rational Requirements Composer Now!<br>
> > <a href="http://p.sf.net/sfu/www-ibm-com" target="_blank">http://p.sf.net/sfu/www-ibm-com</a><br>
> > _______________________________________________<br>
> > Nagios-users mailing list<br>
> > <a href="mailto:Nagios-users@lists.sourceforge.net" target="_blank">Nagios-users@lists.sourceforge.net</a><br>
> > <a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
> > ::: Please include Nagios version, plugin version (-v) and OS when<br>
> > reporting any issue.<br>
> > ::: Messages without supporting info will risk being sent to /dev/null<br>
> ><br>
><br>
><br>
><br>
> --<br>
> Shankar Asam<br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><br></div></div><font color="#888888">-- <br>Shankar Asam<br>
</font></div><br><br clear="all"><br>-- <br>Shankar Asam<br>