|
首先删除原来diamond生成的servers目录
[root@Allentuns httpcode]# rm -rf /var/lib/carbon/whisper/servers/
然后手动运行diamond的httpcode脚本
[root@Allentuns httpcode]# diamond -f -l -r ./httpcode.py -c /etc/diamond/diamond.conf
ERROR: Pidfile exists. Server already running?#需要手动停止diamond服务
[root@Allentuns httpcode]# /etc/init.d/diamond stop
Stopping diamond: [确定]
[root@Allentuns httpcode]# diamond -f -l -r ./httpcode.py -c /etc/diamond/diamond.conf
[2015-03-31 11:13:56,198] [MainThread] Changed UID: 0 () GID: 0 ().
[2015-03-31 11:13:56,198] [MainThread] Loaded Handler: diamond.handler.graphite.GraphiteHandler
[2015-03-31 11:13:56,201] [MainThread] GraphiteHandler: Established connection to graphite server localhost:2003.
[2015-03-31 11:13:56,202] [MainThread] Loaded Handler: diamond.handler.archive.ArchiveHandler
[2015-03-31 11:13:56,206] [MainThread] Loading Collectors from: .
[2015-03-31 11:13:56,209] [MainThread] Loaded Module: httpcode
[2015-03-31 11:13:56,209] [MainThread] Loaded Collector: httpcode.HttpCodeCollector
[2015-03-31 11:13:56,209] [MainThread] Initialized Collector: HttpCodeCollector
[2015-03-31 11:13:56,210] [MainThread] Skipped loading disabled Collector: HttpCodeCollector
[2015-03-31 11:13:56,210] [MainThread] Started task scheduler.
[2015-03-31 11:13:57,211] [MainThread] Stopping task scheduler.
[2015-03-31 11:14:01,217] [MainThread] Stopped task scheduler.
[2015-03-31 11:14:01,217] [MainThread] Exiting.
如果没有报错,则查看浏览器会发现多了一个servers目录;但是当时目录就是没有生成,我还真纳闷了。原来在配置文件中没有启动此配置
[root@Allentuns httpcode]# vim httpcode.py
......
config = super(HttpCodeCollector, self).get_default_config()
config.update({
'path': 'weblog',
'enabled': 'True'#开启此选项
})
如果用diamond来搜集,则无需此选项,因为diamond有针对类的配置文件,在配置文件中开启会比在脚本中开启看起来更统一 |
|
|