zabbixctl - Utility that connects to Zabbix API
Project description
# zabbixctl
## Install
```bash
sudo pip install zabbixctl
#or
sudo make install
#or
sudo python setup.py install
```
## Usage
```
usage: zabbixctl [-h] [-d] [-i] [-V] [-c CACERT] [-t TIMEOUT] [-H HOSTS]
[-U USER]
{help,get,create,update,export,delete} ...
Zabbix CLI
positional arguments:
{help,get,create,update,export,delete}
get Zabbix API Method for get
export Zabbix API Method for export
update Zabbix API Method for update
create Zabbix API Method for create
delete Zabbix API Method for delete
help Display link for Zabbix wiki
optional arguments:
-h, --help show this help message and exit
-d, --debug increase output verbosity (default: False)
-i, --http Use http instead of https (default: False)
-V, --noverify Do not verify the SSL (default: False)
-c CACERT, --cacert CACERT
Path to the SSL CA Certificateexample:
/etc/pki/tls/certs/ca-bundle.crt (default: None)
-t TIMEOUT, --timeout TIMEOUT
Zabbix API read timeout in seconds (default: 30)
-H HOSTS, --hosts HOSTS
Zabbix API host(s).example: zabbixhost.example.com
(default: None)
-p URI_PATH, --uri-path URI_PATH
URI path to zabbix api. default: zabbix (default:
zabbix)
-U USER, --user USER Zabbix API user (default: system username)
usage: zabbixctl get [-h] [-a ARGUMENTS] type
positional arguments:
type Zabbix API get method
(host.get,hostgroups.get,usergroups.get)
optional arguments:
-h, --help show this help message and exit
-a ARGUMENTS, --arguments ARGUMENTS
RPC params
-k, --listkeys Returns a list of keys for the given resource type
-f FILTER, --filter FILTER
Takes "key=value" args that are sent to the zabbix api
in the filter parameter
-s SEARCH, --search SEARCH
Takes "key=value" args that are sent to the zabbix api
in the search parameter
```
## Examples
```bash
zabbixctl -H zabbix.yourdomain.com get trigger -a 'hostids=[10167]' -a 'expandExpression=true' -a 'expandDescription=true'
zabbixctl -H zabbix.yourdomain.com get trigger -a 'search={"host":"syslog"}' -a 'expandExpression=true' -a 'searchWildcardsEnabled=true' -a 'selecthosts=extend'
zabbixctl -H zabbix.yourdomain.com get trigger -a 'triggerids=[14924]'
zabbixctl -H zabbix.yourdomain.com get trigger -a 'search={"host":"syslog"}' -a 'expandExpression=true'
zabbixctl -H zabbix.yourdomain.com get user
zabbixctl -H zabbix.yourdomain.com get host
zabbixctl -H zabbix.yourdomain.com get host -a 'search={"host":"syslog"}' -a 'searchWildcardsEnabled=true'
zabbixctl -H zabbix.yourdomain.com get alert -a 'time_from=1409611855' -a 'output=extend'
zabbixctl -H zabbix.yourdomain.com get itemprototype
zabbixctl -H zabbix.yourdomain.com get event -a 'time_from=1409611855' -a 'output=extend' -a 'selectRelatedObject=["description"]'
zabbixctl -H zabbix.yourdomain.com get alert -a 'time_from=1409611855' -a 'output=extend' -a 'selectHosts=["host"]'
zabbixctl -H zabbix.yourdomain.com get template -a 'output=["host"]' -a 'selectItems=extend' -a 'templateids=[10167]'
```
## Known Issues
Error: ImportError: cannot import name to_native_string
Solution: Upgrade to at least version 2.0 of requests
## Install
```bash
sudo pip install zabbixctl
#or
sudo make install
#or
sudo python setup.py install
```
## Usage
```
usage: zabbixctl [-h] [-d] [-i] [-V] [-c CACERT] [-t TIMEOUT] [-H HOSTS]
[-U USER]
{help,get,create,update,export,delete} ...
Zabbix CLI
positional arguments:
{help,get,create,update,export,delete}
get Zabbix API Method for get
export Zabbix API Method for export
update Zabbix API Method for update
create Zabbix API Method for create
delete Zabbix API Method for delete
help Display link for Zabbix wiki
optional arguments:
-h, --help show this help message and exit
-d, --debug increase output verbosity (default: False)
-i, --http Use http instead of https (default: False)
-V, --noverify Do not verify the SSL (default: False)
-c CACERT, --cacert CACERT
Path to the SSL CA Certificateexample:
/etc/pki/tls/certs/ca-bundle.crt (default: None)
-t TIMEOUT, --timeout TIMEOUT
Zabbix API read timeout in seconds (default: 30)
-H HOSTS, --hosts HOSTS
Zabbix API host(s).example: zabbixhost.example.com
(default: None)
-p URI_PATH, --uri-path URI_PATH
URI path to zabbix api. default: zabbix (default:
zabbix)
-U USER, --user USER Zabbix API user (default: system username)
usage: zabbixctl get [-h] [-a ARGUMENTS] type
positional arguments:
type Zabbix API get method
(host.get,hostgroups.get,usergroups.get)
optional arguments:
-h, --help show this help message and exit
-a ARGUMENTS, --arguments ARGUMENTS
RPC params
-k, --listkeys Returns a list of keys for the given resource type
-f FILTER, --filter FILTER
Takes "key=value" args that are sent to the zabbix api
in the filter parameter
-s SEARCH, --search SEARCH
Takes "key=value" args that are sent to the zabbix api
in the search parameter
```
## Examples
```bash
zabbixctl -H zabbix.yourdomain.com get trigger -a 'hostids=[10167]' -a 'expandExpression=true' -a 'expandDescription=true'
zabbixctl -H zabbix.yourdomain.com get trigger -a 'search={"host":"syslog"}' -a 'expandExpression=true' -a 'searchWildcardsEnabled=true' -a 'selecthosts=extend'
zabbixctl -H zabbix.yourdomain.com get trigger -a 'triggerids=[14924]'
zabbixctl -H zabbix.yourdomain.com get trigger -a 'search={"host":"syslog"}' -a 'expandExpression=true'
zabbixctl -H zabbix.yourdomain.com get user
zabbixctl -H zabbix.yourdomain.com get host
zabbixctl -H zabbix.yourdomain.com get host -a 'search={"host":"syslog"}' -a 'searchWildcardsEnabled=true'
zabbixctl -H zabbix.yourdomain.com get alert -a 'time_from=1409611855' -a 'output=extend'
zabbixctl -H zabbix.yourdomain.com get itemprototype
zabbixctl -H zabbix.yourdomain.com get event -a 'time_from=1409611855' -a 'output=extend' -a 'selectRelatedObject=["description"]'
zabbixctl -H zabbix.yourdomain.com get alert -a 'time_from=1409611855' -a 'output=extend' -a 'selectHosts=["host"]'
zabbixctl -H zabbix.yourdomain.com get template -a 'output=["host"]' -a 'selectItems=extend' -a 'templateids=[10167]'
```
## Known Issues
Error: ImportError: cannot import name to_native_string
Solution: Upgrade to at least version 2.0 of requests
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zabbixctl-1.1.6.tar.gz
(6.4 kB
view details)
File details
Details for the file zabbixctl-1.1.6.tar.gz
.
File metadata
- Download URL: zabbixctl-1.1.6.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f1e647a708ee62615188cd8c4fe891bbe7257b03509a5550eeaaf8498df98ad |
|
MD5 | 17d3a6be48491086a0c3602000885ef7 |
|
BLAKE2b-256 | b129a113df82ab70cbfeb69fa95d78d70201abfc6d1ca63f095e8bb9e45e1521 |