下载地址:https://github.com/findmypast/icingaweb2-module-graphite
需要下载安装的软件:Django、django-tagging、pyparsing、python-whisper、pytz、mod_wsgi、python-carbon、python-twisted-core、python-zope-interface、python-zope-filesystem
软件安装略(rpm -i)
# unzip icingaweb2-module-graphite-master.zip
# mv icingaweb2-module-graphite /usr/share/icingaweb2/modules/graphite
# icinga2 feature enable graphite
icinga2页面——Configuration——Modules——graphite——enable
# mysql -u root -p‘*******‘
> create database graphite;
> grant all on graphite.* to [email protected]‘localhost‘ identified by ‘graphite‘;
> flush privileges;
> quit
# vi /etc/graphite-web/local_settings.py
SECRET_KEY = ‘jksjflsjfk‘ (此处乱码随便敲)
TIME_ZONE = ‘Asia/Shanghai‘
DATABASES= {
‘default‘: {
‘NAME‘: ‘graphite‘,
‘ENGINE‘: ‘django.db.backends.mysql‘,
‘USER‘: ‘graphite‘,
‘PASSWORD‘:‘graphite‘,
‘HOST‘: ‘127.0.0.1‘,
‘PORT‘: ‘3306‘
}
}
:wq
# /usr/lib/python2.6/site-packages/graphite/manage.py syncdb
中间输入个账号、邮箱、密码 (后面登录用的,不登录也行)
# service carbon-cache start
# mkdir /etc/icingaweb2/modules/graphite
# vi /etc/icingaweb2/modules/graphite/config.ini (此处内容可从icinga2页面enable graphite处的configuration复制)
[graphite]
metric_prefix = icinga2
base_url = http://zlinux3.ming.com/render?
legacy_mode = false
;if legacy mode is false (2.4 and newer):
service_name_template = "icinga2.$host.name$.services.$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.
:wq
# service httpd restart
# service icinga2 restart
此时到icinga2页面上看图像已经是graphite在显示了