اما زمانی که میرسیم به مرحله وارد شدن به مرورگر و صفحه اولیه کاکتی، پیام خطا دریافت میکنم؛
So I've had the WORST luck in trying to figure out how to setup Cacti on Ubuntu so it will properly poll my system and give me graphs. Part of the reasoning behind this is that I'm in the process of replacing my existing Netgear router with a Ubuntu box (guide to come shortly!) but a prereq of doing this is to setup reporting on the Ubuntu box so I can see all kinds of metrics on disk, IO, network bandwidth, etc--all the fun stuff that makes you jump up and down with. My previous attempts went through fine, but the problem was that I didn't seem to be able to get stats polled from my devices, namely network interfaces.
To begin with always make sure your system is up2date:
sudo apt-get update
sudo apt-get upgrade
Now that we have that out of the way, make sure your system has SNMPD installed:
sudo apt-get install snmp snmpd
Now that it is installed, we need to do a bit of configuration to it. Run:
sudo nano /etc/default/snmpd
and you'll see something like:
# This file controls the activity of snmpd and snmptrapd
# MIB directories. /usr/share/snmp/mibs is the default, but
# including it here avoids some strange problems.
# snmpd control (yes means start daemon).
# 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.
# snmptrapd options (use syslog).
TRAPDOPTS='-Lsd -p /var/run/snmptrapd.pid'
# create symlink on Debian legacy location to official RFC path
Make sure that you change:
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.conf
Do a search within the conf file and you should see:
# sec.name source community
#com2sec paranoid default public
com2sec readonly localhost public
#com2sec readwrite default private
By 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.
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 restart
Once that is done you'll want to run:
snmpwalk -Os -c public -v 1 localhost system
You 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 i686
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
If you get something else like:
Timout: No response from Localhost
Go 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-snmp
You'll need to test that Apache and PHP are up and running, so run:
sudo joe /var/www/phpinfo.php
and 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 phpmyadmin
And 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 cacti
The installation process is fairly straight forward. You will be asked:
1. Configure libphp-adodb = Press OK
2. Configure database for cacti with dbconfig-common = Press OK
3. 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.
4. 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.
5. Webserver Type = apache2
So now that cacti has been installed and we are trucking right along, we'll want to pull up the web installer: http://localhost/cacti. You have to go through the web-based installer process:
1. Click Next on the first screen
2. Select NEW INSTALL and check that the information is correct
3. 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).
4. Click Finish
When you get to the login page, your default credentials on the first run are:
* Username = admin
* Password = admin
Obviously be a good boy and on the next screen make sure you change this to something proper. This will be the admin password that you change, so make it a good one!
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:
1. Setup Devices
2. Create graphs for devices
3. Optional - Create a new tree for the devices
4. Associate Devices to a Tree
This is the part that I got stumbled up on for awhile as it's not the most intuitive system to go through. So to start with click on Console from the upper right corner, and click on the link labeled Create devices for network.
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
When you select SNMP version to 1, additional options will open up for you:
* 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
Once you have that click on Create to create your device. After you click on create, the device will refresh with additional options at the bottom for:
* Associated Graph Templates
* Associated Data Source Templates
If you scroll to the top of the frame, you'll see a link labeled Create Graphs for this Host. Click on the link to get you to the next screen. Under Graph Templates, select the check boxes next to:
* CPU, Load Average, and Memory
Under Data Query [SNMP - Interface Statistics], click on the drop down menu and select In/Out Bits with Total Bandwidth and click the Create button.
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!