forked from kovetskiy/zabbixctl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
599 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
package main | ||
|
||
import "os" | ||
|
||
var ( | ||
version = "2.0" | ||
docs = `zabbixctl ` + version + os.ExpandEnv(` | ||
zabbixctl is tool for working with zabbix server api using command line | ||
interface, it provides effective way for operating on statuses of triggers and | ||
hosts latest data. | ||
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. | ||
Usage: | ||
zabbixctl [options] -T [/<pattern>...] | ||
zabbixctl [options] -L <hostname>... [/<pattern>...] | ||
zabbixctl -h | --help | ||
zabbixctl --version | ||
Workflow options: | ||
-T --triggers | ||
Search on zabbix triggers statuses. Triggers could be filtered using | ||
/<pattern> argument, for example, search and acknowledge all triggers in a | ||
problem state and match the word 'cache': | ||
zabbixctl -Tp /cache | ||
-k --only-nack | ||
Show only not acknowledged triggers. | ||
-x --severity | ||
Specify minimum trigger severity. Once for information, twice for | ||
warning, three for disaster, four for high, five for disaster. | ||
-p --problem | ||
Show triggers that have a problem state. | ||
-r --recent | ||
Show triggers that have recently been in a problem state. | ||
-s --since <date> | ||
Show triggers that have changed their state after the given time. | ||
[default: 7 days ago] | ||
-u --until <date> | ||
Show triggers that have changed their state before the given time. | ||
-m --maintenance | ||
Show hosts in maintenance. | ||
-i --sort <fields> | ||
Show triggers sorted by specified fields. | ||
[default: lastchange,priority] | ||
-o --order <order> | ||
Show triggers in specified order. | ||
[default: DESC] | ||
-n --limit <amount> | ||
Show specified amount of triggers. | ||
[default: 0] | ||
-k --acknowledge | ||
Acknowledge all retrieved triggers. | ||
-f --noconfirm | ||
Do not prompt acknowledge confirmation dialog. | ||
-L --latest-data | ||
Search and show latest data for specified host(s). Hosts can be searched | ||
using wildcard character '*'. Latest data can be filtered using /<pattern> | ||
argument, for example retrieve latest data for database nodes and search | ||
information about replication: | ||
zabbixctl -L dbnode-* /replication | ||
-g --graph | ||
Show links on graph pages. | ||
-G --groups | ||
Search and operate on configuration of users groups. | ||
-l --list | ||
Show list users in specified users group. | ||
-a --add | ||
Add specified <user> to specified users group. | ||
-r --remove | ||
Remove specified <user> from speicifed users group. | ||
-f --noconfirm | ||
Do not prompt confirmation dialog. | ||
Misc options: | ||
-c --config <path> | ||
Use specified configuration file. | ||
[default: $HOME/.config/zabbixctl.conf] | ||
-v --verbosity Specify program output verbosity. | ||
Once for debug, twice for trace. | ||
-h --help | ||
Show this screen. | ||
--version | ||
Show version. | ||
`) | ||
usage = ` | ||
zabbixctl [options] -T [-v]... [-x]... [<pattern>]... | ||
zabbixctl [options] -L [-v]... <pattern>... | ||
zabbixctl [options] -G [-v]... [<pattern>]... | ||
zabbixctl [options] -G [-v]... <pattern>... -a <user> | ||
zabbixctl [options] -G [-v]... <pattern>... -r <user> | ||
zabbixctl -h | --help | ||
zabbixctl --version | ||
` | ||
options = ` | ||
Options: | ||
-T --triggers | ||
-y --only-nack | ||
-x --severity | ||
-p --problem | ||
-t --recent | ||
-e --since <date> [default: 7 days ago] | ||
-u --until <date> | ||
-m --maintenance | ||
-i --sort <fields> [default: lastchange,priority] | ||
-o --order <order> [default: DESC] | ||
-n --limit <amount> [default: 0] | ||
-f --noconfirm | ||
-k --acknowledge | ||
-L --latest-data | ||
-g --graph | ||
-G --groups | ||
-a --add <user> | ||
-r --remove <user> | ||
-c --config <path> [default: $HOME/.config/zabbixctl.conf] | ||
-v --verbosity | ||
-h --help | ||
--version | ||
` | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.