Subject: expect & pluck troubles

From: Jim Roberts <[email-masked]>
Date: Wed, 12 Jan 2005 19:42:43 -0800

I find that when my configuration includes a pluck, but no expect, my 
test fails "TEST did not match expected regex".

If I "expect:    .*" everything works as I thought it might. If I leave 
the expect: line out, my service always show down.

Here: http://argus.tcp4me.com/xtservices.html there is an example where 
there is no expect:, so I didn't think it necessary.

I threw in some extra debugging into "Service.pm" and found that 
$my->{test}{expect} had some junk in it, starting with "HTTP"

Perhaps there's some place where the value of $my->{test}{expect} 
should be cleared, and isn't?

I have attached my config file, with the domains changed.

It is the longest config that I am having trouble with, ns4, TCP/URL

Actual output from the php script is: "temperature: 33 degrees C"

Here is my config:

----------------

# locations of various items on web pages
sirensong:      /~argus/sound/whoopwhoop.wav
bkgimage:       /~argus/img/argus.logo.gif
icon:            /~argus/img/smile.gif
icon_down:      /~argus/img/sad.gif
nospkr_icon:    /~argus/img/nospkr.gif
style_sheet:   /~argus/argus.css

# send messages to syslog
syslog:         daemon

# who should be notified when things break?
notify:         mail:[email-masked]

frequency:       600
timeout:          30
renotify:       3600

Group "Example" {
         Host "ns1" {
                 hostname: ns1.example.com
                 Service UDP/DNS
                 Service TCP/HTTP
                 Service TCP/POP
                 Service TCP/SMTP
         }
         Host "ns2" {
                 hostname: ns2.example.com
                 Service UDP/DNS
                 Service TCP/HTTP
         }
         Host "ns3" {
                 hostname: ns3.example.com
                 Service TCP/FTP {
                         hostname:       ftp.example.com
                 }
                 Service TCP/HTTP
         }
         Host "ns4" {
                 hostname: ns4.example.com
                 Service TCP/FTP
                 Service TCP/HTTP
                 Service TCP/HTTPS
                 Service TCP/URL {
                         graph:          yes
                         label:          CPUTemp
                         uname:          NS4 Processor Temperature
                         messagedn:      NS4 CPU is over temperature
                         url:            
http://www.example.com/cputemp.php
                         pluck:          temperature: (\S*)
                         expect:         .*
                         maxvalue:       45
#                        debug:          yes
                 }
         }
         Host "ns7" {
                 hostname: ns7.example.com
                 Service UDP/DNS
                 Service TCP/SMTP
                 Service TCP/HTTP
         }
}

---

From: Jeff Weisberg <[email-masked]>
Date: Thu, 13 Jan 2005 15:13:08 -0500 (EST)

| I find that when my configuration includes a pluck, but no expect, my 
| test fails "TEST did not match expected regex".
| 
| If I "expect:    .*" everything works as I thought it might. If I leave 
| the expect: line out, my service always show down.
| 
| Here: http://argus.tcp4me.com/xtservices.html there is an example where 
| there is no expect:, so I didn't think it necessary.
| 
| I threw in some extra debugging into "Service.pm" and found that 
| $my->{test}{expect} had some junk in it, starting with "HTTP"

you may find it easier to just click on the 'debugging' link
on the web page.

| Perhaps there's some place where the value of $my->{test}{expect} 
| should be cleared, and isn't?

no, this is the correct behavior.

if you use a plain 'TCP' test, everything starts empty.
you add from there.

if you use any of the 'TCP/*' tests, all of the fields
are filled in as appropriate for that protocol.

the TCP/URL test sets various things (including expect)
as appropriate for testing a url with http.

if you are trying to use TCP/URL to test something
that doesn't follow the http protocol, you will need
to either use TCP and build up, or TCP/URL and change
things to match your new and improved protocol.

	--jeff

---

From: Jim Roberts <[email-masked]>
Date: Thu, 13 Jan 2005 19:09:11 -0800

>you may find it easier to just click on the 'debugging' link

I did find that easier, after I grok'ed that I had to give myself
"root" access in the user file....

         --jeff

Okay, I get it.

You've done a really nice job with Argus; thanks!

/s/

JR