HTTP服务目前最流行的互联网应用之一,如何监控服务的健康状态对系统运维来说至关重要。
  Zabbix本身提供了对WEB应用程序的监控,比如监控WEB程序的Download Speed,Response Time和Response Code等性能指标,但是配置起来比较繁琐和复杂。下面通过 python pycurl模块来获取HTTP响应时间,下载速度,状态吗等性能指标。然后通过zabbix trapper的方式来监控WEB应用的性能。
  Zabbix trapper监控是客户端收集监控数据,然后以zabbix_sender的方式发送给zabbix server或者proxy服务器。发送的数据主要包括zabbix server或者proxy主机名,监控项和值。zabbix_sender具体用法如下:


  

[root@monitor]# /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