No project description provided
Project description
Zabbix CLI
This software is released under the MIT License, see LICENSE.txt.
Example
Valid Command
zabbix_controller -u username -p password hosts list
zabbix_controller -u username -p password hosts -m name:^server$ list
Invalid Command
zabbix_controller hosts -u username -p password list
zabbix_controller -u username -p password hosts list -m name:^server$
zabbixctl [options] command ...
Options
These options are only set at zabbixctl [options] command ...
.
zabbixctl command [options] ...
is not accepted.
--help
zabbixctl --help
--apiserver-address, -aa
zabbixctl -aa http://localhost:8081
--username, -u, --password, -p
Used for zabbix login
zabbixctl --username Admin --password zabbix_password
--basicauth_username, -bu, --basicauth_password, -bp
Used for basic authentication
zabbixctl -bu alis -bp alis_password
--dry-run
If you set --dry-run
, only get API is executed, then ZabbixCTL state is printed.
Create, update, delete like API is not executed.
zabbixctl --dry-run
zabbixctl host Options
Command
...
Options
-m, --match
Search host using json like object.
Search key, then apply value.
In the example below,
hosts which name key is including some_name
is listed.
zabbixctl hosts -m '{"name": "some_name"}' list
zabbixctl hosts -m '[{"name": "some_name"}]' list
Each key, value pairs are chained by and operator
.
Each dicts are chained by or operator
.
This command mean ("name": "some_name" and "hostid": "^1") or "name": "other_name"
.
zabbixctl hosts -m '[{"name": "some_name", "hostid": "^1"}, {"name": "other_name"}]' list
-tr, --time-range
This option is able to specify time range. If you use --match at the same time, used by "and operator".
key:[from]-[to]
from
and to
must be unixtime and can be omitted.
These commands are same and print host which disable property is included from 0 to now.
zabbixctl hosts -tr disable:0- list
zabbixctl hosts -tr disable:- list
This command mean (("name": "some_name" and "hostid": "^1") or "name": "other_name") and (0 <= disable_until <= now)
.
zabbixctl hosts -m '[{"name": "some_name", "hostid": "^1"}, {"name": "other_name"}]' -tr 'disable_until:-' list
Commands
list
list up host
delete
delete host
- options
-y, --yes
zabbixctl hosts -m '{"name": "some_name"}' delete -y
disable
disable host
- options
-y, --yes
zabbixctl hosts -m '{"name": "some_name"}' disable -y
update
update host
- options
-d, --data
-y, --yes
These are same command.
zabbixctl hosts -m '{"name": "some_name"}' update -d '{"state": 1}' -y
zabbixctl hosts -m '{"name": "some_name"}' update -d '{"state": "1"}' -y
zabbixctl hosts -m '{"name": "some_name"}' disable -y
zabbixctl host graphs Options
Command
Command
list
delete
- options
-y, --yes
Options
-m, --match
This command delete graphs which is in hosts which is matched regex.
zabbixctl hosts -m '{"name": "some_name"}' graphs delete -y
zabbixctl host interfaces Options
Command
Command
list
usedns
Use dns, not ipaddress
- options
-y, --yes
update
These are same command.
- options
-y, --yes
zabbixctl hosts update -d '{"useip": 0}' -y
zabbixctl hosts update -d '{"useip": "0"}' -y
zabbixctl hosts usedns -y
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
Built Distribution
Hashes for zabbix_controller-0.1.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf2c905fa1346ff641e4089a8ab396b2df34935b8e54dedbe688fb404421aa5a |
|
MD5 | 3495c794bc0540f3dc53e957d3bf8e06 |
|
BLAKE2b-256 | e2e0e2e11720b8ff9047742728ac080cf1fcaaab2b02a93d7e0b59a9d736143c |