zabbix-httpcheck is Python script which controls Zabbix http tests from yaml file. Create/update/delete http tests and triggers for them.
- python >= 3.4
- python libs: pyzabbix, pyyaml
- Clone repo: https://github.com/OSidorenkov/zabbix-httpcheck.git
- Create and configure
config.py
near httpcheck.py. You can take as an exampleconfig.py.example
from repo. - Install python libs:
pip3 install pyzabbix pyyaml
- Create fake host or hosts in Zabbix where you want to see the Web checks, for example:
- dev
- qa
- stage
- prod
- Edit
config.py
, paste your hosts for web checks into the listzbx_hosts
.
In order to add new web services addresses to monitoring, you need:
- Add to the file
httpcheck.yaml
information about the web check, for example:
- name: GitHub
url: https://github.com/OSidorenkov
env: prod
priority: 4
name
- name of web checkurl
- web check addressenv
- service environmentpriority
- importance of web check, where- 1 - information
- 2 - warning
- 3 - average
- 4 - high
- 5 - disaster
You can also customize your validation by adding the following parameters:
delay
- Execution interval of the web scenario in seconds. Default: 60.retries
- Number of times a web scenario will try to execute each step before failing. Default: 1.timeout
- Request timeout in seconds. Default: 15.headers
- HTTP headers that will be sent when performing a request. Scenario step headers will overwrite headers specified for the web scenario.
Example:
- name: GitHub
url: https://github.com/OSidorenkov
env: qa
priority: 2
delay: 120
timeout: 30
retries: 3
headers: "Accept: application/json"
It is allowed to update existing web checks by changing or adding the following parameters:
- url
- delay
- timeout
- retries
- headers
To delete a Web check, remove this check from the file and push it into the repository.
Do not try to change the name of the verification (name
). This will result in the old checkout being deleted and creating a new one, losing the history.
Go to the script directory and run:
python3 httpcheck.py
The script will check that you need to create, update or delete and perform all actions. Like that:
- Web scenario:
- Steps:
- Trigger: