![]() |
![]() |
Subject: | Creating alerts with Python |
Author: | [Not Specified] |
Posted: | 2015-08-12 08:24 |
I am currently running a Selenium server to monitor our websites. I have a python script that gathers multiple elements from the sites and places them into a document in text form. I am trying to write a python script that will verify the document for desired results and sent an appropriate alert to zenoss based on the text in the document.
Any ideas
Subject: | Two ways: |
Author: | [Not Specified] |
Posted: | 2015-08-12 08:39 |
Two ways:
Have your python script do a callout to the zensendevent CLI.
Use the API EventsRouter add_event method.
Advantage of using the API is that you don't need to have any Zenoss components installed on your Selenium server.
Subject: | Thanks for the super quick |
Author: | [Not Specified] |
Posted: | 2015-08-12 08:50 |
Thanks for the super quick response! I will start looking into these.
Subject: | If you're new to the API |
Author: | [Not Specified] |
Posted: | 2015-08-12 10:02 |
If you're new to the API start here: http://wiki.zenoss.org/Working_with_the_JSON_API
There's a bash script that you can use to prototype your JSON API calls. As a Perl guy I have a bunch of perl routines that I use (JSON::Parse and Data::Dumper really come in handy). I added some stuff about events to the Wiki but here's what you need to get started.
Download the json_api.sh script mentioned at the top of the wiki. That gives you a shell function called zenoss_api. Then:
zenoss_api evconsole_router EventsRouter add_event '{"summary":"$summary","device":"$device","component":"$component","severity":$severity,"evclasskey":"$evkey","evclass":"$evclass"}'
< |
Previous Threshold for vSphere Interface Speeds |
Next SNMP informations without ping |
> |