zabbixctl is tool for working with zabbix server api using command line interface, it provides effective way for operating on statuses of triggers, hosts latest data and groups of users.
go get github.com/kovetskiy/zabbixctl
afterwards executable will be placed as $GOPATH/bin/zabbixctl
zabbixctl must be configurated before using, configuration file should be
placed in ~/.config/zabbixctl.conf
and must be written using following
syntax:
[server]
address = "zabbix.local"
username = "admin"
password = "password"
[session]
path = "~/.cache/zabbixctl.session"
zabbixctl will authorize in 'zabbix.local' server 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 new authorization, by the
way zabbix sessions have a ttl that by default equals to 15 minutes, so if
saved zabbix session is outdated, zabbixctl will repeat authorization and
rewrite the session file.
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.
zabbixctlp -Tp
zabbixctlp -Tr
zabbixctlp -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
MIT.