zabbixctl is a tool for working with the Zabbix server API using the command line interface, it provides an effective way for operating on trigger status, latest host data and groups of users.
It would appear that the original project is dead, so I decided to clone it and will bring it up to date & add a lot of new features. Suggestions are most welcome, please create an issue and describe what you'd like to see added or changed.
- Support for Zabbix v5.0 and above (support for <5.0 has been dropped).
- Item type names are now correctly reported.
- Support natural language date & times (examples).
- Override password config setting with env ZABBIXCTL_USERPASS.
- Allow insecure HTTPS using "insecure" config setting.
- Documentation is a work in progress.
Binaries are published on the release page.
If you prefer to install from source and have Go installed, it's as simple as
go get github.com/lasseoe/zabbixctl
afterwards the executable will be available at $GOPATH/bin/zabbixctl
zabbixctl reads its configuration from ~/.config/zabbixctl.conf and must be written using the following syntax:
[server]
address = "https://zabbix.local"
username = "admin"
password = "password"
insecure = "false"
[session]
path = "~/.cache/zabbixctl.session"
zabbixctl will authorize against 'zabbix.local' using given user
credentials and save a Zabbix session to a file ~/.cache/zabbixctl.session
and at second run will use saved session instead of re-authorizing.
Zabbix sessions have a default TTL of 15 minutes, so if the saved Zabbix
session is outdated, zabbixctl will repeat authorization and rewrite the
session file.
The password setting is now optional and zabbixctl will use the password
found in environment variable ZABBIXCTL_USERPASS, if present.
Search on zabbix triggers statuses. Triggers could be filtered using / argument, for example, search and acknowledge all triggers in a problem state and match the word 'cache':
zabbixctl -Tp /cache
Show only not acknowledged triggers.
Specify minimum trigger severity. Once for information, twice for warning, three for disaster, four for high, five for disaster.
Show triggers that have a problem state.
Show triggers that have recently been in a problem state.
Show triggers that have changed their state after the given time, default: 7 days ago
Show triggers that have changed their state before the given time.
Show hosts in maintenance.
Show triggers sorted by specified fields, default: lastchange,priority.
Show triggers in specified order, default: DESC.
Show specified amount of triggers.
Acknowledge all retrieved triggers.
Do not prompt acknowledge confirmation dialog.
Search and show latest data for specified host(s). Hosts can be searched using wildcard character '*'. Latest data can be filtered using / argument, for example retrieve latest data for database nodes and search information about replication:
zabbixctl -L dbnode* /replication
Show links on graph pages.
Search and operate on configuration of users groups.
Show list users in specified users group.
Add specified to specified users group.
Remove specified from speicifed users group.
Do not prompt confirmation dialog.
Returns single link which points to the stacked or normal graph for matched items.
Search and operate on configuration of maintenance. Maintenance could be filtered using / argument, for example, search maintenance match the word 'update-kernel':
zabbixctl -M dbnode-* /update-kernel
Add new specified with timeperiod type once.
Remove specified .
Search and operate with host.
zabbixctl -H dbnode-*
Remove specified .
zabbixctl -Tp
zabbixctl -Tr
zabbixctl -T /mysql
zabbixctl -T -xxxxx -k
zabbixctl -L dbnode* /lag
zabbixctl -L 'container-*' /cpu quota --stacked
zabbixctl -G HTTP_*
zabbixctl -G /admin
zabbixctl -G /guest -a admin
zabbixctl -M
zabbixctl -M dbnode*
maintenance name update-kernel
zabbixctl -M dbnode* /update-kernel
zabbixctl -M dbnode* -a update-kernel
axfr is a tool of your choice for retrieving domain information from your infrastructure DNS.
axfr | grep phpnode | zabbixctl -M -z -a update-kernel -f
host from stdin (must be flag -f)
axfr is a tool of your choice for retrieving domain information from your infrastructure DNS.
axfr | grep phpnode | zabbixctl -M -z dbnode* -a update-kernel -f
zabbixctl -M -r update-kernel
zabbixctl -H dbnode*
zabbixctl -H -r dbnode1
MIT.