check_zabbix

check_zabbix

Check plugin to retreive Zabbix monitoring host status using Zabbix server API.

This script could be used as Icinga/Nagios check plugin.

Requirements

  • Python
  • zabbix_client (python module)
  • configparser (python module)

Installation using VirtualEnv

virtualenv venv
./venv/bin/pip install zabbix_client configparser
./venv/bin/python check_zabbix -h

Usage

usage: check_zabbix [-h] [-v] [-d] [-l LOGFILE] [--console] [-c CONFIG]
                    [-U ZABBIX_URL] [-u ZABBIX_USER] [-p ZABBIX_PASSWORD]
                    [-H ZABBIX_HOST] [--allow-no-trigger-host]
                    [--check-triggers-related-items-state]
                    [-W ZABBIX_WARNING_PRIORITY_THRESHOLD]
                    [-C ZABBIX_CRITICAL_PRIORITY_THRESHOLD]

Check plugin to retreive zabbix monitoring host status using Zabbix server
API.

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose
  -d, --debug
  -l LOGFILE, --log-file LOGFILE
                        Log file path
  --console             Force logging on console (even if log file is
                        configured)
  -c CONFIG             Load parameters from configuration file

Zabbix connection options:
  -U ZABBIX_URL, --zabbix-url ZABBIX_URL
                        Zabbix server URL (Default : http://localhost)
  -u ZABBIX_USER, --user ZABBIX_USER
                        Zabbix user (Default : admin)
  -p ZABBIX_PASSWORD, --password ZABBIX_PASSWORD
                        Zabbix password

Zabbix host options:
  -H ZABBIX_HOST, --host ZABBIX_HOST
                        Zabbix host to check
  --allow-no-trigger-host
                        Zabbix host to check
  --check-triggers-related-items-state
                        Check triggers's related enabled items state is
                        correct
  -W ZABBIX_WARNING_PRIORITY_THRESHOLD, --warning-priority-threshold ZABBIX_WARNING_PRIORITY_THRESHOLD
                        Zabbix warning priority threshold
  -C ZABBIX_CRITICAL_PRIORITY_THRESHOLD, --critical-priority-threshold ZABBIX_CRITICAL_PRIORITY_THRESHOLD
                        Zabbix critical priority threshold

Using configuration file

Use -c parameter to load configuration from file. See example file example.conf for file format (INI).

Note : Parameters in command-line are could override configuration file informations.

Copyright

Copyright (c) 2020 Benjamin Renard

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 3 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.