[HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagios

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
DWAyotte
Posts: 32
Joined: Wed Mar 28, 2007 1:37 pm

[HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagios

Post by DWAyotte »

Hello everyone. I have put together what I feel is a very straight forward guide that walks you through installing Cacti and Nagios on the same machine with every command needed. The purpose for this is to have trending data, monitoring and alerting all from within 1 GUI, Cacti. I am a beginner Linux user and I found it somewhat difficult to find information that was tailored to a beginner, so this is the compilation of all the research I did in order to obtain my desired end result. This guide isn't 100% complete yet, but the bulk of it is done and tested, so I wanted to share this in case someone out there is looking for such a guide to help them out. I don't really go into how to use or configure Cacti or Nagios, I just get you to the point where they are all working and configured at what I consider the minimum.

I used ESX 4.1 as my VM platform.

If you aren't comfortable enough installing an OS in your VM environment or on your dedicate machine, then I recommend taking a look at this excellent website run by a great group of people:
http://www.turnkeylinux.org/lampstack
This will skip you forward to the VMware Tools step.
*NOTE* The TKL lamp stack is based on Ubuntu 10.04.1 LTS, so there may be some variations not noted in my instructions.

Still in progress
--------------------------
Getting postfix setup correctly to use gmail to send notifications to email and sms (using providers email addresses, ie 1234567890@vzwireless.com).


Specifications
--------------------------
Virtual Machine (This is simply what I used, you can change this to your liking)
2 CPU
512MB RAM
80GB HD (Thin)

Ubuntu 11.04 Server x64
Apache
MySQL
PHP5
OpenSSH
PHPMyAdmin
Webmin
SNMP
RRDTool
VMTools
Build Essentials
Linux Headers

Cacti 0.8.7g
Spine 0.8.7g
0.8.7g Patches
Plugin Architecture 2.8
Monitor
Settings
MacTrack
SpikeKill
Nagios Plugin for Cacti
Discovery

Nagios Core 3.2.3
Plugins 1.4.15
NRPE 2.12
NDOUtils 1.4b7 (b9 is reported to be very buggy and in fact didn't work for me, so this is why I chose b7)


Install
--------------------------
Ubuntu Server 11.04 x64
Boot ubuntu server ISO
Work through installation wizard
Hostname: Choose your hostname
Time Zone: Choose your timezone
Partition Disk: Guided - use entire disk and set up LVM (LVM makes it easier to resize in the future)
Username: Choose a username
Password: **********
Install security updates automatically (This is my preference, not necessarily your preference)
Software selection: OpenSSH server, LAMP server, Mail server
MySQL root password: **********
Postfix Configuration - type: Satellite
Postfix Configuration - mail name: Your FQDN
Assign IP Address

Update OS
sudo -i
apt-get update
apt-get full-upgrade -y
reboot

Connect over SSH now
sudo -i
passwd (this sets the root password, needed for webmin to work, so if you don't want webmin you can skip this part)
apt-get install php5-gd php5-mysql php5-cgi php5-snmp -y
apt-get install php-pear php5-ldap -y
apt-get install snmp snmpd libnet-snmp-perl libsnmp-perl -y
apt-get install rrdtool librrds-perl –y
apt-get install phpmyadmin -y
apt-get install libmysqlclient-dev -y
apt-get install sysv-rc-conf -y
apt-get install build-essential -y
apt-get install linux-headers-$(uname -r) -y
apt-get install libldap2-dev libsnmp-dev -y
apt-get install libconfig-inifiles-perl libcrypt-des-perl libdigest-hmac-perl libdigest-sha1-perl libgd-gd2-perl -y
apt-get install libgd2-xpm-dev -y
apt-get install ntp -y

Webmin
nano /etc/apt/sources.list
add the following lines at the end of the file

Code: Select all

deb http://download.webmin.com/download/repository sarge contrib
deb http://webmin.mirror.somersettechsolutions.co.uk/repository sarge contrib
save and exit
cd /tmp
wget http://www.webmin.com/jcameron-key.asc
apt-key add jcameron-key.asc
apt-get update
apt-get install webmin -y
wget https://webmin-theme-stressfree.googlec ... .10.tar.gz
login to webmin via https://IP:10000
Webmin > Webmin Configuration > Install theme > from local file
Browse to /tmp and choose theme-stressfree-2.10.tar.gz
Return to themes list
Current theme: StressFree theme

VMware Tools
In vCenter, right click VM and choose Guest > Install/Upgrade VMware tools
mount /dev/cdrom /media/cdrom
tar -zxf /media/cdrom/VMwareTools-8.3.2-257589.tar.gz
vmware-tools-distrib/vmware-install.pl
take all the defaults all the way through the installation
reboot

Cacti
cd /tmp
wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
tar –zxvf cacti-0.8.7g.tar.gz
mv /tmp/cacti-0.8.7g/ /var/www/cacti
groupadd cacti
useradd -g cacti cactiuser
chown –R cactiuser /var/www/cacti/rra
chown –R cactiuser /var/www/cacti/log
chmod –R 777 /var/www/cacti/log
chmod –R 777 /var/www/cacti/rra
login to phpmyadmin via http://IP/phpmyadmin
Click on the Priveledges tab > Add a new User
Username: cacti
Host: localhost
Password: *************
Select "Create database with same name and grant all privileges"
Click Go
Back to SSH window
mysql –u root –p cacti < /var/www/cacti/cacti.sql
Verify in phpmyadmin that the cacti db is no longer empty
nano /var/www/cacti/include/config.php
update the MySQL settings
nano /etc/crontab
add the following line to the end of the file:

Code: Select all

*/5 * * * * cactiuser php5 /var/www/cacti/poller.php > /dev/null 2>&1
Spine
wget http://www.cacti.net/downloads/spine/ca ... .7g.tar.gz
tar –zxvf cacti-spine-0.8.7g.tar.gz
mv /tmp/cacti-spine-0.8.7g/ /usr/local/spine
cd /usr/local/spine
aclocal
libtoolize –f
autoheader
autoconf
automake –a
automake
./configure
make
make install
cp /usr/local/spine/spine.conf.dist /usr/local/spine/spine.conf
nano spine.conf
update the sql settings in this file to reflect correct settings
cd /var/www/cacti
wget http://www.cacti.net/downloads/patches/ ... vate.patch
wget http://www.cacti.net/downloads/patches/ ... view.patch
wget http://www.cacti.net/downloads/patches/ ... tput.patch
wget http://www.cacti.net/downloads/patches/ ... tion.patch
wget http://www.cacti.net/downloads/patches/ ... arse.patch
wget http://www.cacti.net/downloads/patches/ ... ping.patch
wget http://www.cacti.net/downloads/patches/ ... rval.patch
patch -p1 -N < data_source_deactivate.patch
patch -p1 -N < graph_list_view.patch
patch -p1 -N < html_output.patch
patch -p1 -N < ldap_group_authenication.patch
patch -p1 -N < script_server_command_line_parse.patch
patch -p1 -N < ping.patch
patch -p1 -N < poller_interval.patch
cd /usr/local/spine
wget http://www.cacti.net/downloads/spine/pa ... sues.patch
patch -p1 -N < unified_issues.patch

Plugin Architecture
cd /tmp
wget http://mirror.cactiusers.org/downloads/ ... 2.8.tar.gz
tar –zxvf cacti-plugin-0.8.7g-PA-v2.8.tar.gz
cp -r /tmp/cacti-plugin-arch/files-0.8.7g/* /var/www/cacti
cd /var/www/cacti
patch -p1 -N --dry-run < /tmp/cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.8.diff
patch -p1 -N < /tmp/cacti-plugin-arch/cacti-plugin-0.8.7g-PA-v2.8.diff
nano /var/www/cacti/include/global.php
set correct sql settings
nano /var/www/cacti/include/config.php
set the $url_path variable to /cacti/
mysql -u root -p cacti < /tmp/cacti-plugin-arch/pa.sql

Plugins (Skip any plugins you aren't interested in having)
cd plugins
wget http://docs.cacti.net/_media/plugin:settings-v0.7-1.tgz
mv plugin\:settings-v0.7-1.tgz settings-v0.7-1.tgz
tar –zxvf settings-v0.7-1.tgz
wget http://docs.cacti.net/_media/plugin:monitor-v1.2-1.tgz
mv plugin\:monitor-v1.2-1.tgz monitor-v1.2-1.tgz
tar –zxvf monitor-v1.2-1.tgz
mysql -u root -p cacti < /var/www/cacti/plugins/monitor/monitor.sql
wget http://docs.cacti.net/_media/plugin:dis ... v1.1-1.tgz
mv plugin\:discovery-v1.1-1.tgz discovery-v1.1-1.tgz
tar –zxvf discovery-v1.1-1.tgz
mysql -u root -p cacti < /var/www/cacti/plugins/discovery/discover.sql
wget http://docs.cacti.net/_media/plugin:mactrack-v2.9-1.tgz
mv plugin\:mactrack-v2.9-1.tgz mactrack-v2.9-1.tgz
tar –zxvf mactrack-v2.9-1.tgz
mysql -u root -p cacti < /var/www/cacti/plugins/mactrack/mactrack.sql
wget http://docs.cacti.net/_media/plugin:spi ... v1.2-1.tgz
mv plugin\:spikekill-v1.2-1.tgz spikekill-v1.2-1.tgz
tar –zxvf spikekill-v1.2-1.tgz
download this file http://www.mediafire.com/?iefyesb24ppsbwl and transfer it to your linux box to /var/www/cacti/plugins
tar -xf npc-2.0.4.tar.gz

Open a web browser and visit http://IP/cacti
Go through the install wizard and take all the defaults
change the admin password
Settings > Path > Spine Poller File Path = /usr/local/spine/spine > Save
Settings > Poller > change Poller Type to Spine > Save
User Management > admin > check Plugin Management > Save
Plugin Management > Install All Plugins (click blue arrow) and then Enable All Plugins you want to use (green arrow)
Settings > NPC tab > check Remote Commands
Insert: /usr/local/nagios/var/rw/nagios.cmd to "Nagios Command File Path" box
Insert the Nagios URL: http://IP/nagios/
Click Save
Settings > Misc > Subnet to scan - enter the subnet you want to scan
Enter the appropriate DNS server
Click Save

Nagios
useradd -m -s /bin/bash nagios
passwd nagios
groupadd nagcmd
usermod -G nagios,nagcmd nagios
usermod -a -G nagios,nagcmd www-data
usermod -a -G nagios,nagcmd cactiuser
cd /tmp
wget http://prdownloads.sourceforge.net/sour ... 2.3.tar.gz
wget http://prdownloads.sourceforge.net/sour ... .15.tar.gz
tar xvzf nagios-3.2.3.tar.gz
tar xzf nagios-plugins-1.4.15.tar.gz
cd nagios-3.2.3
./configure --with-command-group=nagcmd
make all
make install
make install-init
make install-config
make install-commandmode
nano /usr/local/nagios/etc/objects/contacts.cfg
change the email address to yours
make install-webconf
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
enter a great password
/etc/init.d/apache2 reload
cd /tmp/nagios-plugins-1.4.15/
./configure --with-nagios-user=nagios --with-nagios-group=nagios
make
make install
ln -s /etc/init.d/nagios /etc/rcS.d/S99nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
if there are errors, resolve them
/etc/init.d/nagios start
http://IP/nagios/
verify local services are OK

NDOUtils
cd /tmp
wget http://sourceforge.net/projects/nagios/ ... 4b7.tar.gz
tar xvfz ndoutils-1.4b7.tar.gz
cd ndoutils-1.4b7
./configure
make
cp src/ndomod-3x.o /usr/local/nagios/bin/ndomod.o
cp config/ndomod.cfg /usr/local/nagios/etc/ndomod.cfg
nano /usr/local/nagios/etc/ndomod.cfg

Code: Select all

output_type=tcpsocket
#output_type=unixsocket

output=127.0.0.1
#output=/usr/local/nagios/var/ndo.sock
nano /usr/local/nagios/etc/nagios.cfg
add the following line in the broker section: broker_module=/usr/local/nagios/bin/ndomod.o config_file=/usr/local/nagios/etc/ndomod.cfg
set to 1: process_performance_data=1
cp src/ndo2db-3x /usr/local/nagios/bin/ndo2db
cp config/ndo2db.cfg /usr/local/nagios/etc/ndo2db.cfg
nano /usr/local/nagios/etc/ndo2db.cfg

Code: Select all

#socket_type=unix
socket_type=tcp

db_host=127.0.0.1
db_name=cacti
db_prefix=npc_
db_user=cacti
db_pass=***********
chmod go+r /usr/local/nagios/etc/ndo2db.cfg
chmod go+r /usr/local/nagios/etc/ndomod.cfg
nano /etc/init.d/ndo2db
Paste the script that is found in this page - look in the "NDO database configuration" section: http://www.itpointofview.com/?p=191
chmod gou+x /etc/init.d/ndo2db
reboot

Links
--------------------------
Cacti: http://YourIP/cacti
Nagios: http://YourIP/nagios
Webmin: https://YourIP:10000
PhpMyAdmin: http://YourIP/phpmyadmin

Let me know if I did anything wrong here, duplicated steps, could do things a better way. I am happy to learn and welcome feedback. I hope this can help a few of you out there. If you require assistance of any kind in relation to my guide, just post here and I will do my best to help out. I am still very limited in my knowledge, but have had a good time learning linux, cacti and nagios. I will be creating another guide soon as well but using CentOS instead of Ubuntu.

Thanks for stopping by!


Big thanks to the following authors/websites, they proved invaluable.
------------------------------------------------------------------

https://richardkok.wordpress.com/2010/1 ... p-by-step/
http://www.ubuntugeek.com/how-to-instal ... erver.html
http://www.linuxreaders.com/2009/04/19/ ... tallation/
http://www.itpointofview.com/?p=191
http://trac2.assembla.com/npc/wiki/QuickStartGuide
http://deedoubledub.phpnet.us/2009/03/n ... buntu-804/
http://www.turnkeylinux.org
Guilherme
Posts: 1
Joined: Fri Sep 09, 2011 6:59 am

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by Guilherme »

Hi DWAyotte,

I created this account just so I could thank you for such an intuitive and useful guide for extreme noob linux users. This worked wonderfully with Ubuntu 11.04 Desktop x86. After a week of following alternative guides, especially the one provided by Cacti, I was reaching dead ends with many different problems, which I'm sure were caused by my lack of experience. Thank you again and I hope you keep doing these sort of detailed posts in future as they are extremely helpful.

Regards
Guilherme
DWAyotte
Posts: 32
Joined: Wed Mar 28, 2007 1:37 pm

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by DWAyotte »

Guilherme,

I appreciate the thanks! It makes my day knowing I have helped someone out. Thanks for taking the time to share your experience, it sure is motivating. Happy Monitoring/Alerting. :)
gred
Posts: 6
Joined: Wed Sep 07, 2011 8:26 pm

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by gred »

Hi DWAyotte,

I just setup a new linux box Ubuntun 11.04 with Cacti 0.8.7i. Although your guide is for 0.8.7g/h, most of the steps are similar and I have managed to setup my cacti successfully. Thanks for all your help :-)

Cheers
gred
malamaka
Posts: 1
Joined: Mon Jan 23, 2012 12:53 pm

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by malamaka »

hi..thanks for a great easy step by step guide...

but as a very Noob, im stuck at the vm part.

i installed ubuntu server via ISO on my server and followed all the steps but were do i find the vcentre?

VMware Tools
In vCenter, right click VM and choose Guest > Install/Upgrade VMware tools
mount /dev/cdrom /media/cdrom


And why use a virtual machine for this?

thanks malamaka
c4ct1User
Posts: 2
Joined: Wed Feb 08, 2012 4:53 am

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by c4ct1User »

Thanks a lot.
Best guide ever!!
DWAyotte
Posts: 32
Joined: Wed Mar 28, 2007 1:37 pm

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by DWAyotte »

malamaka wrote:hi..thanks for a great easy step by step guide...

but as a very Noob, im stuck at the vm part.

i installed ubuntu server via ISO on my server and followed all the steps but were do i find the vcentre?

VMware Tools
In vCenter, right click VM and choose Guest > Install/Upgrade VMware tools
mount /dev/cdrom /media/cdrom


And why use a virtual machine for this?

thanks malamaka
Sorry for the extremely late reply. If you aren't installing into a VMware environment then you can actually ignore all references to VMware, such as the tools installation. The reason to use a virtual machine is for those of us who utilize a virtual environment. If you don't have a virtual environment you should still be able to have great success with the guide as the only steps that really matter to the VMware environment are the Tools install, but even those aren't required. I hope things went well for you!
DWAyotte
Posts: 32
Joined: Wed Mar 28, 2007 1:37 pm

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by DWAyotte »

c4ct1User wrote:Thanks a lot.
Best guide ever!!
Thanks! It was a long and painful process to put it together, but I did it for you guys! :) I should have a CentOS 6.2 guide fairly soon as well.
DWAyotte
Posts: 32
Joined: Wed Mar 28, 2007 1:37 pm

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by DWAyotte »

gred wrote:Hi DWAyotte,

I just setup a new linux box Ubuntun 11.04 with Cacti 0.8.7i. Although your guide is for 0.8.7g/h, most of the steps are similar and I have managed to setup my cacti successfully. Thanks for all your help :-)

Cheers
gred

I appreciate you letting us know. I am very glad it was of use to you. :)
brutos
Posts: 1
Joined: Thu Jul 19, 2012 11:34 am

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by brutos »

Great guide thanks for the effort.
followed it but i keep getting the error in the logs

ubuntu nagios: ndomod: Still unable to connect to data sink.
jepputeh
Posts: 5
Joined: Fri Aug 03, 2012 3:16 am

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by jepputeh »

hi

im super noob at linux console.

i installed cacti using "sudo apt-get install cacti". and i dont know where my cacti directory is. right now im trying to copy the extracted plugin architecture into the cacti folder (in which your guide showed /var/www/cacti). but when i typed in ls /var/www/cacti , it replies not valid directory. how can i find it? or maybe you guys know where the cacti directory is if installed using "apt-get install cacti" command?

pls help me.thank you in advance
paulgevers
Cacti Pro User
Posts: 613
Joined: Tue Aug 29, 2006 4:09 pm
Location: NL

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by paulgevers »

jepputeh wrote: i installed cacti using "sudo apt-get install cacti". and i dont know where my cacti directory is. right now im trying to copy the extracted plugin architecture into the cacti folder (in which your guide showed /var/www/cacti). but when i typed in ls /var/www/cacti , it replies not valid directory. how can i find it? or maybe you guys know where the cacti directory is if installed using "apt-get install cacti" command?
A little late, sorry, but please check the 3rd item in my sig.
Maintainer of cacti in Debian (and Ubuntu).
Cacti 1.* is now officially supported on Debian Stretch via Debian backports
FAQ Ubuntu and Debian differences
Generic cacti debugging
cachorroyayo
Cacti User
Posts: 53
Joined: Thu Sep 17, 2009 5:37 pm
Location: Lima - Peru

Re: [HOWTO] Installation Guide | Ubuntu 11.04 | Cacti | Nagi

Post by cachorroyayo »

Hello
I know this tutorial is a little bit old if comparing. but is great.

When I tried to use the guide, I have some problems with "TYPE=MyISAM" (MySQL steps I need to change it for Engine=MyISAM and works fine)

I tried all with Ubuntu 12.04 and all the steps seem to work.
Nagios running fine and Cacti running fine as well.
PhpMyAdmin runs fine too.


I use Cacti-0.8.8a And I no need to install and patch plugins because there are available out-of-the-box.

My problems came with ndoutils.

NPC says Nagios's State = Off.
No hosts.
No Groups.

I copy and paste the script you suggested but maybe I forget something.
Nagios run fine and I can see my localhost happy.

I tried to copy/paste all the commands you put trying to avoid or write in wrong way.


I hope if is not too late, you can help me.


And obviously I'm waiting your CentOS walkthrough guide :)


Thank You very much.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests