e21e1 发表于 2015-4-28 08:26:52

使用zabbix_sender收集监控信息


1.zabbix_sender的使用
zabbix_sender程序主要用于那些执行时间比较长的自定义脚本间隔发送状态或性能数据到zabbix server.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
$ /usr/local/zabbix/bin/zabbix_sender --help
Zabbix Sender v2.2.3 (revision 44105) (7 April 2014)

usage: zabbix_sender [-Vhv] {[-zpsI] -ko | [-zpI] -T -i <file> -r} [-c <file>]

Options:
-c --config <file>                   Absolute path to the configuration file

-z --zabbix-server <server>          Hostname or IP address of Zabbix server
-p --port <server port>            Specify port number of server trapper running on the server. Default is 10051
-s --host <hostname>               Specify host name. Host IP address and DNS name will not work
-I --source-address <IP address>   Specify source IP address

-k --key <key>                     Specify item key
-o --value <key value>               Specify value

-i --input-file <input file>         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 --host argument
-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
-r --real-time                     Send metrics 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

Other options:
-h --help                            Give this help
-V --version                         Display version number






1
2
3
$ /usr/local/zabbix/bin/zabbix_sender   -s "xxxxx"   -z xxxx -k MongoDB.Status -o 2.4.6
info from server: "processed: 1; failed: 0; total: 1; seconds spent: 0.000054"
sent: 1; skipped: 0; total: 1




-s 指定zabbix_sender发送的主机名称
-k 指定的KEY是通过配置文件指定的


2.Trapper Items
Trapper Items接收来源数据而不是查询它。用于将需要的数据推送给zabbix

https://www.zabbix.com/documentation/2.2/_media/manual/config/items/itemtypes/1.9.7_trapper_item.png


https://www.zabbix.com/documentation/2.2/_media/manual/config/items/itemtypes/1.9.7_trapped_data.png







参考文档:
https://www.zabbix.com/documentation/2.2/manual/concepts/sender
https://www.zabbix.com/documentation/2.2/manual/config/items/itemtypes/trapper

页: [1]
查看完整版本: 使用zabbix_sender收集监控信息