Cacti heavy graphics, data history, need to database support, support Web configuration, default does not support alarm, can add plug-ins;
Nagios heavy status and results, no data history, no image, no web configuration, can develop scripts to customize personalized monitoring, support a variety of plug-ins;
Zabbix has data history, can be image, support Web configuration, can be automatically discovered;
The first part: monitoring software cacti Building
First, the Environment preparation
1. Install Epel extension Source
Turn off SELinux
Temporary shutdown Setenforce 0
Vim/etc/selinux/config
Selinux=disbabled
|
1 |
[[email protected] ~]# yum install -y epel-release
|
2. Build Lamp Environment
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21st
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 |
[[email protected] ~]# yum install -y httpd php php-mysql mysql mysql-server mysql-devel php-gd libjpeg libjpeg-devel libpng-devel
[[email protected] ~]# /etc/init.d/httpd start
正在启动 httpd: [确定]
[[email protected] ~]# /etc/init.d/mysqld start
初始化 MySQL 数据库: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot timeyou have to copy
support-files/mysql.server to the right place foryour system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To doso, start the server, thenissue the following commands:
/usr/bin/mysqladmin-u root password ‘new-password‘
/usr/bin/mysqladmin-u root -h cacti password ‘new-password‘
Alternatively you can run:
/usr/bin/mysql_secure_installation
whichwill also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended forproduction servers.
See the manual formoreinstructions.
You can start the MySQL daemon with:
cd/usr ; /usr/bin/mysqld_safe&
You can testthe MySQL daemon with mysql-test-run.pl
cd/usr/mysql-test; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbugscript!
[确定]
正在启动 mysqld: [确定]
|
3, install cacti monitoring host
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21st
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38 |
[[email protected] ~]# yum install -y cacti net-snmp net-snmp-utils rrdtool net-snmp-devel net-snmp-libs lm-sensors php-xml zlib libpng freetype cairo-devel pango-devel gd
[[email protected] ~]# /etc/init.d/snmpd start
正在启动 snmpd: [确定]
[[email protected] ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection idis 4
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, Oracle and/orits affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/orits
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;‘or ‘\h‘ for help. Type ‘\c‘ to clearthe current input statement.
mysql> create database cacti;
mysql> grant all on cacti.* to ‘cactiuser‘@‘localhost‘identified by ‘cactiuser‘;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[[email protected] ~]# mysql -u root cacti < /usr/share/doc/cacti-0.8.8b/cacti.sql
[[email protected] ~]# vim /usr/share/cacti/include/config.php
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactiuser";
$database_port = "3306";
$database_ssl = false;
[[email protected] ~]# vim /etc/httpd/conf.d/cacti.conf
Deny from all 修改为 Allow from all
[[email protected] ~]# /etc/init.d/httpd restart
停止 httpd: [确定]
正在启动 httpd: [确定]
|
4. Access via browser
If access is not available, please check the host's iptables and SELinux
http://IP/cacti/
Click "Next" and "Finish" at two.
Enter Admin Admin login, reset new password
5 Viewing the default host
Perform poller.php, generate graphs, join scheduled Tasks
/usr/bin/php/usr/share/cacti/poller.php adding cron Tasks
CRONT-E Increase:
*/5 * * * */usr/bin/php/usr/share/cacti/poller.php
6 adding a host that needs to be monitored
Next we add the monitored host
在被监控的主机上安装
[[email protected] ~]# yum install -y net-snmp lm_sensors[[email protected] ~]# vim /etc/snmp/snmpd.conf#syslocation Unknown (edit /etc/snmp/snmpd.conf)syslocation 192.168.1.118#group context sec.model sec.level prefix read write notifaccess notConfigGroup ""any noauth exact all none none view all included .1 80 [[email protected] ~]# /etc/init.d/snmpd start
Modify Syslocation and Syscontact, where syslocation can write a machine ip,syscontact writing the admin mailbox
View SystemView included. 1.3.6.1.2.1.1
Modified to:
View SystemView included. 1.3.6.1.2.1 (you may not find the NIC if you do not change it)
7 Starting SNMP
/ETC/INIT.D/SNMPD start
8 Management cacti Backstage
Click Console, click Device, and in the upper right corner, click "Add"
Description Write machine IP or you customize a name
Hostname Machine IP
Host Template Select Ucd/net SNMP Host
Version 2 of SNMP version selected
Click Create in the lower right corner
In the top right corner, click "Create Graphs for this Host"
Graph Types: Select Snmp-interface Statistics
Graph Types: Then choose graph Template Based
In the box below, select the items you want to monitor, such as Ucd/net-load Average
Tick the right small square, then click Create in the lower right corner
9 Add real-time monitoring background
Select "Default Tree"
Click Add in the upper right corner
Tree Item Type Select "Host"
Host Select the machine IP that we just added
Click Create in the lower right corner
10 o ' graphs in the upper left corner
On the left you can see
The Defaut tree below has added the host we just added, the graphics will not come out so quickly at first, it will be a little while.
Reference article: http://www.it165.net/admin/html/201310/1956.html
Cacti Installing efficient spine (RPM)
The cacti default polling cmd.php performs a bit less efficiently, spine components written in C for a much better performance.
The following software support is required to compile and install spine:
1 net-snmp-devel
2 MySQL
3 Mysql-devel
4 Openssl-devel
5 gcc
Install spine to match the cacti version, this article takes the latest version of the cacti0.8.8a installation as an example.
1 cd/usr/local/src/
2 wgethttp://www.cacti.net/downloads/spine/cacti-spine-0.8.8a.tar.gz
3 TAR-ZXVF cacti-spine-0.8.8a.tar.gz
4 CD cacti-spine-0.8.8a
Compile:
5./configure
6 Make && make instatll
Configuration spine:
1 cd/usr/local/spine/etc/
2 MV Spine.conf.dist
/etc/spine.conf
3 VI spine.conf
Fill in the database information, i.e. the cacti database.
Db_host localhost
Db_database cacti
Db_user Root
Db_pass cacti
Db_port 3306
Set Spine path, console--settings--paths
Cacti Setting Spine path
/usr/local/spine/bin/spine
Change the cacti poll to Spine,console--settings--poller
Cacti changing the spine of the polling device
Run:
#/usr/local/spine/bin/spine
spine:using SPINE config file [/etc/spine.conf]
Spine:version 0.8.7g Starting
spine:time:0.2410 s, Threads:5, Hosts:2
Note: Spine default profile needs to be placed in/etc to take effect, otherwise the following error is reported:
SPINE:POLLER[0] fatal:unable to read configuration file! (Spineinit)
This article is from the "Learn Linux" blog, so be sure to keep this source http://linuxlearn.blog.51cto.com/1437234/1720692
Monitoring Cacti/nagios/zabbix (i) cacti