[Nagiosplug-help] Questions using negate?
Subhendu Ghosh
sghosh at sghosh.org
Fri Mar 21 08:29:07 CET 2003
I blush - but Karl/Ton did the actual patch to get negate working...
-sg
On Fri, 21 Mar 2003, Rick . wrote:
> Thank you very much, and thanks to Subhendu for your ongoing assistance.
> This has saved me having to buy a product and run it along side nagios for
> the purpose of checking for multiple words in a string.
>
> I look forward to a long association with this product.
>
> Thanks again,
>
> Rick.
>
> >From: "Voon, Ton" <Ton.Voon at egg.com>
> >To: 'Subhendu Ghosh' <sghosh at sghosh.org>,
> >Nagiosplug-help at lists.sourceforge.net
> >Subject: RE: [Nagiosplug-help] Questions using negate?
> >Date: Tue, 18 Mar 2003 13:52:47 -0000
> >MIME-Version: 1.0
> >Received: from sc8-sf-list2.sourceforge.net ([66.35.250.206]) by
> >mc8-f22.law1.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Tue, 18 Mar
> >2003 05:54:14 -0800
> >Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13]
> >helo=sc8-sf-list1.sourceforge.net)by sc8-sf-list2.sourceforge.net with
> >esmtp (Exim 3.31-VA-mm2 #1 (Debian))id 18vHX1-0005qi-00; Tue, 18 Mar 2003
> >05:53:31 -0800
> >Received: from mail3.egg.com ([212.158.94.142])by
> >sc8-sf-list1.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian))id
> >18vHWU-0001L3-00for <Nagiosplug-help at lists.sourceforge.net>; Tue, 18 Mar
> >2003 05:52:58 -0800
> >Received: from mail3.egg.com (unverified) by mail3.egg.com (Content
> >Technologies SMTPRS 4.2.10) with ESMTP id
> ><T610dd018fdd49e5e8e09a at mail3.egg.com>; Tue, 18 Mar 2003 13:52:49 +0000
> >Received: by mail3.egg.com with Internet Mail Service (5.5.2653.19)id
> ><HF42547Z>; Tue, 18 Mar 2003 13:52:49 -0000
> >X-Message-Info: vAu4ZEtdRigLaEiTQQBlDPU44G8LMD9u
> >Message-ID: <53104E20A25CD411B556009027E50636064D547B at pnnemp02.pn.egg.com>
> >X-Mailer: Internet Mail Service (5.5.2653.19)
> >Sender: nagiosplug-help-admin at lists.sourceforge.net
> >Errors-To: nagiosplug-help-admin at lists.sourceforge.net
> >X-BeenThere: nagiosplug-help at lists.sourceforge.net
> >X-Mailman-Version: 2.0.9-sf.net
> >Precedence: bulk
> >List-Help:
> ><mailto:nagiosplug-help-request at lists.sourceforge.net?subject=help>
> >List-Post: <mailto:nagiosplug-help at lists.sourceforge.net>
> >List-Subscribe:
> ><https://lists.sourceforge.net/lists/listinfo/nagiosplug-help>,<mailto:nagiosplug-help-request at lists.sourceforge.net?subject=subscribe>
> >List-Id: Nagios Plugin Help List <nagiosplug-help.lists.sourceforge.net>
> >List-Unsubscribe:
> ><https://lists.sourceforge.net/lists/listinfo/nagiosplug-help>,<mailto:nagiosplug-help-request at lists.sourceforge.net?subject=unsubscribe>
> >List-Archive:
> ><http://sourceforge.net/mailarchive/forum.php?forum=nagiosplug-help>
> >X-Original-Date: Tue, 18 Mar 2003 13:52:47 -0000
> >Return-Path: nagiosplug-help-admin at lists.sourceforge.net
> >X-OriginalArrivalTime: 18 Mar 2003 13:54:14.0310 (UTC)
> >FILETIME=[DC41D460:01C2ED55]
> >
> >Managed to have a play at cfpopen and here are the results:
> >
> >A) RIGHT
> >$ ./negate /usr/bin/grep Network /etc/services
> ># Network services, Internet style
> >nntp 119/tcp usenet # Network News Transfer
> >ntp 123/tcp # Network Time Protocol
> >ntp 123/udp # Network Time Protocol
> >
> >B) WRONG (the " are lost)
> >$ ./negate /usr/bin/grep "Network Time" /etc/services
> >grep: can't open Time
> >/etc/services:# Network services, Internet style
> >/etc/services:nntp 119/tcp usenet # Network
> >News Transfer
> >/etc/services:ntp 123/tcp # Network
> >Time Protocol
> >/etc/services:ntp 123/udp # Network
> >Time Protocol
> >
> >C) WRONG (same as above)
> >$ ./negate /usr/bin/grep 'Network Time' /etc/services
> >grep: can't open Time
> >/etc/services:# Network services, Internet style
> >/etc/services:nntp 119/tcp usenet # Network
> >News Transfer
> >/etc/services:ntp 123/tcp # Network
> >Time Protocol
> >/etc/services:ntp 123/udp # Network
> >Time Protocol
> >
> >D) RIGHT
> >$ ./negate '/usr/bin/grep "Network Time" /etc/services'
> >ntp 123/tcp # Network Time Protocol
> >ntp 123/udp # Network Time Protocol
> >
> >E) RIGHT
> >$ ./negate "/usr/bin/grep 'Network Time' /etc/services"
> >ntp 123/tcp # Network Time Protocol
> >ntp 123/udp # Network Time Protocol
> >
> >The only benefit is case D. Is it worth a switch over? Maybe the only
> >change
> >is to provide better instructions on using case E and a better error
> >message
> >if double quotes exist.
> >
> >Any comments?
> >
> >Ton
> >
> > > -----Original Message-----
> > > From: Voon, Ton [SMTP:Ton.Voon at egg.com]
> > > Sent: Tuesday, March 18, 2003 12:31 PM
> > > To: 'Subhendu Ghosh'; Nagiosplug-help at lists.sourceforge.net
> > > Subject: RE: [Nagiosplug-help] Questions using negate?
> > >
> > > I think there is a problem in spopen which affects negate and other
> > > plugins
> > > where external command calls with double quotes do not work correctly.
> > >
> > > RIGHT (no spaces in command)
> > > $ negate /usr/bin/grep Network /etc/services
> > > # Network services, Internet style
> > > nntp 119/tcp usenet # Network News Transfer
> > > ntp 123/tcp # Network Time Protocol
> > >
> > > WRONG (spaces lost when passed to spopen - I think it is running a grep
> > > against a file called Time, then /etc/services)
> > > $ negate /usr/bin/grep "Network Time" /etc/services
> > > /etc/services:# Network services, Internet style
> > > /etc/services:nntp 119/tcp usenet #
> >Network
> > > News Transfer
> > > /etc/services:ntp 123/tcp #
> >Network
> > > Time Protocol
> > >
> > > WRONG (same as above)
> > > $ negate /usr/bin/grep 'Network Time' /etc/services
> > > /etc/services:# Network services, Internet style
> > > /etc/services:nntp 119/tcp usenet #
> >Network
> > > News Transfer
> > > /etc/services:ntp 123/tcp #
> >Network
> > > Time Protocol
> > >
> > > WRONG (spopen returns NULL if " found in the command line)
> > > $ negate '/usr/bin/grep "Network Time" /etc/services'
> > > Could not open pipe: /usr/bin/grep "Network Time" /etc/services
> > >
> > > RIGHT (spopen doesn't mind ' and the shell has kept the spaces in
> >between)
> > > $ negate "/usr/bin/grep 'Network Time' /etc/services"
> > > ntp 123/tcp # Network Time Protocol
> > >
> > > I'll look into using cfpopen (http://www.cfengine.org) to see if that
> >will
> > > help, but it will take me ages!
> > >
> > > Ton
> > >
> > > > -----Original Message-----
> > > > From: Subhendu Ghosh [SMTP:sghosh at sghosh.org]
> > > > Sent: Tuesday, March 18, 2003 3:11 AM
> > > > To: Nagiosplug-help at lists.sourceforge.net
> > > > Subject: RE: [Nagiosplug-help] Questions using negate?
> > > >
> > > > I thinks you need backslash to escape not forward slash...
> > > >
> > > > -s \"word1 word2\"
> > > >
> > > > -sg
> > > >
> > > > On Tue, 18 Mar 2003, Rick . wrote:
> > > >
> > > > > Thanks Subhendu,
> > > > >
> > > > > The plugin works a lot better. My only problem now is that i need to
> > > use
> > > > the
> > > > > -s command to check for a string of text using check_http. The
> >string
> > > > needs
> > > > > to be two words.
> > > > > When i put the two words in the quotes "word1 word2" with check_http
> > > > only,
> > > > > the command works fine. But as soon as i negate the check_http
> > > command,
> > > > it
> > > > > doesn't work with more than one word in the string.
> > > > > I have tried -s /"word1 word2/" etc but unfortunately it isn't
> > > working.
> > > > >
> > > > > Is there any way to do this?
> > > > >
> > > > > Thanks alot!
> > > > >
> > > > > Rick :)
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > >From: Subhendu Ghosh <sghosh at sghosh.org>
> > > > > >To: Nagiosplug-help at lists.sourceforge.net
> > > > > >Subject: RE: [Nagiosplug-help] Questions using negate?
> > > > > >Date: Fri, 14 Mar 2003 19:10:05 -0500 (EST)
> > > > > >
> > > > > >
> > > > > >There was a recent patch applied on negate - you might want to grab
> > > the
> > > > > >latest version of negate from CVS...
> > > > > >
> > > > > >-sg
> > > > > >
> > > > > >On Thu, 6 Mar 2003, Rick . wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > I downloaded and tested this plugin, and i am having the same
> > > > problem.
> > > > > > >
> > > > > > > The plugin is always giving an OK, whether the negated plugin is
> > > OK
> > > > or
> > > > > > > CRITICAL.
> > > > > > >
> > > > > > > Does anybody know how to fix this?
> > > > > > >
> > > > > > > Thanks,
> > > > > > >
> > > > > > > Rick.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > >From: Rose David <DRose at snyderdrug.com>
> > > > > > > >To: Nagiosplug-help at lists.sourceforge.net
> > > > > > > >Subject: RE: [Nagiosplug-help] Questions using negate?
> > > > > > > >Date: Wed, 5 Mar 2003 11:38:13 -0600
> > > > > > > >
> > > > > > > >Thank you for your response and input. I have now used your
> > > script
> > > > and
> > > > > >it
> > > > > > > >has gotten me farther along than I have been able to this
> >point.
> > > > Here
> > > > > >is
> > > > > > > >the catch. When I run this on the command line, it works just
> >as
> > > > > > > >advertised, switching the return codes from 2 to 0 or from 0 to
> > > 2.
> > > > > > > >However,
> > > > > > > >when I run it in nagios as a command, either a Critical or an
> >OK
> > > > state
> > > > > >on
> > > > > > > >the check_ping shows up as OK. Using the same command, I get
> >the
> > >
> > > > > >following
> > > > > > > >two results:
> > > > > > > >
> > > > > > > >Status Status Information
> > > > > > > >OK CRITICAL - Plugin timed out after 10 seconds
> > > > > > > >OK PING OK - Packet loss = 20%, RTA = 245.95 ms
> > > > > > > >
> > > > > > > >Any further input as to what I might do to get this to work?
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > > We re-wrote negate as a simple perl script. I have tried
> >your
> > > > > > > > > check_ping input with my version of negate and here is what
> >I
> > > > get:
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > root at lxxxx:[/home/nagios/etc]:
> >/home/nagios/libexec/new-negate
> > > > > > > > > /home/nagios/libexec/check_ping -H auspap01 -w 1000.0,100%
> >-c
> > > > > > > > > 1000.0,100% -p 5
> > > > > > > > > Command is: /home/nagios/libexec/check_ping -H host01 -w
> > > > > > > > > 1000.0,100% -c
> > > > > > > > > 1000.0,100% -p 5PING OK - Packet loss = 0%, RTA = 4.62 ms
> > > > > > > > > Return code is 0
> > > > > > > > > root at lapin:[/home/nagios/etc]: echo $?
> > > > > > > > > 2
> > > > > > > > >
> > > > > > > > > The first return code is the actual return from the
> >check_ping
> > >
> > > > > >plugin,
> > > > > > > > > the second $? output is the negated output. Since
> >check_ping
> > > > > >produces
> > > > > > > > > multiple return codes depending on the result, it is
> > > > > > > > > difficult to use a
> > > > > > > > > generic negate plugin. I have included our version of the
> > > > plugin
> > > > > > > > > "new-negate. Hope this helps..
> > > > > > > > >
> > > > > > > > > Good luck
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > John Cockerham
> > > > > > > > > Sr. Network Administrator
> > > > > > >
> > > > > > >
> > > > > > >
> >_________________________________________________________________
> > > > > > > Hotmail now available on Australian mobile phones. Go to
> > > > > > > http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > -------------------------------------------------------
> > > > > > > This SF.net email is sponsored by:Crypto Challenge is now open!
> > > > > > > Get cracking and register here for some mind boggling fun and
> > > > > > > the chance of winning an Apple iPod:
> > > > > > > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> > > > > > > _______________________________________________
> > > > > > > Nagiosplug-help mailing list
> > > > > > > Nagiosplug-help at lists.sourceforge.net
> > > > > > > https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> > > > > > > ::: Please include plugins 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:Crypto Challenge is now open!
> > > > > >Get cracking and register here for some mind boggling fun and
> > > > > >the chance of winning an Apple iPod:
> > > > > >http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> > > > > >_______________________________________________
> > > > > >Nagiosplug-help mailing list
> > > > > >Nagiosplug-help at lists.sourceforge.net
> > > > > >https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> > > > > >::: Please include plugins version (-v) and OS when reporting any
> > > > issue.
> > > > > >::: Messages without supporting info will risk being sent to
> > > /dev/null
> > > > >
> > > > >
> > > > > _________________________________________________________________
> > > > > Hotmail now available on Australian mobile phones. Go to
> > > > > http://ninemsn.com.au/mobilecentral/hotmail_mobile.asp
> > > > >
> > > >
> > > > --
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > -------------------------------------------------------
> > > > This SF.net email is sponsored by:Crypto Challenge is now open!
> > > > Get cracking and register here for some mind boggling fun and
> > > > the chance of winning an Apple iPod:
> > > > http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
> > > > _______________________________________________
> > > > Nagiosplug-help mailing list
> > > > Nagiosplug-help at lists.sourceforge.net
> > > > https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> > > > ::: Please include plugins version (-v) and OS when reporting any
> >issue.
> > >
> > > > ::: Messages without supporting info will risk being sent to /dev/null
> > >
> > >
> > > This private and confidential e-mail has been sent to you by Egg.
> > > The Egg group of companies includes Egg Banking plc
> > > (registered no. 2999842), Egg Financial Products Ltd (registered
> > > no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
> > > carries out investment business on behalf of Egg and is regulated
> > > by the Financial Services Authority.
> > > Registered in England and Wales. Registered offices: 1 Waterhouse
> >Square,
> > > 138-142 Holborn, London EC1N 2NA.
> > > If you are not the intended recipient of this e-mail and have
> > > received it in error, please notify the sender by replying with
> > > 'received in error' as the subject and then delete it from your
> > > mailbox.
> > >
> > >
> > >
> > > -------------------------------------------------------
> > > This SF.net email is sponsored by: Does your code think in ink?
> > > You could win a Tablet PC. Get a free Tablet PC hat just for playing.
> > > What are you waiting for?
> > > http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
> > > _______________________________________________
> > > Nagiosplug-help mailing list
> > > Nagiosplug-help at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> > > ::: Please include plugins 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: Does your code think in ink?
> >You could win a Tablet PC. Get a free Tablet PC hat just for playing.
> >What are you waiting for?
> >http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
> >_______________________________________________
> >Nagiosplug-help mailing list
> >Nagiosplug-help at lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
> >::: Please include plugins version (-v) and OS when reporting any issue.
> >::: Messages without supporting info will risk being sent to /dev/null
>
>
> _________________________________________________________________
> MSN Instant Messenger now available on Australian mobile phones. Go to
> http://ninemsn.com.au/mobilecentral/hotmail_messenger.asp
>
--
More information about the Help
mailing list