正常安装icinga2 与icingweb2(此处省略,官网有指导文档)
# rpm --import
# curl -o /etc/yum.repos.d/ICINGA-release.repo
# yum makecache
# yum install icinga2
# chkconfig icinga2 on
# service icinga2 start
mv icingaweb2-module-graphite /usr/share/icingaweb2/modules/graphite
icinga2 feature enable graphite
下载
yum install icinga2 icinga2web httpd Django django-tagging pyparsing python-whisper pytz mod_wsgi python-carbon python-twisted-core python-zope-interface python-zope-filesystem
icinga2页面——Configuration——Modules——graphite——enable
# mysql -u root -p'*******'
> create database graphite;
> grant all on graphite.* to graphite@'localhost' identified by 'graphite';
> flush privileges;
> quit
# vi /etc/graphite-web/local_settings.py
SECRET_KEY = 'kkksf' (此处乱码随便敲)
TIME_ZONE = 'Asia/Shanghai'
DATABASES= {
'default': {
'NAME': 'graphite',
'ENGINE': 'django.db.backends.mysql',
'USER': 'graphite',
'PASSWORD':'graphite',
'HOST': '127.0.0.1',
'PORT': '3306'
}
}
/usr/lib/python2.6/site-packages/graphite/manage.py syncdb
service carbon-cache start
vi /etc/icingaweb2/modules/graphite/config.ini (此处内容可从icinga2页面enable graphite处的configuration复制)
其中复制出来的有几个问题:
1:base_url = 要修改为base_url =
其中servername为graphite-web的服务地址
2:其中service_name_template 与host_name_template的设置必须与/etc/icinga2/features-enabled/graphite.conf里service_name_template 与host_name_template前面保持一致,要不会出现:No Data 不会出图
我的/etc/icingaweb2/modules/graphite/config.ini内容如下:
#######################
[graphite]
metric_prefix = icinga2
base_url =
legacy_mode = false
;if legacy mode is false (2.4 and newer):
service_name_template = "icinga2.$host.name$.service.$service.name$.$service.check_command$.perfdata.$metric$.value"
host_name_template = "icinga2.$host.name$.host.$host.check_command$.perfdata.$metric$.value"
;if legacy mode is true (pre 2.4):
;service_name_template = "icinga.$host.name$.services.$service.name$.$service.check_command$"
;host_name_template = "icinga.$host.name$.host.$host.check_command$"
;this template is used for the small image, macro $target$ can used.
graphite_args_template = "&target=$target$&source=0&width=300&height=120&hideAxes=true&lineWidth=2&hideLegend=true&colorList=049BAF"
;this template is used for the large image, macro $target$ can used.
;graphite_large_args_template = "&target=alias(color($target$_warn,'yellow'),'warning')&target=alias(color($target$_crit,'red'),'critical')&target=$target$&source=
#######################
我的/etc/icinga2/features-enabled/graphite.conf内容如下:
##############################
library "perfdata"
object GraphiteWriter "graphite" {
host = "127.0.0.1"
port = 2003
host_name_template = "icinga2.$host.name$.host.$host.check_command$"
service_name_template = "icinga2.$host.name$.service.$service.name$.$service.check_command$"
}
##############################
说明一下:base_url = 由于我是用Vbox做的测试,所以做了端口的转发,实际上应该是80端口
图出来了
阅读(3062) | 评论(0) | 转发(0) |