[hobbit] bb-services: regexes in expect string?
Johan Karlsson
johan.karlsson at deltamanagement.se
Tue Sep 21 10:11:26 CEST 2010
I never saw a reply to this, so I'll bump it since I have exactly the same need ;)
Regards,
Johan
-----Original Message-----
From: Kolbjørn Barmen [mailto:kolbjorn.barmen at uninett.no]
Sent: den 24 mars 2010 08:53
To: hobbit at hswn.dk
Subject: Re: [hobbit] bb-services: regexes in expect string?
On Wed, 2 Jul 2008, Aaron Zink wrote:
> Is it possible to use regexes in the expect string?
I'm wondering about the same, and haven't seen any answer to this.
I'm trying to match some xml, and first line is:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
The problem is the quotes, as bbtest-net terminates the string on the first quote, no matter what, it seems.
I have tried escaping like this:
expect "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>"
but "bbtest-net --services" shows "Exp.text: <?xml version=", adding more \ doesnt help, the extra \ will then just be part of Exp.text.
I notice that --services show:
Exp.text: <?xml version=
Exp.len : 14
Exp.ofs : 0
All my services show "Exp.ofs : 0", I suppose "ofs" means offset?
Is there a way to set this to something else than 0?
The services I try to monitor also seems to puke out some ctrl-chars at the start (and it it uses ssl), a connection with openssl s_client looks like this:
[snip SSL stuff]
Verify return code: 19 (self signed certificate in certificate chain)
---
^@^@^D<FE><?xml version="1.0" encoding="UTF-8" standalone="no"?> [snip rest of xml]
Should my "expect" also include "\x00\x00\x04\xFE" before "<?xml version"?
Again, if I could use regexp, I would probably just go for ".*<?xml ..", and if offset can be used, I'd jump over the control chars.
Any tip?
--
Kolbjørn Barmen
UNINETT Driftsenter
To unsubscribe from the hobbit list, send an e-mail to hobbit-unsubscribe at hswn.dk
More information about the Xymon
mailing list