Use SNMP and Cacti to monitor Linux servers

Source: Internet
Author: User
Tags snmpwalk

Use SNMP and Cacti to monitor Linux servers

SNMP (Simple Network Management Protocol) is used to collect internal data, such as load, disk status, and bandwidth. Network monitoring tools such as Cacti use this data to generate icons for monitoring purposes.

In a typical Cacti and SNMP deployment, one or more SNMP-enabled devices and an independent monitoring server are used to collect SNMP feedback from those devices. Remember that SNMP must be enabled for all devices to be monitored. For demonstration purposes, we will configure Cacti and SNMP on the same Linux server.

 

Configure SNMP On Debian or Ubuntu

To install the SNMP proxy (snmpd) on a Debian-based system, run the following command:

  1. root@server:~# apt-get install snmpd

Then, edit the configuration file as follows.

  1. root@server:~# vim /etc/snmp/snmpd.conf
  1. # Enable snmpd to listen to all interfaces
  2. agentAddress udp:161
  3. # Define a read-only community 'mycommuni' and the source network
  4. rocommunity myCommunity 172.17.1.0/24
  5. sysLocation Earth
  6. sysContact email@domain.tld

After editing the configuration file, restart snmpd.

  1. root@server:~# service snmpd restart

 

Configure SNMP on CentOS or RHEL

To install the SNMP tool and library, run the following command.

  1. root@server:~# sudo yum install net-snmp

Then, edit the SNMP configuration file as follows.

  1. root@server:~# vim /etc/snmp/snmpd.conf
  1. # Define a user 'myuser' who uses the community 'mycluster' and the source network 172.17.1.0/24'
  2. com2sec myUser 172.17.1.0/24 myCommunity
  3. # Add myUser to the 'mygroup' group and define Group Permissions
  4. group myGroup v1 myUser
  5. group myGroup v2c myUser
  6. view all included .1
  7. access myGroup "" any noauth exact all all none
  1. root@server:~# service snmpd restart
  2. root@server:~# chkconfig snmpd on

Restart the snmpd service and add it to the startup service list.

 

Test SNMP

SNMP can be tested by running the snmpwalk command. If SNMP has been configured successfully, this command will generate a large amount of output.

  1. root@server:~# snmpwalk -c myCommunity 172.17.1.44-v1
  1. iso.3.6.1.2.1.1.1.0= STRING:"Linux mrtg 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64"
  2. iso.3.6.1.2.1.1.2.0= OID: iso.3.6.1.4.1.8072.3.2.10
  3. iso.3.6.1.2.1.1.3.0=Timeticks:(2097)0:00:20.97
  4. ~~ Output truncation ~~
  5. iso.3.6.1.2.1.92.1.1.2.0=Gauge32:1440
  6. iso.3.6.1.2.1.92.1.2.1.0=Counter32:1
  7. iso.3.6.1.2.1.92.1.2.2.0=Counter32:0
  8. iso.3.6.1.2.1.92.1.3.1.1.2.7.100.101.102.97.117.108.116.1=Timeticks:(1)0:00:00.01
  9. iso.3.6.1.2.1.92.1.3.1.1.3.7.100.101.102.97.117.108.116.1=Hex-STRING:07 DD 0B12003927002B0600

 

Configure Cacti with SNMP

In this tutorial, we will set Cacti and SNMP on the same Linux server. Therefore, go to the Linux server configured with SNMP to [install Cacti] [2.

After the installation, the Cacti web page can be accessed through "http: // 172.17.1.44/cacti". Of course, in your environment, replace the IP address with the address of your server.

The Cacti path is generally correct during installation, but if necessary, check the following again.

During the first installation, the default username and password of Cacti are "admin" and "admin ". After the first login, you will be forced to change the password.

 

Add a device to Cacti and manage it

Cacti registers the device based on the previously configured SNMP string. In this tutorial, we will add only local servers with SNMP enabled.

To add a device, log on as an administrator and go to the console in the Cacti administrator panel. Click Console> device.

There may already be a device named 'localhost. We don't need it because we need to create a new chart. You can delete this device from the list and use the Add button to add a new device.

Next, set the device parameters.

Now that the device has been added, you can specify the chart template you want to create. You can find the content in the last part of the page.

Then, we will continue to create charts.

Here, we create a chart for average load, RAM, hard disk, and processor.

 

Interface charts and 64-bit counters

By default, Cacti uses 32-bit counters in SNMP queries. The 32-bit counter is sufficient for most bandwidth charts, but it is powerless for bandwidth exceeding Mbps. If you already know that the bandwidth will exceed 100 Mbps, we recommend that you use a 64-bit counter. It is not troublesome to use a 64-bit counter.

Note: It takes about 15 minutes for Cacti to generate new charts. You have no choice but to wait patiently.

 

Create a chart tree

These show how to create a chart tree and how to add a chart to the tree.

We can verify the chart in the chart tree.

 

User Management

Finally, we create a user who only has the permission to view the chart we just created. Cacti has a built-in user management system and is highly customizable.

After completing these steps, we can use 'user1' to log in and verify that only the user can view the chart.

So far, we have deployed a Cacti server in the network monitoring system. The Cacti server is relatively stable and can process a large number of charts without any problems.

I hope this article will help you.

-------------------------------------- Split line --------------------------------------

In RHEL6.4, the Cacti + Spine monitoring host is used to send mail alarms.

Use Cacti + Spine to monitor remote hosts in RHEL6.4

CentOS 5.5 complete installation of Cacti + Spine

Cacti construction document under CentOS 6

Detailed description of Cacti monitoring deployment under RHEL5.9

How to install Cacti in CentOS 6.3

Quick installation and configuration of Cacti in CentOS Linux

-------------------------------------- Split line --------------------------------------

Cacti details: click here
Cacti: click here

Via: http://xmodulo.com/monitor-linux-servers-snmp-cacti.html

Author: Sarmed Rahman Translator: GOLinux Proofreader: wxy

This article was originally translated by LCTT and launched with the Linux honor in China

This article permanently updates the link address:

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.