Centos7安装icinga2

本文发布时间: 2019-Mar-22
1. 通过 yum 安装icinga2 核心包a) Package Repositories# rpm --import http://packages.icinga.org/icinga.key# curl -o/etc/yum.repos.d/ICINGA-release.repohttp://packages.icinga.org/fedora/ICINGA-release.repo# yum makecacheb) Installing Icinga 2# yum install icinga2# systemctl enable icinga2# systemctl start icinga2c) Enabled Features during Installation# icinga2 feature list显示内容分为Disabled和Eabled 2个部分Disabledfeatures: api command compatlog debuglog graphite icingastatus ido-mysqlido-pgsql livestatus notification perfdata statusdata syslogEnabled features: checker mainlognotification2. 安装nagios-plugins-alla) 安装EPELEPEL,即Extra Packages for Enterprise Linux的简称,是为企业级Linux提供的一组高质量的额外软件包,包括但不限于Red Hat EnterpriseLinux (RHEL),# yum -y install epel-release# yum clean all && yum makecache# yum install nagios-plugins-all –y检查 /usr/lib/nagios/plugins or/usr/lib64/nagios/plugins 目录下,是否有相应的 plugin文件3. 运行icinga2$ systemctl status icinga2$ systemctl enable icinga2$ systemctl restart icinga2COMMANDDESCRIPTIONstartThe start action starts the Icinga 2 daemon.stopThe stop action stops the Icinga 2 daemon.restartThe restart action is a shortcut for running the stop action followed by start.reloadThe reload action sends the HUP signal to Icinga 2 which causes it to restart. Unlike the restart action reload does not wait until Icinga 2 has restarted.checkconfigThe checkconfig action checks if the /etc/icinga2/icinga2.conf configuration file contains any errors.statusThe status action checks if Icinga 2 is running.4. Setting up Icinga Web 2a) Configuring DB IDO MySQLThe DB IDO(Database Icinga Data Output) modules for Icinga 2 take care of exporting allconfiguration and status information into a database. The IDO database is usedby a number of projects including Icinga Web 2, Icinga Reporting or Icinga Web 1.xi. InstallingMySQL database server# yum install mariadb-server mariadb# systemctl enable mariadb# systemctl start mariadb# mysql_secure_installationii. Installingthe IDO modules for MySQL# yum install icinga2-ido-mysqliii. Settingup the MySQL database# mysql -u root -pmysql> CREATE DATABASE icinga;GRANT SELECT, INSERT, UPDATE, DELETE, DROP, CREATE VIEW, INDEX, EXECUTEON icinga.* TO 'icinga'@'localhost' IDENTIFIED BY 'icinga';Aftercreating the database you can import the Icinga 2 IDO schema using thefollowing command:# mysql -u root -p icinga </usr/share/icinga2-ido-mysql/schema/mysql.sqlThe package provides a new configuration filethat is installed in/etc/icinga2/features-available/ido-mysql.conf. You will need to update the databasecredentials in this file.iv. Enablingthe IDO MySQL module# icinga2 feature enable ido-mysqlModule 'ido-mysql' was enabled.Make sure to restart Icinga 2 for thesechanges to take effect.# systemctl restart icinga2b) 安装Webserver# yum install httpd# systemctl enable httpd# systemctl start httpdi. FirewallRules# firewall-cmd --add-service=http# firewall-cmd --permanent --add-service=httpii. 配置额外的命令通道Web接口和一些其它模块通过额外的命令通道来向Icinga2发送命令,你可以使用下面的命令启用它:# icinga2 feature enable command# systemctl restart icinga2默认情况下,icingacmd用户组拥有读写命令通道文件的权限,因此需要使用下面的命令将Web服务的用户加入到该组:$ usermod -a -G icingacmd apache以使用以下命令来检测是否成功将用户加入到icingacmd用户组:$ id apache显示 uid=48(apache) gid=48(apache) 组=48(apache),989(icingacmd)c) 安装icinga Web2# yum installicingaweb2 icingaclid) 配置icinga Web2你可以通过IcingaWeb2配置向导,或者直接通过执行命令来完成配置,本文仅介绍通过配置向导来完成配置,如果需要使用命令行来完成,请查看 Icinga Web 2官方文档。STEP1: 通过icingacli创建一个token,用来安装IcingaWeb2:icingacli setup token createicingacli setup token showSTEP 2: 使用浏览器访问 http://127.0.0.1/icingaweb2/setup (将IP替换为实际IP或域名),将上一步命令行得到的token输入到Steup Token的输入框中,继续下一步。ImageSTEP 3: 根据需要选择需要安装的模块,我这边选择了除翻译外的所有模块。ImageSTEP 4: 根据系统检查结果,解决需要修改的项,全部完成后刷新确认。Image本例中,需要解决的有PHP时区,LDAP,PDO-MySQL,PDO-PostgreSQL问题。PDO-MySQL,PDO-PostgreSQL只需要重启Web服务器即可解决。修改PHP时区:使用 vi打开 /etc/php.ini;查找date.timezone,删除最前面的分号,在结尾增加时区标签,这里使用: Asia/Shanghai 。启用LDAP:yum install php-ldap重启Web服务器,CentOS7直接使用systemctl restart httpd 重启。如果出现 The directory /etc/icingaweb2 is not writable.就关闭SELINUX现在界面上所有的状态应该都已经变成了绿色,继续下一步吧,后面没有特别讲到的步骤都是直接点击下一步的!STEP 5: 配置Icinga Web2数据库Image此处直接填写我们创建的icingaweb2数据库的信息,默认情况下用户名和密码都是icingaweb2。由于我们并没有给予icingaweb2用户创建表的权限,因此你还需要给一个有创建数据库和表权限的用户。ImageSTEP 6: 创建一个Icinga Web2的管理员账号ImageSTEP 7: 配置IcingaIDO数据库信息Image此处直接填写我们创建的icinga数据库的信息,默认情况下用户名和密码都是icinga。(这些信息是和设置mysql数据库的操作步骤的时候填写的信息所对应)如果出现 /usr/share/icingaweb2/etc/schema/mysql.schema.sql文件没有发现的错误,就运行# cp /usr/share/doc/icingaweb2/schema/mysql.schema.sql /usr/share/icingaweb2/etc/schema/登录!Image


(以上内容不代表本站观点。)
---------------------------------
本网站以及域名有仲裁协议。
本網站以及域名有仲裁協議。

2024-Mar-04 02:08pm
栏目列表