icinga2 php模块,Icinga2+Influxdb+Grafana搭建

Icinga2+Influxdb+Grafana搭建

注:可不要icingaweb2(即无icinga2页面),Icinga2要求2.5版本以上

不过安装icingaweb2可方便排错,步骤略,需要php和mysql

icinga2下载网址:http://packages.icinga.org/epel/

influxdb下载网址:https://dl.influxdata.com/influxdb/releases/influxdb-1.3.6.x86_64.rpm

Grafana下载网址:https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-4.5.2-1.x86_64.rpm

Icinga2安装步骤:

需要的包:libboost_system1、libboost_thread1、libboost_regex1、boost-license1、libboost_program_options1、icinga2、icinga2-bin、icinga2-common、icingacli、nagios-plugins

安装httpd:

# yum install httpd

额外包:fping、perl-NET-SNMP、perl-Crypt-DES  (需先下载好)

# rpm -i libboost* boost-license (需先下载好)

# rpm -i icinga2*     (需先下载好)

# rpm -i perl-Crypt-DES perl-NET-SNMP fping perl-Digest-SHA1 perl-Digest-HMACperl-Socket6

# rpm -i nagios-plugins-1.4.16-1.el6.rf.x86_64.rpm

# chkconfig icinga2 --level 35 on

Influxdb安装步骤:

# rpm -i influxdb-1.3.6.x86_64.rpm    (端口8086)

配置文件路径:/etc/influxdb/influxdb.conf

数据存放路径:/var/lib/influxdb/data

日志路径:/var/log/influxdb/

# service influxdb start

# chkconfig influxdb --level 35 on

# influx

> create database icinga2;

> create user icinga2 with password 'xxxx';

> grant all on icinga2 to icinga2;

>quit

influxdb默认保留数据为168小时(即7天),调整为1年命令:

> show retention policies on icinga2;  (查看保留策略)

> alter retention policy "autogen" on "icinga2" duration 365d default;  (对已有策略进行修改)

# vi /etc/icinga2/features-enabled/influxdb.conf

library "perfdata"

object InfluxdbWriter "influxdb" {

host = "127.0.0.1"

port = 8086

database = "icinga2"

host_template = {

measurement = "$host.check_command$"

tags = {

hostname = "$host.name$"

}

}

service_template = {

measurement = "$service.check_command$"

tags = {

hostname = "$host.name$"

service = "$service.name$"

}

}

enable_send_thresholds = true

enable_send_metadata = true

}

:wq

# icinga2 feature enable influxdb

# service icinga2 restart

Granfana安装步骤:

# rpm -i grafana-4.5.2-1.x86_64.rpm    (端口3000)

# service grafana-server start

# chkconfig grafana-server --level 35 on

访问http://ip:3000  默认用户名、密码均为admin

Data Sources:Name:icinga2(可改) Type:InfluxDB Url:http://ip:8086 Access:proxy Database:icinga2 User:icinga2 Password:xxxxx

具体icinga2配置和grafana面板配置略

Grafana求多台服务器平均值:

面板——Graph——Metrics——Toggle Edit Mode:

SELECT mean("value") FROM "nrpe-mem" WHERE "hostname" =~ /shhu*/  and "metric" = 'Per' AND $timeFilter GROUP BY time($interval)

icinga influxdb面板下载网址:

记得icinga2中需启用ping4监控(该面板依据ping4抓取服务器名)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值