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