To begin with always make sure your system is up2date:
sudo apt-get updateNow that we have that out of the way, make sure your system has SNMPD installed:
sudo apt-get upgrade
sudo apt-get install snmp snmpdNow that it is installed, we need to do a bit of configuration to it. Run:
sudo nano /etc/default/snmpdand you'll see something like:
# This file controls the activity of snmpd and snmptrapdMake sure that you change:
# MIB directories. /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
export MIBDIRS=/usr/share/snmp/mibs
# snmpd control (yes means start daemon).
SNMPDRUN=yes
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid'
# snmptrapd control (yes means start daemon). As of net-snmp version
# 5.0, master agentx support must be enabled in snmpd before snmptrapd
# can be run. See snmpd.conf(5) for how to do this.
TRAPDRUN=no
# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
# create symlink on Debian legacy location to official RFC path
SNMPDCOMPAT=yes
SNMPDRUN from No to Yes, and you remove the 127.0.0.1 from the SNMPDOPTS line. You'll see what I'm saying when you compare yours to mine that you see above that I've made bold.Then we are going to configure the communities by running:
sudo nano /etc/snmp/snmpd.confDo a search within the conf file and you should see:
# sec.name source communityBy default the first line is the one that is commented and the last two are uncommented. I mearly commented out the first line (its the one in italics) and removed the comment from the second line. Also I changed the source from default to localhost and left the community name as public.
#com2sec paranoid default public
com2sec readonly localhost public
#com2sec readwrite default private
Now comes the test, you want to make sure that snmp is up and running. Since changes were made to the configuration you want to give those services a swift kick in the pants:
sudo /etc/init.d/snmpd restartOnce that is done you'll want to run:
snmpwalk -Os -c public -v 1 localhost systemYou should get a mess of information returned:
sysDescr.0 = STRING: Linux otani 2.6.24-19-generic #1 SMP Wed Jun 18 14:43:41 UTC 2008 i686If you get something else like:
sysObjectID.0 = OID: netSnmpAgentOIDs.10
sysUpTimeInstance = Timeticks: (227377) 0:37:53.77
sysContact.0 = STRING: Root(configure /etc/snmp/snmpd.local.conf)
sysName.0 = STRING: otani
sysLocation.0 = STRING: Unknown (configure /etc/snmp/snmpd.local.conf)
sysORLastChange.0 = Timeticks: (0) 0:00:00.00
sysORID.1 = OID: snmpFrameworkMIBCompliance
sysORID.2 = OID: snmpMPDCompliance
sysORID.3 = OID: usmMIBCompliance
sysORID.4 = OID: snmpMIB
sysORID.5 = OID: tcpMIB
sysORID.6 = OID: ip
sysORID.7 = OID: udpMIB
sysORID.8 = OID: vacmBasicGroup
sysORDescr.1 = STRING: The SNMP Management Architecture MIB.
sysORDescr.2 = STRING: The MIB for Message Processing and Dispatching.
sysORDescr.3 = STRING: The management information definitions for the SNMP User-based Security Model.
sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
sysORDescr.5 = STRING: The MIB module for managing TCP implementations
sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
sysORDescr.7 = STRING: The MIB module for managing UDP implementations
sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
sysORUpTime.1 = Timeticks: (0) 0:00:00.00
sysORUpTime.2 = Timeticks: (0) 0:00:00.00
sysORUpTime.3 = Timeticks: (0) 0:00:00.00
sysORUpTime.4 = Timeticks: (0) 0:00:00.00
sysORUpTime.5 = Timeticks: (0) 0:00:00.00
sysORUpTime.6 = Timeticks: (0) 0:00:00.00
sysORUpTime.7 = Timeticks: (0) 0:00:00.00
sysORUpTime.8 = Timeticks: (0) 0:00:00.00
Timout: No response from LocalhostGo back and make sure you've setup your communities properly and restart SNMPD from the /etc/init.d/snmpd restart command.
Next you are going to want to setup your web and MySQL server's. If you've already done this great, but for those who are starting on a vanilla installation, go ahead and run the following:
sudo apt-get install mysql-server apache2 libapache2-mod-php5 php5-mysql php5-cli php5-snmpYou'll need to test that Apache and PHP are up and running, so run:
sudo joe /var/www/phpinfo.phpand type in the phpinfo bit (unfortunately it won't properly display through Blogger if I type in the code, but you can always find it here on how to create a test page).
Save your file and go to: http://localhost/phpinfo.php and if you get the PHP info page, you are all set there!
Next you'll want to install phpmyadmin. It's not a requirement, but I always do this so you have a graphical interface to manage your MySQL instance:
sudo apt-get install phpmyadminAnd you can test that this is running by going to: http://localhost/phpmyadmin and logging in with root as the username and the password you setup during the installation process of MySQL above.
Now that we have that squared away, we want to install Cacti using:
sudo apt-get install cactiThe installation process is fairly straight forward. You will be asked:
- Configure libphp-adodb = Press OK
- Configure database for cacti with dbconfig-common = Press OK
- Password for MySQL database Administrator = Type in the password that you configured in the MySQL installation process and the one that you verified works through phpMyAdmin above.
- MySQL Application password for Cacti = This is the password for the new Cacti database instance that is going to be created. Make this a good one, as it's not going to be the same one that is used to log into Cacti to administer it.
- Webserver Type = apache2
- Click Next on the first screen
- Select NEW INSTALL and check that the information is correct
- Make sure that everything shows up as [FOUND] and resolve any conflicts (there shouldn't be as in my installation I didn't have to do anything else).
- Click Finish
- Username = admin
- Password = admin
Now comes the fun part, you are going to setup graphs! But before you can get to that you have to understand the process by which you set things up:
- Setup Devices
- Create graphs for devices
- Optional - Create a new tree for the devices
- Associate Devices to a Tree
There should already be a device there, but go ahead and delete it and create a new one from scratch. (The Add button to add a new one is in the upper right hand corner of the frame). In the add menu, there will be several fields that you need to fill in:
- Description - name this something that you will recognize, for me it was localhost-2
- Hostname - 127.0.0.1
- Host Template - ucd/net SNMP Host
- Description - Whatever you want to put there to make it so you know what this is
- Down Device Detection - Ping
- Ping Method - UDP Ping
- Ping Port - 23
- Ping timout value - 400
- Ping retry count - 1
- SNMP Version - 1
- SNMP Community - public, or whatever name you specified in your SNMP community that was configured earlier in this guide.
- SNMP Port - 161
- SNMP Timeout - 500
- Maximum OID's Per Get Request - 10
- Associated Graph Templates
- Associated Data Source Templates
- CPU, Load Average, and Memory
We're almost there. We have to either first create a tree to associate this new device to, or we have to associate this device to an existing tree. By default, Cacti will install with a Default Tree. And for those like me, who are setting this up on one box, and this will be the only box that Cacti monitors, we can skip creating a new tree and go straight to associating this to an existing tree. If you want to create your own tree, it's simply a matter of clicking on the Graph Trees link on the left menu, and adding a new tree with a new name.
To associate your device with a tree, it's simply just clicking on the Devices link on the left menu, and clicking the checkbox next to your device, and from the drop down menu select Place on Tree (Default Tree) and click on the Go button. You'll be asked to confirm, just confirm with default values and that's it!
If everything went well within a few minutes you should have some graphs being generated!
Reference
15 comments:
thanks for share
Thank you for sharing. But one point. If you remove the 127.0.0.1 you open your system to the world. You should restrict it to the ip other processes connect to.
i have a problem with cacti, i installed it and all work fine, but the graphics didnt appear.. and i tried all i read in internet about cacti. Please give me a hand or idea about this problem.
Thanks
Log into the Admin, and click on Devices under Management. Click on the device that you configured, and you'll see a section called: SNMP Information. Does it show something like:
SNMP Information
System: Hardware: x86 Family 6 Model 15 Stepping 11 AT/AT COMPATIBLE - Software: Windows Version 6.0 (Build 6001 Multiprocessor Free)
Uptime: 164976875 (19 days, 2 hours, 16 minutes)
Hostname: xxxxxxxx
Location:
Contact:
Or does it return an SNMP error?
sorry but in my cacti dont show a SNMP Information menue in device. i can send you some screens with my problem.... is normal that my status device say down? My mail is oidacra at gmail dot com
how about if I want just a subnet,
I am strugling trying to setup something like:
(THIS DO NOT WOKR)
snmpwalk -c public -v 2c 10.10.10.183
system
(ONLY THIS WORKS)
snmpwalk -c public -v 2c localhost system
even if I removed all from
com2sec readonly 10.10.10.0/24 public
com2sec readonly public
help
www.felipeferreira.net
I haven't tried adding a subnet, but from what I can tell you can add plugins to the software to give you the ability to scan a subnet for SNMP and then add the devices that show up.
Cacti Users Downloads
Discovery seems to do what you are asking for. If you do get it working, a write up would be great!
just great . . . thx
streble
just great . . . thx
streble
thanks! glad it helped!
Thanks a lot, you made the task look simple and it was simple.
thanks again
@gates2010, thanks for the feedback, glad it helped!
When using the instruction "apt-get install cacti-cactid" to install Cacti in an Ubuntu 9.04 (or earlier) environment you will find that the distribution actually downloads Cacti version 0.8.7b, it places the application and data files in Ubuntu specific directories, and requires Unbuntu/Debian specific patches for config.php, debian.php, global.php, and global-settings.php (not a complete list)
We have updated our tutorial on how to work through this, in particular upgrading from the 0.8.7b distribution Ubuntu provides, now to 0.8.7e, and applying the Debian/Ubuntu specific patches for 0.8.7e
01_config.php.patch
05_no-adodb.patch
06_config_settings.php_cactid_path.patch
cli-include-path.patch
http://patch-tracking.debian.net/package/cacti/0.8.7e-1
The full tutorial is here: http://www.open4energy.com/tutorials/virtualbox/cacti
PS - I would post it here, but it is really too many pages!
PPS - We are not a support business, we use Cacti for data center energy management - we use Ubuntu and Virtual machines to get a standard quick build, and have worked through these issues for our needs - We hope that our experience might help others using cacti with Ubuntu or Debian, particularly those new to Cacti
Great documentation...was able to get Cacti up and running w/o hassles thanks to this excellent Install guide.
@darow Han, thanks! Glad it helped!
Post a Comment