Page 1 of 1
xml or webpage monitor
Posted: Tue Feb 08, 2022 7:31 pm
by michaewlewis
I'm trying to set up a monitor to check if a data point is incrementing and am not sure what would be the best option or how to achieve it. I can check a webpage, which gives me an ID or timestamp that I could check, or I could check the latest timestamp in an xml file. I only need to check it a few times a day.
I tried looking at setting up an xml monitor, but couldn't figure out how to even use it. The help icon after "Key" said something about working like PHP, but it's been a very long time since I've used php and I don't understand what it's telling me. Where do I get the variables from?
Maybe I could use the website monitor and do a regex to find the returned time but how do I compare it to the current time and alert if it's too old?
Re: xml or webpage monitor
Posted: Wed Feb 09, 2022 4:38 pm
by ssax
The XML output will determine what is required for the key, please send us the sanitized XML output from the web page so that we can see what is being returned and that will help us guide you further.
Thank you!
Re: xml or webpage monitor
Posted: Thu Feb 17, 2022 1:28 pm
by michaewlewis
Here's the xml and the html. Not sure which would be easier to work with.
Code: Select all
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>Panoptes Events</title>
<link>http://SERVER:8008/rss</link>
<description>Recent Panoptes event feed.</description>
<lastBuildDate>Wed, 09 Feb 2022 17:08:12 GMT</lastBuildDate>
<item>
<title>speed</title>
<link>http://SERVER:8008/events?guid=9bf4b989-89bf-11ec-9d93-000000000000</link>
<enclosure url="http://SERVER:8008/frames?event=9bf4b989-89bf-11ec-9d93-000000000000" length="0" type="image/jpeg" />
<pubDate>Wed, 09 Feb 2022 15:47:52 GMT</pubDate>
<category domain="http://SERVER:8008/cameras">TWG Bridge</category>
<guid>9bf4b989-89bf-11ec-9d93-000000000000</guid>
</item>
<item>
<title>speed</title>
<link>http://SERVER:8008/events?guid=89f5d166-89bf-11ec-9d93-000000000000</link>
<enclosure url="http://SERVER:8008/frames?event=89f5d166-89bf-11ec-9d93-000000000000" length="0" type="image/jpeg" />
<pubDate>Wed, 09 Feb 2022 15:47:11 GMT</pubDate>
<category domain="http://SERVER:8008/cameras">TWG Bridge</category>
<guid>89f5d166-89bf-11ec-9d93-000000000000</guid>
</item>
<item>
<title>speed</title>
<link>http://SERVER:8008/events?guid=89f5d165-89bf-11ec-9d93-000000000000</link>
<enclosure url="http://SERVER:8008/frames?event=89f5d165-89bf-11ec-9d93-000000000000" length="0" type="image/jpeg" />
<pubDate>Wed, 09 Feb 2022 15:47:11 GMT</pubDate>
<category domain="http://SERVER:8008/cameras">TWG Bridge</category>
<guid>89f5d165-89bf-11ec-9d93-000000000000</guid>
</item>
<item>
<title>Vehicle Counting - Entrance</title>
<link>http://SERVER:8008/events?guid=89f5d15b-89bf-11ec-9d93-000000000000</link>
<enclosure url="http://SERVER:8008/frames?event=89f5d15b-89bf-11ec-9d93-000000000000" length="0" type="image/jpeg" />
<pubDate>Wed, 09 Feb 2022 15:47:11 GMT</pubDate>
<category domain="http://SERVER:8008/cameras">TWG Bridge</category>
<guid>89f5d15b-89bf-11ec-9d93-000000000000</guid>
</item>
<item>
<title>Vehicle Counting - Entrance</title>
<link>http://SERVER:8008/events?guid=89f5d15a-89bf-11ec-9d93-000000000000</link>
<enclosure url="http://SERVER:8008/frames?event=89f5d15a-89bf-11ec-9d93-000000000000" length="0" type="image/jpeg" />
<pubDate>Wed, 09 Feb 2022 15:47:11 GMT</pubDate>
<category domain="http://SERVER:8008/cameras">TWG Bridge</category>
<guid>89f5d15a-89bf-11ec-9d93-000000000000</guid>
</item>
</channel>
</rss>
Code: Select all
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>Panoptes Web Server</title>
</head>
<body>
<p><b>Online Cameras</b></p>
<ul>
<li>
<a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a>
</li>
<li>
<a href="http://SERVER:8008/cameras?action=video&name=TWG%20Contractors">TWG Contractors</a>
</li>
<li>
<a href="http://SERVER:8008/cameras?action=video&name=TWG%20Entrance">TWG Entrance</a>
</li>
</ul>
<hr />
<p><a href="/searchevents">Search for events within a specific time frame</a></p>
<form method="post">Show Last <select name="list" onchange="this.form.submit()">
<option value="10"selected>10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
Unreviewed Events
</form>
<p><b>Last 10 of 8496 Unreviewed Events</b></p>
<table>
<tr>
<th>ID</th>
<th>Start Time</th>
<th>Event Name</th>
<th>Camera Name(s)</th>
<th>Confidence</th>
<th>Priority</th>
</tr>
<tr bgcolor=#E1E1E1>
<td align="center"><a href="/eventdetails?guid=9bf4b989-89bf-11ec-9d93-000000000000"><b>309128</b></a></td>
<td align="center">Wed Feb 09 07:47:48.907</td>
<td align="center">speed</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">91</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#FFFFFF>
<td align="center"><a href="/eventdetails?guid=89f5d166-89bf-11ec-9d93-000000000000"><b>309125</b></a></td>
<td align="center">Wed Feb 09 07:47:11.119</td>
<td align="center">speed</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">67</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#E1E1E1>
<td align="center"><a href="/eventdetails?guid=89f5d165-89bf-11ec-9d93-000000000000"><b>309124</b></a></td>
<td align="center">Wed Feb 09 07:47:11.119</td>
<td align="center">speed</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">96</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#FFFFFF>
<td align="center"><a href="/eventdetails?guid=89f5d15b-89bf-11ec-9d93-000000000000"><b>309123</b></a></td>
<td align="center">Wed Feb 09 07:47:10.613</td>
<td align="center">Vehicle Counting - Entrance</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">67</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#E1E1E1>
<td align="center"><a href="/eventdetails?guid=89f5d15a-89bf-11ec-9d93-000000000000"><b>309122</b></a></td>
<td align="center">Wed Feb 09 07:47:10.613</td>
<td align="center">Vehicle Counting - Entrance</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">96</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#FFFFFF>
<td align="center"><a href="/eventdetails?guid=66070689-89bf-11ec-9d93-000000000000"><b>309120</b></a></td>
<td align="center">Wed Feb 09 07:46:18.309</td>
<td align="center">Vehicle Counting - Entrance</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">100</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#E1E1E1>
<td align="center"><a href="/eventdetails?guid=66070688-89bf-11ec-9d93-000000000000"><b>309119</b></a></td>
<td align="center">Wed Feb 09 07:46:18.309</td>
<td align="center">Vehicle Counting - Entrance</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">96</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#FFFFFF>
<td align="center"><a href="/eventdetails?guid=240e5fe1-89bf-11ec-9d93-000000000000"><b>309117</b></a></td>
<td align="center">Wed Feb 09 07:44:20.915</td>
<td align="center">Vehicle Counting - Entrance</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">94</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#E1E1E1>
<td align="center"><a href="/eventdetails?guid=62420989-89bd-11ec-9d93-000000000000"><b>309116</b></a></td>
<td align="center">Wed Feb 09 07:31:51.005</td>
<td align="center">speed</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">97</td>
<td align="center">0</td>
</tr>
<tr bgcolor=#FFFFFF>
<td align="center"><a href="/eventdetails?guid=125552f3-89bc-11ec-9d93-000000000000"><b>309114</b></a></td>
<td align="center">Wed Feb 09 07:22:20.623</td>
<td align="center">Vehicle Counting - Entrance</td>
<td align="center"><a href="http://SERVER:8008/cameras?action=video&name=TWG%20Bridge">TWG Bridge</a></td>
<td align="center">73</td>
<td align="center">0</td>
</tr>
</table>
</body>
</html>
Re: xml or webpage monitor
Posted: Fri Feb 18, 2022 1:56 pm
by ssax
Thank you, I'm analyzing it and will post an update shortly.
Re: xml or webpage monitor
Posted: Fri Feb 18, 2022 4:55 pm
by ssax
I was hoping we could do something like this:
Code: Select all
/usr/local/nagios/libexec/check_xml.php -u 'https://127.0.0.1/nagiosxi/index2.php' -k 'channel[item[0]][pubDate]' -s "`date +"%a, %d %b %Y %T %Z"`"
Or like this:
Code: Select all
/usr/local/nagios/libexec/check_xml.php -u 'https://127.0.0.1/nagiosxi/index2.php' -k 'channel[item[0]][pubDate]' -s "`date +"%a, %d %b %Y %H:"`*""
But that won't meet the need because you're only really checking part of a string and that doesn't seem to support wildcards.
The issue is that your looking for a string in the output but you would need to convert it to a date/time in order to compare it with the current date/time.
I found this 3rd party one that might do it but I haven't personally tested it:
https://exchange.nagios.org/directory/P ... pl/details