首页 » 运维相关 » 监控-Zabbix » Zabbix 常用命令行使用说明

Zabbix 常用命令行使用说明

 
文章目录

Zabbix常用的CLI命令说明 

ZABBIX_AGENTD

NAME

zabbix_agentd - Zabbix agent daemon.  

SYNOPSIS

zabbix_agentd [-hpV] [-c <config-file>] [-t <item-key>]  

DESCRIPTION

zabbix_agentd is a daemon for monitoring of various server parameters.  

Options

  • -c, --config <config-file>

  • Use the alternate config-file instead of the default one. Absolute path should be specified.

  • -R, --runtime-control <option>

  • Perform administrative functions according to option.

 

  •  

  •  

Runtime control options

  •  

  •  

    • log_level_increase[=<target>]

    • Increase log level, affects all processes if target is not specified

  •  

  •  

    • log_level_decrease[=<target>]

    • Decrease log level, affects all processes if target is not specified

 Log level control targets

  •  

    • <pid>

    • Process identifier

  •  

  •  

    • <process type>

    • All processes of specified type (e.g., listener)

  •  

  •  

    • <process type>,N

    • Process type and number (e.g., listener,3)

  • -p, --print

  • Print known items and exit. For each item either generic defaults are used, or specific defaults for testing are supplied. These defaults are listed in square brackets as item key parameters. Returned values are enclosed in square brackets and prefixed with the type of the returned value, separated by a pipe character. For user parameters type is always t, as the agent can not determine all possible return values. Items, displayed as working, are not guaranteed to work from the Zabbix server or zabbix_get when querying a running agent daemon as permissions or environment may be different. Returned value types are:

    • d

    • Number with a decimal part.

    •  

    •  

  •  

  •  

    • m

    • Not supported. This could be caused by querying an item that only works in the active mode like a log monitoring item or an item that requires multiple collected values. Permission issues or incorrect user parameters could also result in the not supported state.

  •  

  •  

    • s

    • Text. Maximum length not limited.

  •  

  •  

    • t

    • Text. Same as s.

  •  

  •  

    • u

    • Unsigned integer.

  • -t, --test <item-key>

  • Test single item and exit. See --print for output description.

  • -h, --help

  • Display this help and exit.

  • -V, --version

  • Output version information and exit.

 

FILES

  • /usr/local/etc/zabbix_agentd.conf

  • Default location of Zabbix agent configuration file (if not modified during compile time).

ZABBIX_GET

NAME

zabbix_get - Zabbix get utility.  

SYNOPSIS

zabbix_get [-hV] [-s <host name or IP>] [-p <port number>] [-I <IP address>] [-k <item key>]  

DESCRIPTION

zabbix_get is a command line utility for getting data from a remote Zabbix agent.  

Options

  • -s, --host <host name or IP>

  • Specify host name or IP address of a host.

  • -p, --port <port number>

  • Specify port number of agent running on the host. Default is 10050.

  • -I, --source-address <IP address>

  • Specify source IP address.

  • -k, --key <item key>

  • Specify key of item to retrieve value for.

  • -h, --help

  • Display this help and exit.

  • -V, --version

  • Output version information and exit.

 

EXAMPLES

zabbix_get -s 127.0.0.1 -p 10050 -k system.cpu.load[all,avg1]  

ZABBIX_PROXY

NAME

zabbix_proxy - Zabbix proxy daemon.  

SYNOPSIS

zabbix_proxy [-hV] [-c <config-file>] [-R <option>]  

DESCRIPTION

zabbix_proxy is a daemon used for remote data collection.  

Options

  • -c, --config <config-file>

  • Use the alternate config-file instead of the default one. Absolute path should be specified.

  • -R, --runtime-control <option>

  • Perform administrative functions according to option.

 

  •  

  •  

Runtime control options

  •  

  •  

    • config_cache_reload

    • Reload configuration cache. Ignored if cache is being currently loaded. Active Zabbix proxy will connect to the Zabbix server and request configuration data. Default configuration file (unless -c option is specified) will be used to find PID file and signal will be sent to process, listed in PID file.

  •  

  •  

    • log_level_increase[=<target>]

    • Increase log level, affects all processes if target is not specified

  •  

  •  

    • log_level_decrease[=<target>]

    • Decrease log level, affects all processes if target is not specified

 

  •  

  •  

Log level control targets

  •  

  •  

    • <pid>

    • Process identifier

  •  

  •  

    • <process type>

    • All processes of specified type (e.g., poller)

  •  

  •  

    • <process type>,N

    • Process type and number (e.g., poller,3)

  • -h, --help

  • Display this help and exit.

  • -V, --version

  • Output version information and exit.

 

FILES

  • /usr/local/etc/zabbix_proxy.conf

  • Default location of Zabbix proxy configuration file (if not modified during compile time).

ZABBIX_SENDER

NAME

zabbix_sender - Zabbix sender utility.  

SYNOPSIS

zabbix_sender [-hpzvIV] {-kso | [-T] -i <inputfile>} [-c <config-file>]  

DESCRIPTION

zabbix_sender is a command line utility for sending data to a remote Zabbix server. On the Zabbix server an item of type Zabbix trapper should be created with corresponding key. Note that incoming values will only be accepted from hosts specified in Allowed hosts field for this item.

 

Options

  • -c, --config <config-file>

  • Use config-file. Zabbix sender reads server details from the agent configuration file. By default Zabbix sender does not read any configuration file. Absolute path should be specified. Only parametersHostname, ServerActive and SourceIP are supported. First entry from the ServerActive parameter is used.

  • -z, --zabbix-server <server>

  • Hostname or IP address of Zabbix server. If a host is monitored by a proxy, proxy hostname or IP address should be used instead.

  • -p, --port <port>

  • Specify port number of server trapper running on the server. Default is 10051.

  • -s, --host <host>

  • Specify host name as registered in Zabbix frontend. Host IP address and DNS name will not work.

  • -I, --source-address <IP>

  • Specify source IP address.

  • -k, --key <key>

  • Specify item key to send value to.

  • -o, --value <value>

  • Specify value.

  • -i, --input-file <inputfile>

  • Load values from input file. Specify - for standard input. Each line of file contains whitespace delimited: <hostname> <key> <value>. Specify - in <hostname> to use hostname from configuration file or --hostargument. All entries are sent in a sequential order top-down.

  • -T, --with-timestamps

  • Each line of file contains whitespace delimited: <hostname> <key> <timestamp> <value>. This can be used with --input-file option. Timestamp should be specified in Unix timestamp format. If target item has triggers referencing it, all timestamps must be in an increasing order, otherwise event calculation will not be correct.

  • -r, --real-time

  • Send values one by one as soon as they are received. This can be used when reading from standard input.

  • -v, --verbose

  • Verbose mode, -vv for more details.

  • -h, --help

  • Display this help and exit.

  • -V, --version

  • Output version information and exit.

EXIT STATUS

The exit status is 0 if the values were sent and all of them were successfully processed by server. If data was sent, but processing of at least one of the values failed, the exit status is 2. If data sending failed, the exit status is 1.  

EXAMPLES

zabbix_sender -c /usr/local/etc/zabbix_agentd.conf -s Monitored Host -k mysql.queries -o 342.45

Send 342.45 as the value for mysql.queries key in Monitored Host host using Zabbix server defined in agent daemon configuration file.

zabbix_sender -z 192.168.1.113 -i data_values.txt

Send values from file data_values.txt to server with IP 192.168.1.113. Host names and keys are defined in the file.

echo - hw.serial.number 1287872261 SQ4321ASDF | zabbix_sender -c /usr/local/etc/zabbix_agentd.conf -T -i -

Send a timestamped value from the commandline to Zabbix server, specified in the agent daemon configuration file. Dash in the input data indicates that hostname also should be used from the same configuration file.

ZABBIX_SERVER

NAME

zabbix_server - Zabbix server daemon.  

SYNOPSIS

zabbix_server [-hV] [-c <config-file>] [-R <option>]  

DESCRIPTION

zabbix_server is the core daemon of Zabbix software.  

Options

  • -c, --config <config-file>

  • Use the alternate config-file instead of the default one. Absolute path should be specified.

  • -R, --runtime-control <option>

  • Perform administrative functions according to option.

 

  •  

  •  

Runtime control options

  •  

  •  

    • config_cache_reload

    • Reload configuration cache. Ignored if cache is being currently loaded. Default configuration file (unless -c option is specified) will be used to find PID file and signal will be sent to process, listed in PID file.

  •  

  •  

    • log_level_increase[=<target>]

    • Increase log level, affects all processes if target is not specified

  •  

  •  

    • log_level_decrease[=<target>]

    • Decrease log level, affects all processes if target is not specified

 

  •  

  •  

Log level control targets

  •  

  •  

    • <pid>

    • Process identifier

  •  

  •  

    • <process type>

    • All processes of specified type (e.g., poller)

  •  

  •  

    • <process type>,N

    • Process type and number (e.g., poller,3)

  • -h, --help

  • Display this help and exit.

  • -V, --version

  • Output version information and exit.

 

FILES

  • /usr/local/etc/zabbix_server.conf

  • Default location of Zabbix server configuration file (if not modified during compile time).

原文链接:Zabbix 常用命令行使用说明,转载请注明来源!

0