Hunter的大杂烩

September 2, 2014

ganglia/nagios集成

Filed under: 技术话题 — hunter @ 5:24 pm

1. 用了自带的python client

优点是可以比较精细获取某个指标 ,比如我用这个来判断没有外网IP的机器是否存活:

#!/bin/sh

if [ $# -lt 1 ];then
echo “USAGE: $0 [host]”
exit
fi

retmsg=`/opt/ganglia/bin/ganglia –host=${gmond_ip} –port=${gmond_port}  –alive=$1 |grep True`
if [ -z $retmsg ];
then
echo “CRITICAL: host:” $1 ” is dead!”
exit 2
else
echo “OK:host:” $1 ” is alive”
exit 0
fi
2. 用了ganglia-nagios-bridge

优点是可以批量获取、设置多个指标

安装过程遇到的错误

Filed under: 技术话题 — hunter @ 4:28 pm

1. ganglia python client运行错误

error msg:’cannot connect to ganglia server (gmond) [xxx:yyy]

modify:  vi /opt/ganglia/lib/python/gmon/ganglia.py +412

sock.connect((self.svchost, int(self.svcport)))

^^^^^^^^^

2. nagios 监控出现It appears as though you do not have permission

参考:http://bbs.linuxtone.org/thread-4440-1-1.html

有可能是你的htpasswd里面的用户名不是nagiosadmin,修改 cgi.cfg中相关配置即可

3. contact notification_options里面去掉 u 参数(unkown)

如: service_notification_options    w,c,r,f,s

因为ganglia的python插件会用unkown状态

安装ganglia/nagios集成插件

Filed under: 技术话题 — hunter @ 3:54 pm

url:https://github.com/ganglia/monitor-core/wiki/Integrating-Ganglia-with-Nagios

其中 ganglia-nagios-bridge 需要安装 argparse 模块:

easy_install argparse

check_ganglia_metric 需要 安装NagAconda 模块 或者直接执行 easy_install ceck_ganglia_metric

btw:怎么都没搞定这个check_ganglia_metric的cache问题,回头继续搞 ganglia python client

September 1, 2014

gmond的神奇特性

Filed under: 技术话题 — hunter @ 7:00 pm

如果在配置gmond.conf时,没有使用多播,那么必须把自己的ip加入到send_channel里面,否则 gmond不会感知本机的数据!

udp_send_channel {
#bind_hostname = yes # Highly recommended, soon to be default.
# This option tells gmond to use a source address
# that resolves to the machine’s hostname.  Without
# this, the metrics may appear to come from any
# interface and the DNS names associated with
# those IPs will be used to create the RRDs.
#mcast_join = 239.2.11.71
  host = 192.168.1.1

port = 28649
ttl = 1
}

Centos 6.2 下ganglia安装注意事项

Filed under: 技术话题 — hunter @ 6:39 pm

主要是selinux搞的鬼,大致需要调整以下配置:
1. chcon -t httpd_sys_content_t -R /usr/local/ganglia/ganglia-web
chown apache:apache -R /usr/local/ganglia/ganglia-web
chmod 777 /usr/local/ganglia/ganglia-web/dwoo/*

(more…)

« Newer Posts

Powered by WordPress