CENTOS7 installation of cacti and Nagios

Source: Internet
Author: User
Tags openssl rrdtool snmp symlink

CENTOS7 installation of cacti and Nagios

Cacti

First, the environment is ready

0. Setup host name, SELINUX, fire wall and time zone

[[email protected] ~]# hostnamectl set-hostname nms01[[email protected] ~]# Getenforcedisabled[[email protected] ~]# time Datectl set-timezone asia/shanghai[[email protected] ~]# systemctl stop firewalld.service[[email protected] ~]# Systemctl Disable Firewalld.service


1. Installation httpd

[[email protected] ~]# Yum install httpd httpd-devel-y[[email protected] ~]# systemctl enable httpd.servicecreated Symlin K From/etc/systemd/system/multi-user.target.wants/httpd.service To/usr/lib/systemd/system/httpd.service. [Email protected] ~]# systemctl start Httpd.service


2. Install and setup the MARIADB

[[email protected] ~]# Yum install mariadb mariadb-server mariadb-devel-y[[email protected] ~]# vi/etc/my.cnf.d/cacti.cn f[mysqld]bind-address = 10.0.0.103default-storage-engine = Innodbinnodb_file_per_tablemax_connections = 4096collation-server = Utf8_general_cicharacter-set-server = UTF8
[Email protected] ~]# systemctl enable mariadb.servicecreated symlink from/etc/systemd/system/ Multi-user.target.wants/mariadb.service To/usr/lib/systemd/system/mariadb.service. [Email protected] ~]# systemctl start mariadb.service[[email protected] ~]# mysql_secure_installation [[Email protected ] ~]# [[email protected] ~]# mysql-uroot-penter password:mariadb [(none)]> CREATE database cacti; Query OK, 1 row Affected (0.00 sec) MariaDB [(none)]> grant all on cacti.* to [e-mail protected] identified by ' cacti '; Query OK, 0 rows Affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows Affected (0.00 sec)


3. Install PHP

[email protected] ~]# Yum install php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli-y


4. Installation of PHP-SNMP, NET-SNMP

[email protected] ~]# Yum install php-snmp net-snmp-utils net-snmp-libs net-snmp-devel-y[[email protected] ~]# Systemctl Enable snmpd.servicecreated symlink From/etc/systemd/system/multi-user.target.wants/snmpd.service to/usr/lib/ Systemd/system/snmpd.service. [Email protected] ~]# systemctl start Snmpd.service


5. Installation RRDtool

[email protected] ~]# Yum install rrdtool-y



Second, download the installation cacti

[[email protected] ~]# yum install wget gcc  -y[[email protected]  ~]# wget http://www.cacti.net/downloads/cacti-0.8.8h.tar.gz[[email protected] ~]#  tar -xvf cacti-0.8.8h.tar.gz -c /usr/local/[[email protected] local]#  ln -s cacti-0.8.8h cacti[[email protected] local]# vi cacti/include/ config.php  $database _type =  "MySQL"; $database _default =  "cacti"; $database _hostname  =  "localhost"; $database _username =  "cacti"; $database _password =  "cacti"; $ database_port =  "3306"; $database _ssl = false; [[email protected] local]# useradd cacti -d /usr/local/cacti[[email  Protected] local]# chown -r cacti /usr/local/cacti/[[email protected] local ]# chgrp -r cacti /usr/local/cacti[[email protected]&nbSp;local]# chmod -r 755 /usr/local/cacti/[[email protected] local]# mysql  -ucacti -p cacti </usr/local/cacti/cacti.sql enter password: ########## #########################################################[root~]# firewall-cmd --permanent -- zone=public --add-service=http[root~]# firewall-cmd --reload ############################# ######################################[[email protected] local]# vi /etc/httpd/conf.d/ cacti.confalias /cacti    /usr/local/cacti   <directory /usr/ Local/cacti/>         <ifmodule mod_authz_core.c>  # httpd 2.4 Require all granted          </ifmodule> <ifmodule !mod_authz_core.c> # httpd 2.2 order  deny,allow deny from all allow from all         </ ifmodule></directory> [[email protected] local]# systemctl restart  httpd.service[[email protected] local]# vi /etc/cron.d/cacti*/5 * * *  *    cacti   /usr/bin/php /usr/local/cacti/poller.php > / Dev/null 2>&1


Web Page Setup

http://10.0.0.103/cacti/install/



Third, download the installation spine

[[email protected] ~]# wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8h.tar.gz [[email protected] ~]# tar zxvf cacti-spine-0.8.8h.tar.gz[[email protected]  ~]# cd cacti-spine-0.8.8h[[email protected] cacti-spine-0.8.8h]# ./configure  [[email protected] cacti-spine-0.8.8h]# make[[email protected]  cacti-spine-0.8.8h]# make install[[email protected] ~]# cp /usr/local/spine/etc/ spine.conf.dist /usr/local/spine/etc/spine.conf[[email protected] ~]# vi /usr/local/ spine/etc/spine.confdb_host         localhostdb_database      cactiDB_User         cactiDB_Pass          cactiDB_Port          3306[[email protected] ~]# /usr/local/spine/bin/spine 09/02/2016 04:58:04 PM - SPINE: Poller[0]  fatal: unable to read configuration file!  (Spine init) [[email  Protected] ~]# cp /usr/local/spine/etc/spine.conf /etc/spine.conf[[email protected]  ~]# /usr/local/spine/bin/spine spine: using spine config file [/etc/ Spine.conf]spine: version 0.8.8h startingspine: time: 0.0961 s, threads:  5, hosts: 2


Other

1. View the file belongs to that bag

[email protected] local]# Yum provides snmpwalk




Nagios

1. Installation Dependency Pack

[[email protected] ~]# yum install httpd php php-cli gcc glibc glibc-common gd gd-devel net-snmp openssl-devel wget Unzip -Y

2. Create user and Group

[Email protected] ~]# useradd nagios[[email protected] ~]# groupadd nagcmd[[email protected] ~]# usermod-a-G nagcmd nag Ios[[email protected] ~]# usermod-a-G nagcmd Apache


3. Download Nagios and Nagios-plugins

[Email protected] ~]# wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz[[email Protected] ~]# wget http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz

4. Decompression installation Nagios

[[Email protected] ~]# tar zxvf nagios-4.1.1.tar.gz[[email protected] ~]# CD Nagios-4.1.1[[email protected] nagios-4.1.1] #./configure--with-command-group=nagcmd[[email protected] nagios-4.1.1]# make All[[email protected] nagios-4.1.1]# Make Install[[email protected] nagios-4.1.1]# make Install-init[[email protected] nagios-4.1.1]# make install-config[[ Email protected] nagios-4.1.1]# make Install-commandmode[[email protected] nagios-4.1.1]# make install-webconf

5. Modify the httpd.conf file

[Email protected] ~]# vi/etc/httpd/conf/httpd.conf<ifmodule dir_module> directoryindex index.html,index.php& Lt;/ifmodule>


6. Create a Web user name and password

[Email protected] ~]# htpasswd-c/usr/local/nagios/etc/htpasswd.users nagiosadminnew password:re-type New Password:ad Ding password for user nagiosadmin


7. Installation Nagios-plugins

[Email protected] ~]# tar xf nagios-plugins-2.1.1.tar.gz [[email protected] ~]# CD Nagios-plugins-2.1.1[[email protected ] nagios-plugins-2.1.1]#./configure--with-nagios-user=nagios--with-nagios-group=nagios--with-openssl[[email Protected] nagios-plugins-2.1.1]# make All[[email protected] nagios-plugins-2.1.1]# make install


8. Activate the service and set the self-activation

[[email protected] ~]# systemctl start httpd.service[[email protected] ~]# systemctl enable Httpd.service[[email protecte         D] ~]# service Nagios start[[email protected] ~]# chkconfig nagios on[[email protected] ~]# chkconfig Nagios--listnagios 0:off1:off2:on3:on4:on5:on6:off


9. If the fire wall is not closed, make the following configuration

[Email protected] ~]# firewall-cmd--zone=public--add-port=80/tcp--permanent[[email protected] ~]# firewall-cmd-- Reload



10. Visit the Certificate

http://10.0.0.103/nagios/


This article is from the "Eshin" blog, make sure to keep this source http://eshin.blog.51cto.com/422646/1850695

CENTOS7 installation of cacti and Nagios

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.