Cacti monitor host disk, CPU, memory usage

Source: Internet
Author: User
Tags rrdtool snmp snmp error

#########################################################
# # # # Lnamp Environment Building # #
#########################################################
Slightly

#########################################################
# # # RRDtool Installation # #
#########################################################
RRDtool installation (I use Yum installation here)
[Email protected]_web1 ~]# yum-y Install RRDtool

#########################################################
# # # SNMP Installation and Testing # #
#########################################################
A) Install Net-snmp (also with Yum installation)
[Email protected]_web1 ~]# yum-y install NET-SNMP net-snmp-libs net-snmp-utils
II) Change the configuration file
[[Email Protected]_web1 ~]# cp-a/etc/snmp/snmpd.conf/etc/snmp/snmpd.conf.bak # back up before modifying the configuration file]
[[Email Protected]_web1 ~]# vi/etc/snmp/snmpd.conf # Modify config file--here I'll first delete all the information in the original config file and rewrite it
# 1 The first choice is to define a community name (community--This can be understood as a plaintext password), here is Snmppass, and can use Snmppass this password username (sec name), here is Snmpuser. Snmppass equivalent to user snmpuser password:)
# Sec.name Source Community
Com2sec snmpuser Default Snmppass

# 2 Define a group name (GroupName) Here is the Snmpgroup, and the security level of the group V2C, add snmpuser This user to this group
#groupName Securitymodel Securityname
Group Snmpgroup v2c Snmpuser

# 3 The basic syntax for creating a View,view is "view NAME TYPE subtree [MASK]". Here we take the system running time for example. 1.3.6.1.2.1.1.3.0
View Snmpview include. 1.3.6.1.2.1.1.3.0
View Snmpview included. 1 # 1 stands for. 1 All that starts with
# like the one above means giving snmpview this view is able to view. 1.3.6.1.2.1.1.3.0 permissions for all nodes below.

# 4 The last thing to do is to set which groups of people, which view users can do what specific things, with access to set, the basic syntax is "Access NAME CONTEXT MODEL level Prefx READ WRITE NOTIFY".
# Group Context Sec.model sec.level prefix read Write Notif
Access Snmpgroup "" Any noauth exact snmpview snmpview None

Following the removal of the configuration file comments after the rewrite
# Sec.name Source Community
Com2sec snmpuser Default Snmppass

# GroupName Securitymodel Securityname
Group Snmpgroup v1 Snmpuser
Group Snmpgroup v2c Snmpuser

# Name INCL/EXCL subtree mask (optional)
View Snmpview included. 1.3.6.1.2.1.1
View Snmpview included. 1.3.6.1.2.1.25.1.1
View Snmpview included. 1

# Group Context Sec.model sec.level prefix read Write Notif
Access Snmpgroup "" Any noauth exact snmpview none None
III) Start-up service
[[Email protected]_web1 ~]# service snmpd Restart # restart SNMPD

IV) Testing
[Email protected]_web1 ~]# snmpwalk-v 2c-c snmppass localhost. 1.3.6.1.2.1.1.5.0 # to test for success by getting a host name
snmpv2-mib::sysname.0 = string:vm_web1 # Get the VM_WEB1 description has been successful

V) Install the SNMP php extension
[Email protected]_web1 config]# yum-y Install Php-snmp

############################################################################################################### ##
# # # Cacti Installation and testing if the source package configuration is not successful can be installed using yum-y install cacti # #
############################################################################################################### ##
A) Download cacti compression Package decompression
[Email protected]_web1 software]# TAR-ZXVF cacti-0.8.8b.tar.gz

II) Configure an Apache virtual host to use for cacti monitoring
[Email protected]_web1 sites-available]# VI apache_main.conf
<virtualhost *:8080>
Documentroot/data/wwwroot/web/cacti.me
Errorlog "/data/wwwroot/log/www.cacti.me-apache-error.log"
Customlog/data/wwwroot/log/www.cacti.me-apache-access.log
ServerName www.cacti.me
<directory "/data/wwwroot/web/cacti.me" >
AllowOverride All
Order Allow,deny
Allow from all
</Directory>
</VirtualHost>
[Email protected]_web1 web]# ln-s/data/conf/sites-available/apache_main.conf/data/conf/sites-enabled/

c) Copy the cacti code to the specified folder and modify the permissions
[Email protected]_web1 sites-available]# cd/data/wwwroot/web/
[Email protected]_web1 web]# mkdir cacti.me
[Email protected]_web1 web]# cd/data/wwwroot/web/cacti.me/
[Email protected]_web1 cacti.me]# cp-a/data/software/cacti-0.8.8b/*.
[Email protected]_web1 cacti.me]# chown-r www:www./*

IV) Create a cacti database
[Email protected]_web1 cacti.me]# mysql-u root-p123456
MariaDB [(None)]> CREATE Database cactidb;
Query OK, 1 row Affected (0.00 sec)

MariaDB [(None)]> use CACTIDB;
Database changed
MariaDB [cactidb]> Source/data/wwwroot/web/cacti.me/cacti.sql; # import data

MariaDB [cactidb]> GRANT all on cactidb.* to [e-mail protected] identified by ' Cactiuser '; # Create a MySQL user dedicated to manipulating the CACTIDB database
Query OK, 0 rows affected (0.04 sec)

V) Modify the Cacti.me related profile code
[Email protected]_web1 ~]# cd/data/wwwroot/web/cacti.me/include/
[[Email Protected]_web1 include]# VI config.php # Modify config file]
$database _type = "MySQL";
$database _default = "CACTIDB";
$database _hostname = "localhost";
$database _username = "Cactiuser";
$database _password = "Cactiuser";
$database _port = "3306";
$database _ssl = false;

/*
Edit this to point to the default URL of your Cacti install
Ex:if your cacti install as at Http://serverip/cacti/this
would be set to/cacti/
*/
$url _path = "/cacti/";
$url _path = "/"; This is a very important line. Set the Cacti Program Access path

VI) Installation initialization
Bind the host file access on the XP system
192.168.1.244 www.cacti.me

1 Enter www.cacti.me:8080 directly on the Web browser (my Apache is on port 8080) and jump to http://www.cacti.me:8080/install/
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/F6/wKiom1WM8YrioJwhAAJ4htVQjUs800.jpg "title=" 1.png " alt= "Wkiom1wm8yriojwhaaj4htvqjus800.jpg"/>
2 Click Next to select New install and tap Next

3 appears 2 page, fill in

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/F6/wKiom1WM8avC6qydAAQKg0_tBPo871.jpg "title=" 2.png " alt= "Wkiom1wm8avc6qydaaqkg0_tbpo871.jpg"/>

。 Click Finish

4 appearance

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/F3/wKioL1WM832y3fDLAADesxAPh2g501.jpg "title=" 3.png " alt= "Wkiol1wm832y3fdlaadesxaph2g501.jpg"/>

The login page shown. The default user name and password are admin

5 Require mandatory change password after login I changed it to admin123456.

6 After changing the password, we entered the cacti management interface.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6E/F6/wKiom1WM8c_Tg3JLAAIQcsxWLUM725.jpg "title=" 4. PNG "alt=" wkiom1wm8c_tg3jlaaiqcsxwlum725.jpg "/>

##################################################### #######
###                     Use of cacti                               #
############################################################
Assume that the server being monitored here is named Vm_web1 Ip:ip address 127.0.0.1 (self-monitoring), SNMP community is snmppass.
Enter the console panel of the cacti->
Click "Devices" to enter the device panel-> 

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/F6/wKiom1WM8d_A8GVxAALPzSeQ2W8490.jpg "title=" 5.png " alt= "Wkiom1wm8d_a8gvxaalpzseq2w8490.jpg"/>
Click Add to add a new device. Specific parameters fill 650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6E/F6/wKiom1WM8eyB-f-NAAR4PRa2Ms4440.jpg "title=" 6.png "alt=" Wkiom1wm8eyb-f-naar4pra2ms4440.jpg "/>
Click Create to save the information. If there is no problem with the SNMP connection, the server information appears in the upper-left corner, or SNMP error occurs. If there is no error message, the page will appear below:

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6E/F6/wKiom1WM8gPQQRyZAALAZZkB_o8110.jpg "title=" 7.png " alt= "Wkiom1wm8gpqqryzaalazzkb_o8110.jpg"/>

Some of the options shown. Here we select information such as CPU memory load mount points. Click Save


Click New Graphs on the left to enter

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6E/F3/wKioL1WM89DCSPbBAALfGez6nQw381.jpg "title=" 8.png " alt= "Wkiol1wm89dcspbbaalfgez6nqw381.jpg"/>

The page shown in the

. Tick the item you want to draw. Click Create

, click Graph Trees, go to the Graph Trees panel, click Add, and select the graph Trees and choose the item you want to draw in this graph Trees



######### ###################################################
##             Use crontab to make cacti automatic drawing                       #
############################################################

Chown-r www:www/data/ wwwroot/web/cacti.me

su-l www
/usr/bin/php  /data/wwwroot/web/cacti.me/poller.php  # Manual access to see if there is an error message

# If there is no error message
vi/etc/crontab   # Add the following line
*/5 * * * *  WWW/USR/BIN/PHP/DATA/WW wroot/web/cacti.me/poller.php &>/dev/null # Let cacti automatically draw

If there are no errors, you can see the

after a while.

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6E/F3/wKioL1WM8-SwWko8AAUMbtpIGkQ972.jpg "title=" 9.png " alt= "Wkiol1wm8-swwko8aaumbtpigkq972.jpg"/> The image shown


# Note If manual access is wrong. See if the disable_functions Open_basedir set up in php.ini has a problem setting














Cacti monitor host disk, CPU, memory usage

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.