监控:
1、检查服务可以性
2、性能指标检查
ganglia 专门做性能指标的工具
collectd 性能好
mrtg
rrdtool Round Robin datebase
graphite安装:
yum install graphite-web
yum install python-carbon
yum install python-whisper
启动carbon:
/etc/init.d/carbon-cache restart
修改graphite配置:
/etc/graphite-web/local_settings.py
同步数据库:
cd /etc/graphite-web/
django-admin syncdb --settings=local_settings --pythonpath=.
修改数据库权限:
chmod 755 /opt/graphite/storage
启动httpd
service httpd restart
carbon 配置
/etc/carbon/carbon.conf
/etc/carbon/storage-schemas.con
MOUTH= { ‘’:1,’’:2}
d = datetime.datetime(int(year),MONTH[month],int(day),int(hour),int(minute),int(second))
数据收集工具:
Diamond is a python daemon that collects system metrics and publishes them to Graphite or other supported handlers. It is capable of collecting cpu, memory, network, i/o, load and disk metrics. Additionally, it features an API for implementing custom collectors for gathering metrics from almost any source.
diamond安装:
1、下载源码:https://github.com/BrightcoveOS/Diamond
2、python setup.py build
3、python setup.py install
4、启动后会提示configobj的模块没有安装
5、yum install python-pip
6、pip install configobj
7、cd /etc/diamond ; mv diamond.conf.example diamond.conf
8、# Graphite server host
host = 192.168.70.156
9、diamond-setup 一路回车,可设置收集的信息
10、启动:/etc/init.d/diamond start
diamond —> carbon —>存储在whisper —> graphite读取数据库展示出来
监控及产品上线内容
custom collect of diamond to graphite
/usr/share/diamond/collectors 里面存放的是collect文件夹下配置文件的内容,
过程:
1、写收集处理文件的py脚本(日志分析脚本和倒读脚本写入到diamond脚本),可参看上述路径下的脚本,日志和倒读脚本写在collect函数下,
2、在/etc/diamond/collect/定义500.conf文件,里面写true调用刚写的脚本就可以实现了
3、diamond程序就会自动调用那个diamond脚本执行,不用自定义去执行
4、时间定义在diamond.conf里
5、py脚本模板参看/usr/share/diamond/collectors/example/example.py
diamond 结合 graphite
plug-in:
拷贝文件倒读程序代码