|
- 监控脚本如下:zabbix_monitor_amq.sh
#!/bin/sh
#
#Description: get activemq data
IP=192.168.0.139
PORT=8161
QUEUENAME=q.virtual.charge
#WARN_Queuename="DLQ.q.virtual.charge"
WARN_Queuename="DLQ.*"
Warn_Pending=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${WARN_Queuename}"|awk -F '//g'|grep '^[0-9]'|head -1`
Pending=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -1`
Consumers=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -2|tail -1`
Enqueued=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -3|tail -1`
Dequeued=`curl -uadmin:admin http://$IP:$PORT/admin/queues.jsp | grep -A 5 "${QUEUENAME}"|awk -F '//g'|grep '^[0-9]'|head -3|tail -1`
case $1 in
Warn_Pending|Warn_Pending)
echo "$Warn_Pending"
;;
Pending|pending)
echo "$Pending"
;;
Consumers|consumers)
echo $Consumers
;;
Enqueued|enqueued)
echo $Enqueued
;;
Dequeued|dequeued)
echo $Dequeued
;;
*)
echo "Usage: $0 Pending|Consumers|Enqueued|Dequeued|Warn_Pending"
esac 2.编辑zabbix_agentd.conf
#Monitor ActiveMQ
UserParameter=activemq.pending,/etc/zabbix/scripts/check_activemq.sh Pending
UserParameter=activemq.consumers,/etc/zabbix/scripts/check_activemq.sh consumers
UserParameter=activemq.enqueued,/etc/zabbix/scripts/check_activemq.sh enqueued
UserParameter=activemq.dequeued,/etc/zabbix/scripts/check_activemq.sh dequeued
UserParameter=activemq.warn_pending,/etc/zabbix/scripts/check_activemq.sh Warn_Pending 3.编写item
4.或者上传附件的监控模板
附件:http://down.运维网.com/data/2367703
|
|