Xymon Mailing List Archive search

cont regex

4 messages in this thread

list M. Hansen · Wed, 18 Nov 2009 22:48:05 +0100 ·
First off, thanks for coding this amazing piece of software, Henrik.

I'm trying to do a http content check of my Netgear print server's web
interface. The print server has two ports, and I'd like to have two
separate columns that show the status of the two printer ports. I've
tried to come up with some regular expressions, but they haven't
worked so far.

Here's a snippet of the HTML:
--------- HTML START ----------
<table width="530" height="230" border="0" cellpadding="0"
cellspacing=0 bgcolor="#ffbe39">
<div class="maintab">
<tr>

 <td>&nbsp;</TD>
 <th nowrap align="left">Parallel Port 1<p></th>
 <th nowrap align="left">Parallel Port 2<p></th>
</tr>

 <tr><td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;Port Name</td>
 <td nowrap>P1</td>
 <td nowrap>P2</td>

 </tr>
 <tr><td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;Status</td>
 <td nowrap>On-Line</td>
 <td nowrap>Offline</td>

 </tr>
 <tr><td nowrap>&nbsp;&nbsp;&nbsp;&nbsp;Print State</td>

 <td nowrap>Idle</td>
 <td nowrap>Idle</td>
--------- HTML END ----------

I'd like the column color to change if the status of the corresponding
printer port does not match the string "On-Line".
In this case, I'd prefer if the columns went clear instead of red.
I've tried prefixing "cont" with a question mark, but this doesn't
work. I'm running 4.2.0. Why is that?

I'm hoping you can help me create a regex that will do what I've described.
list Andreas Kunberger · Thu, 19 Nov 2009 08:44:38 +0100 ·
quoted from M. Hansen
M. Hansen schrieb:
First off, thanks for coding this amazing piece of software, Henrik.

I'm trying to do a http content check of my Netgear print server's web
interface. The print server has two ports, and I'd like to have two
separate columns that show the status of the two printer ports. I've
tried to come up with some regular expressions, but they haven't
worked so far.
I'd write a small extension script,
which first runs your web page through 'w3m -dump'
and then scans in in the resulting text file for your printer lines
to send am message to the xymon server

mfg

Andreas Kunberger

-- 
DITF
list M. Hansen · Thu, 19 Nov 2009 15:54:32 +0100 ·
On Thu, Nov 19, 2009 at 8:44 AM, Andreas Kunberger
quoted from Andreas Kunberger
<user-6b0b54288086@xymon.invalid> wrote:
I'd write a small extension script,
which first runs your web page through 'w3m -dump'
and then scans in in the resulting text file for your printer lines
to send am message to the xymon server
Good idea, but I assume I would have to run the extension script on a
box running hobbitclient? The print server is a small embedded device
(Netgear PS110), so there's no way I would be able run the extension
script locally on the print server. Is it possible to run the script
on another box and have the results show up as if they came from the
print server?

Are you sure it's not possible to just make two different cont tests?
My knowledge of regular expressions is quite limited, but I assumed it
would be trivial to match those strings.

Also, does the cont check parse the raw HTML data or just the text
stripped of HTML? I mean, do I have to write a regex like...

On-Line</td>\n\n</tr> (needs escape characters, I know)

...or...

On-Line\s*$

...in order to match the status of the second port?

Thanks!
list Bruce White · Thu, 19 Nov 2009 09:07:18 -0600 ·
 I have dozens of scripts which run on my hobbit server (using its MIPs,
memory, etc.) which report on things all over the network and report
them as coming from the hosts being monitored.   Just make sure the
$MACHINE in the "bb" status command is the monitored host, not the
machine running the script.

    .....Bruce


 Bruce White
 Senior Enterprise Systems Engineer | Phone: XXX-XXX-XXXX | Fax: XXX-XXX-XXXX | user-58f975e8bf9d@xymon.invalid | http://www.fellowes.com/
 
 
Disclaimer: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you. Fellowes, Inc.
quoted from M. Hansen
 
-----Original Message-----
From: M. Hansen [mailto:user-c25e20711647@xymon.invalid] 
Sent: Thursday, November 19, 2009 8:55 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] cont regex

On Thu, Nov 19, 2009 at 8:44 AM, Andreas Kunberger
<user-6b0b54288086@xymon.invalid> wrote:
I'd write a small extension script,
which first runs your web page through 'w3m -dump'
and then scans in in the resulting text file for your printer lines to
send am message to the xymon server
Good idea, but I assume I would have to run the extension script on a
box running hobbitclient? The print server is a small embedded device
(Netgear PS110), so there's no way I would be able run the extension
script locally on the print server. Is it possible to run the script on
another box and have the results show up as if they came from the print
server?

Are you sure it's not possible to just make two different cont tests?
My knowledge of regular expressions is quite limited, but I assumed it
would be trivial to match those strings.

Also, does the cont check parse the raw HTML data or just the text
stripped of HTML? I mean, do I have to write a regex like...

On-Line</td>\n\n</tr> (needs escape characters, I know)

...or...

On-Line\s*$

...in order to match the status of the second port?

Thanks!