Add Zabbix completions (#9647)

Add Zabbix completions
This commit is contained in:
Robert Szulist 2023-04-01 05:13:40 +02:00 committed by GitHub
parent 43e8bb4532
commit 9bd1dc14e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 270 additions and 0 deletions

View File

@ -0,0 +1,14 @@
set -l runtime "userparameter_reload" \
"log_level_increase" \
"log_level_decrease" \
help \
metrics \
version
complete -c zabbix_agent2 -s c -l config -d "Specify an alternate config-file."
complete -c zabbix_agent2 -r -f -s R -l runtime-control -a "$runtime" -d "Perform administrative functions."
complete -c zabbix_agent2 -f -s p -l print -d "Print known items and exit."
complete -c zabbix_agent2 -f -s t -l test -d "Test single item and exit."
complete -c zabbix_agent2 -f -s h -l help -d "Display this help and exit."
complete -c zabbix_agent2 -f -s V -l version -d "Output version information and exit."

View File

@ -0,0 +1,34 @@
set -l runtime userparameter_reload \
log_level_increase \
log_level_increase= \
log_level_decrease \
log_level_decrease=
function __fish_string_in_command -a ch
string match -rq $ch (commandline)
end
function __fish_prepend -a prefix
if string match -rq 'log_level_(in|de)crease' $prefix
set var "active checks" collector listener
end
for i in $var
echo $prefix="$i"
end
end
# General
complete -c zabbix_agentd -s c -l config -d "Specify an alternate config-file."
complete -c zabbix_agentd -f -s f -l foreground -d "Run Zabbix agent in foreground."
complete -c zabbix_agentd -r -f -s R -l runtime-control -a "$runtime" -d "Perform administrative functions."
complete -c zabbix_agentd -f -s p -l print -d "Print known items and exit."
complete -c zabbix_agentd -f -s t -l test -d "Test single item and exit."
complete -c zabbix_agentd -f -s h -l help -d "Display this help and exit."
complete -c zabbix_agentd -f -s V -l version -d "Output version information and exit."
# Log levels
complete -c zabbix_agentd -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_increase" -a "(__fish_prepend log_level_increase)"
complete -c zabbix_agentd -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_decrease" -a "(__fish_prepend log_level_decrease)"

View File

@ -0,0 +1,23 @@
# General
complete -c zabbix_get -f -s s -l host -d "Specify host name or IP address of a host."
complete -c zabbix_get -f -s p -l port -d "Specify port number of agent running on the host."
complete -c zabbix_get -f -s I -l source-address -d "Specify source IP address."
complete -c zabbix_get -f -s t -l timeout -d "Specify timeout."
complete -c zabbix_get -f -s k -l key -d "Specify key of item to retrieve value for."
complete -c zabbix_get -f -s h -l help -d "Display this help and exit."
complete -c zabbix_get -f -s V -l version -d "Output version information and exit."
# TLS
complete -c zabbix_get -f -r -l tls-connect -a "unencrypted psk cert" -d "How to connect to agent."
complete -c zabbix_get -l tls-ca-file -F -d "Full path of a file with the top-level CA(s)."
complete -c zabbix_get -l tls-crl-file -F -d " Full path of a file with revoked certificates."
complete -c zabbix_get -f -l tls-agent-cert-issuer -d "Allowed agent certificate issuer."
complete -c zabbix_get -f -l tls-agent-cert-subject -d "Allowed agent certificate subject."
complete -c zabbix_get -l tls-cert-file -d "Full path the certificate or certificate chain."
complete -c zabbix_get -l tls-key-file -d "Full path of a file with the private key."
complete -c zabbix_get -f -l tls-psk-identity -d "PSK-identity string."
complete -c zabbix_get -l tls-psk-file -d "Full path of a file with the pre-shared key."
complete -c zabbix_get -f -l tls-cipher13 -d "Cipher string for OpenSSL."
complete -c zabbix_get -f -l tls-cipher -d "GnuTLS priority string."

View File

@ -0,0 +1,9 @@
# General
complete -c zabbix_js -s s -l script -d "Specify the file name of the script to execute."
complete -c zabbix_js -f -s p -l param -d "Specify the input parameter."
complete -c zabbix_js -s i -l input -d "Specify the file name of the input parameter."
complete -c zabbix_js -f -s l -l loglevel -d "Specify the log level."
complete -c zabbix_js -f -s t -l timeout -d "Specify the timeout in seconds."
complete -c zabbix_js -f -s h -l help -d "Display this help and exit."
complete -c zabbix_js -f -s V -l version -d "Output version information and exit."

View File

@ -0,0 +1,60 @@
set -l runtime config_cache_reload \
snmp_cache_reload \
housekeeper_execute \
diaginfo \
diaginfo= \
log_level_increase \
log_level_increase= \
log_level_decrease \
log_level_decrease=
function __fish_string_in_command -a ch
string match -rq $ch (commandline)
end
function __fish_prepend -a prefix
set -l log_target "configuration syncer" \
"data sender" \
discoverer \
"history syncer" \
housekeeper \
"http poller" \
"icmp pinger"\
"ipmi manager" \
"ipmi poller" \
"java poller" \
poller \
self-monitoring \
"snmp trapper" \
"task manager" \
trapper \
"unreachable poller" \
"vmware collector"
if string match -rq 'log_level_(in|de)crease' $prefix
set var $log_target
else if string match -rq 'diaginfo' $prefix
set var historycache preprocessing
end
for i in $var
echo $prefix="$i"
end
end
# General
complete -c zabbix_proxy -s c -l config -d "Use an alternate config-file."
complete -c zabbix_proxy -f -s f -l foreground -d "Run Zabbix agent in foreground."
complete -c zabbix_proxy -f -s R -l runtime-control -a "$runtime" -d "Perform administrative functions."
complete -c zabbix_proxy -f -s h -l help -d "Display this help and exit."
complete -c zabbix_proxy -f -s V -l version -d "Output version information and exit."
# Logs
complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_increase" -a "(__fish_prepend log_level_increase)"
complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_decrease" -a "(__fish_prepend log_level_decrease)"
# Diag info
complete -c zabbix_proxy -r -f -s R -l runtime-control -n "__fish_string_in_command diaginfo" -a "(__fish_prepend diaginfo)"

View File

@ -0,0 +1,31 @@
# General
complete -c zabbix_sender -F -s c -l config -d "Zabbix Agent configuration file."
complete -c zabbix_sender -f -s z -l zabbix-server -d "Hostname or IP address of Zabbix server."
complete -c zabbix_sender -f -s p -l port -d "Specify port number of agent running on the host."
complete -c zabbix_sender -f -s I -l source-address -d "Source IP address."
complete -c zabbix_sender -f -s t -l timeout -d "Specify timeout."
complete -c zabbix_sender -f -s s -l host -d "Specify host name the item belongs to."
complete -c zabbix_sender -f -s k -l key -d "Specify item key to send value to."
complete -c zabbix_sender -f -s o -l value -d "Specify item value."
complete -c zabbix_sender -s i -l input-file -d "Load values from input file."
complete -c zabbix_sender -f -s h -l help -d "Display this help and exit."
complete -c zabbix_sender -f -s V -l version -d "Output version information and exit."
complete -c zabbix_sender -s T -l with-timestamps -d "Input file contains timestamps"
complete -c zabbix_sender -s N -l with-ns -d "Timestamps have nanosecond portion."
complete -c zabbix_sender -s r -l real-time -d "Send values as soon as they are received."
complete -c zabbix_sender -s v -l verbose -d "Verbose mode, -vv for more details."
# TLS
complete -c zabbix_sender -f -r -l tls-connect -a "unencrypted psk cert" -d "How to connect to agent."
complete -c zabbix_sender -l tls-ca-file -F -d "Full path of a with the top-level CA(s)."
complete -c zabbix_sender -l tls-crl-file -F -d "Full path of a file with revoked certificates."
complete -c zabbix_sender -f -l tls-server-cert-issuer -d "Allowed server certificate issuer."
complete -c zabbix_sender -f -l tls-server-cert-subject -d "Allowed server certificate subject."
complete -c zabbix_sender -l tls-cert-file -d "Full path of the certificate or certificate chain."
complete -c zabbix_sender -l tls-key-file -d "Full path of the private key."
complete -c zabbix_sender -f -l tls-psk-identity -d "PSK-identity string."
complete -c zabbix_sender -l tls-psk-file -d "Full path of a file with the pre-shared key."
complete -c zabbix_sender -f -l tls-cipher13 -d "Cipher string for OpenSSL."
complete -c zabbix_sender -f -l tls-cipher -d "GnuTLS priority string."

View File

@ -0,0 +1,96 @@
set -l runtime config_cache_reload \
housekeeper_execute \
trigger_housekeeper_execute \
log_level_increase \
"log_level_increase=" \
log_level_decrease \
"log_level_decrease=" \
snmp_cache_reload \
secrets_reload \
diaginfo \
"diaginfo=" \
prof_enable \
prof_enable= \
prof_disable \
prof_disable= \
service_cache_reload \
ha_status \
"ha_remove_node=" \
ha_set_failover_delay
set -l scope rwlock mutex processing
function __fish_string_in_command -a ch
string match -rq $ch (commandline)
end
function __fish_prepend -a prefix
set -l log_target alerter \
"alert manager" \
"configuration syncer" \
discoverer \
escalator \
"history syncer" \
housekeeper \
"http poller" \
"icmp pinger" \
"ipmi manager" \
"ipmi poller" \
"java poller" \
poller \
"preprocessing manager" \
"preprocessing worker" \
"proxy poller" \
"self-monitoring" \
"snmp trapper" \
"task manager" \
timer \
trapper \
"unreachable poller" \
"vmware collector" \
"history poller" \
"availability manager" \
"service manager" \
"odbc poller"
if string match -rq 'log_level_(in|de)crease' $prefix
set var $log_target
else if string match -rq 'prof_(en|dis)able' $prefix
set var $log_target 'ha manager'
else if string match -rq 'diaginfo' $prefix
set var historycache preprocessing alerting lld valuecache locks
end
for i in $var
echo $prefix="$i"
end
end
function __fish_list_nodes
zabbix_server -R ha_status | tail -n+4 | awk '{print "ha_remove_node="$3}'
end
# General
complete -c zabbix_server -s c -l config -d "Path to the configuration file."
complete -c zabbix_server -f -s f -l foreground -d "Run Zabbix server in foreground."
complete -c zabbix_server -f -s h -l help -d "Display this help message."
complete -c zabbix_server -f -s V -l version -d "Display version number."
complete -c zabbix_server -f -s R -l runtime-control -a "$runtime" -d "Perform administrative functions."
# Log levels
complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_increase" -a "(__fish_prepend log_level_increase)"
complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command log_level_decrease" -a "(__fish_prepend log_level_decrease)"
# Prof enable
complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command prof_enable" -a "(__fish_prepend prof_enable)"
complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command prof_disable" -a "(__fish_prepend prof_disable)"
# HA nodes
complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command ha_remove_node" -a "(__fish_list_nodes)"
# diaginfo
complete -c zabbix_server -r -f -s R -l runtime-control -n "__fish_string_in_command diaginfo" -a "(__fish_prepend diaginfo)"

View File

@ -0,0 +1,3 @@
complete -c zabbix_web_service -s c -l config -d "Use an alternate config-file."
complete -c zabbix_web_service -s h -l help -d "Display this help and exit."
complete -c zabbix_web_service -s V -l version -d "Output version information and exit."