Cacti / plugin_webseer

Cacti Web Services Monitoring Plugin
GNU General Public License v2.0
8 stars 9 forks source link

"Response Search String - Failed" does not mean what I think or does not work? #33

Closed KnoAll closed 5 years ago

KnoAll commented 5 years ago

"Response Search String - Failed This is the string to search for a known failure in the Web Service response. The Service Check will only alert if this string is found, ignoring any timeout issues and the search strings above."

The way I read this is: IF the string is found, an alert will be generated, regardless of other options. This does not seem to be working. I have a check as such... Response search string: xxx response search string -failed: yyy if xxx is present then the webpage is loading (service is alive), if yyy is ALSO present, that means the webpage is responding, but there is some issue with a component and an alert should be fired. Is this not how this works?

netniV commented 5 years ago

That is a good question, I'll have to think about that. It may need to be an option as inverting that functionality would cause people to start getting messages/alerts were they didn't previously if we just enabled by default.

KnoAll commented 5 years ago

OK, any thoughts would be appreciated. I have many cases where I need this but it does not work.

netniV commented 5 years ago

So, if you have search_failed set, and there is an error number, it attempts to check if the data matches (case sensitive).

netniV commented 5 years ago

The best way to see this is to enable webseer in the selective plugin debug in settings then review your log file.

KnoAll commented 5 years ago

Still not seeing any alerts. I did set to debug, and then saved the settings. this is what i see in the log, with the poller messages recurring and no alert.

2019/02/15 07:39:09 - SYSTEM WEBSEER STATS: Total Time:0.291, Service Checks:6, Servers:0 2019/02/15 07:39:09 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=7] 2019/02/15 07:39:09 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=5] 2019/02/15 07:39:09 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=4] 2019/02/15 07:39:09 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=3] 2019/02/15 07:39:08 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=2] 2019/02/15 07:39:08 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=1] 2019/02/15 07:39:07 - SYSTEM THOLD STATS: Time:0.1960 Tholds:0 TotalDevices:8 DownDevices:1 NewDownDevices:0 2019/02/15 07:39:06 - SYSTEM STATS: Time:4.5912 Method:spine Processes:1 Threads:5 Hosts:8 HostsPerProcess:8 DataSources:135 RRDsProcessed:90 2019/02/15 07:39:05 - DBCALL DEVEL: SQL Save on table 'plugin_webseer_urls': 'a:15:{s:2:"id";i:7;s:7:"enabled";s:2:"on";s:12:"requiresauth";s:0:"";s:9:"checkcert";s:0:"";s:15:"notify_accounts";s:0:"";s:12:"proxy_server";s:1:"0";s:12:"display_name";s:3:"eCall";s:3:"url";s:26:"http://192.168.0.107:8081/";s:2:"ip";s:0:"";s:6:"search";s:8:"Avalon:";s:12:"search_maint";s:0:"";s:13:"search_failed";s:8:"Offline";s:12:"notify_extra";s:23:"kevin@xxx.com";s:11:"downtrigger";i:3;s:15:"timeout_trigger";i:4;}'

netniV commented 5 years ago

I've pushed another update with better logging. Give that a try.

KnoAll commented 5 years ago

plugin updated... here is what i see...

2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] Updating Statistics 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] Not checking for trigger 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] failures:0, triggered:0 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] pi:60, t:1550255956 (2019-02-15 10:39:16), lc:1550256016 (2019-02-15 10:40:16), ts:1, tf:3 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] Processing requires authentication 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] Processing search found 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] Processing search 2019/02/15 10:42:16 - WEBSEER DEBUG: [Url 4] cURL errno: 0 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] Updating Statistics 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] Not checking for trigger 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] failures:0, triggered:0 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] pi:60, t:1550255955 (2019-02-15 10:39:15), lc:1550256015 (2019-02-15 10:40:15), ts:1, tf:3 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] Processing requires authentication 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] Processing search found 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] Processing search 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 3] cURL errno: 0 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] Updating Statistics 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] Not checking for trigger 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] failures:0, triggered:0 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] pi:60, t:1550255955 (2019-02-15 10:39:15), lc:1550256015 (2019-02-15 10:40:15), ts:1, tf:3 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] Processing requires authentication 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] Processing search found 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] Processing search 2019/02/15 10:42:15 - WEBSEER DEBUG: [Url 1] cURL errno: 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Updating Statistics 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Not checking for trigger 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] failures:0, triggered:0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] pi:60, t:1550255954 (2019-02-15 10:39:14), lc:1550256014 (2019-02-15 10:40:14), ts:1, tf:3 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Updating Statistics 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Not checking for trigger 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] failures:0, triggered:0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] pi:60, t:1550255954 (2019-02-15 10:39:14), lc:1550256014 (2019-02-15 10:40:14), ts:1, tf:3 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Processing requires authentication 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Processing search found 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Processing search 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] cURL errno: 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Processing requires authentication 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Processing search found 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Processing search 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] cURL errno: 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 1] Executing Get Request for URL:http://pizza.com, IP: 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 1] Checking Cookie File 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 1] Service Check Number 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Executing Get Request for URL:http://192.168.0.107:8081/, IP: 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Executing Get Request for URL:http://brewpi, IP: 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Checking Cookie File 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Checking Cookie File 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 2] Service Check Number 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 7] Service Check Number 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 3] Executing Get Request for URL:http://kevin.com/blog, IP: 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 3] Checking Cookie File 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 3] Service Check Number 0 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 4] Executing Get Request for URL:http://pubs.com/index.php, IP: 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 4] Checking Cookie File 2019/02/15 10:42:14 - WEBSEER DEBUG: [Url 4] Service Check Number 0 2019/02/15 10:42:11 - SYSTEM WEBSEER STATS: Total Time:0.339, Service Checks:5, Servers:0 2019/02/15 10:42:11 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=7 --debug] 2019/02/15 10:42:11 - WEBSEER DEBUG: [Url 7] Launching Service Check http://192.168.0.107:8081/ 2019/02/15 10:42:11 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=4 --debug] 2019/02/15 10:42:11 - WEBSEER DEBUG: [Url 4] Launching Service Check http://pubs.com/index.php 2019/02/15 10:42:11 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=3 --debug] 2019/02/15 10:42:11 - WEBSEER DEBUG: [Url 3] Launching Service Check http://kevin.com/blog 2019/02/15 10:42:11 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=2 --debug] 2019/02/15 10:42:11 - WEBSEER DEBUG: [Url 2] Launching Service Check http://brewpi 2019/02/15 10:42:11 - POLLER: Poller[Main Poller] DEBUG: About to Spawn a Remote Process [CMD: /usr/bin/php, ARGS: -q "/var/www/html/cacti/plugins/webseer/webseer_process.php" --id=1 --debug] 2019/02/15 10:42:11 - WEBSEER DEBUG: [Url 1] Launching Service Check http://pizza.com

netniV commented 5 years ago

Ok so the big factor here is that with cURL error being 0, it wouldn't check for a failure.

KnoAll commented 5 years ago

So I guess that goes back to my original question, does that search field 'failed' not do what i think it does? A responding webpage but failing underlying system could return a keyword in a valid cURL query.

netniV commented 5 years ago

OK, so having reviewed your logs, I believe that the code is correct in what it's doing. If there is an error code, and the search failed is set, it checks for the value to alert on. If there is no error, or the search failed is not set, it operates normally.

KnoAll commented 5 years ago

OK, so I think this does not do what I want. I am trying to search for text within an html page, not the return result from a webservice. `

Service is alive.

Looking for 'Service', check is good. Looking for 'problem' also, not found.

Service is alive, but there is a problem with serial device.

` Looking for 'Service', check is good. Found 'problem' also, error, fire alert.

netniV commented 5 years ago

Well, whether it’s a service or HTML page, it returns a result. You just need to find the string that is unique to success rather than failures. If the success string is not present, it’s considered a fail. If it returns an invalid error code and no response string is set, it’s deemed an error. However, if the returned result is HTML or XML, you also need to take into account any tags or HTML encoding.

KnoAll commented 5 years ago

I have this very minimal test page... html head body Service is alive, but there is a problem with serial device. /body /head /html with this configured setup... image

it does not error and does not fire an alert. perhaps that is just the way it is.

netniV commented 5 years ago

Just take "problem" away and it should all work OK.

KnoAll commented 5 years ago

I'm not explaining this well. That is not what I want. I'll find another way I guess.

KnoAll commented 5 years ago

It looks like the change you made for additional debug cannot be turned off in the normal way. i'm on low and dont have any selective plugins added and webseer is logging debug.

netniV commented 5 years ago

That should only log if the "$debug" flag is set at the command line.

netniV commented 5 years ago

I can confirm that I am experiencing the same thing which suggests something is wrongly setting that flag.

netniV commented 5 years ago

This should now be resolved.