[ZBXNEXT-989] Parse monitoring values from webpages Created: 2011 Oct 06  Updated: 2015 Sep 15  Resolved: 2013 May 07

Status: Closed
Project: ZABBIX FEATURE REQUESTS
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Request Priority: Major
Reporter: Marc Schoechlin Assignee: Unassigned
Resolution: Duplicate Votes: 7
Labels: flexibility, webmonitoring
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBXNEXT-1653 Add an agent item to extract matching... Closed

 Description   

Web applications often provide monitoring information via HTTP.

For example, if you call https://user:[email protected]/admin/monitoring.jsp you get key/value pairs like this:


app.sessions.active = 12
app.cached.elements = 2000
app.status.productload = OK (5124 products)
app.status.pricetable = FAIL

Currently you have to write a script which is called by a item to parse the resulting page and add the value to zabbix.

It would be very helpful to have a zabbix-internal item-parameter which does this job - for example:

Definition:
web.page.parse.regexp[<hostname>,<path>,<port>,<protocol>,<regex>,<length>]

host - hostname (if empty, use default)
path - path to HTML document (default is /)
port - port number (default is 80)
protocol - http or https
regexp - GNU regular expression
length - maximum number of characters to return

Return value:
The matched string, if a regex group is specified the the content of the first group will be returned.

Examples:
web.page.parse.regexp[www.foo.bar,/monitor.jsp,80,http,app.status.productload = (..*) : \d+ products,4]
=> line: app.status.productload = OK (5124 products)
=> zabbix value: OK
web.page.parse.regexp[www.foo.bar,/monitor.jsp,80,http,app.status.pricetable = (..*),12]
=> line: app.status.pricetable = FAIL
=> zabbix value: FAIL

I think that
web.page.regexp[host,<path>,<port>,<regexp>,<length>]
is pretty close to this...

Regards
Marc



 Comments   
Comment by Marc Schoechlin [ 2011 Nov 23 ]

Enhancement:
Do not use the first group - define the parsed value as a argument.

web.page.parse.regexp_replace[<hostname>,<path>,<port>,<protocol>,<regex>,<length>]

host - hostname (if empty, use default)
path - path to HTML document (default is /)
port - port number (default is 80)
protocol - http or https
regexp - GNU regular expression
use_value - specify value to use
length - maximum number of characters to return

Example:

web.page.parse.regexp_replace[www.foo.bar,/monitor.jsp,80,http,"app.status.productload = (OK|INFO) : (\d+) products loaded in (\d+) seconds",$1 - $2 products in $3 sec,4]
=> line: app.status.productload = OK : 5124 products in 123 seconds
=> zabbix item value: OK - 5124 products in 123 sec

Comment by Marc Schoechlin [ 2013 Feb 17 ]

We use the following tool to extend zabbix as a workaround for the missing functionality:
https://github.com/digitalmediacenter/http_extend/blob/master/README.md

Comment by Andris Zeila [ 2013 May 07 ]

This is solved in ZBXNEXT-1653 by adding optional output parameter to web.page.regexp[] item (see the specifications https://www.zabbix.org/wiki/Docs/specs/ZBXNEXT-1653).

Comment by Marc Schoechlin [ 2013 May 08 ]

Thats great,
is it also possible to set the hostheader?

Compareable to this shell command,
somehost.de should be the ip or dns name specified in the host and
foo.bar.de should be the dns name or teh specified virtualhost.

curl -H "Host: foo.bar.de" http://somehost.de/fooooooooooooooooooooooooooooooooooooooooooo"

This enables zabbix also to fetch values from hosts behind a loadbalancer.

Comment by richlv [ 2013 May 08 ]

that's a different, unrelated feature request (and there's a zbxnext for it, too...)

Comment by Marc Schoechlin [ 2015 Sep 15 ]

http_extend moved to a new main repo: https://github.com/breuninger-ecom/http_extend

Generated at Fri Apr 26 08:11:02 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.