Installing Ubuntu 14.04 LTS with Cacti 0.8.8c
Ubuntu provides only Cacti 0.8.8b so we need to compile our own package with 0.8.8c after installing OS.
Install Ubuntu Server 14.04 x64 using defaults.
While not mandatory you probably want to enable OpenSSH server during install.
# Preparations, nothing to do with Cacti yet
# Login and switch to root
sudo su -
# Prevent useless questions from popping up
export DEBIAN_FRONTEND=noninteractive
# Remove unwanted packages
apt-get -y remove resolvconf
# Fix broken DNS
cat<<'__EOF__'>/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
__EOF__
# We don't want IPv6 on this host
echo "net.ipv6.conf.all.disable_ipv6=1" >>/etc/sysctl.conf
# Enable zswap by adding extra kernel parameter
sed -i.bak /etc/default/grub -e's|^GRUB_CMDLINE_LINUX_DEFAULT="|GRUB_CMDLINE_LINUX_DEFAULT="zswap.enabled=1 |g'
# Activate new kernel parameters on next boot
update-grub
# Update distribution
apt-get update
apt-get -y dist-upgrade
# Install some extra packages we need and like
apt-get -y install openssh-server screen joe lftp curl wget htop iftop \
mtr zip ntp open-vm-tools build-essential fail2ban
# Reboot
reboot
# Now we can start setting up Cacti part
# Prevent useless questions from popping up
export DEBIAN_FRONTEND=noninteractive
# Install some dependencies such as apache, mysqld and rrdtool
apt-get update
apt-get -y install apache2 php5 php5-mysql php5-snmp mysql-client mysql-server snmpd rrdtool
# Unfortunately Ubuntu version is outdated so we need to build our own package
# http://sourceforge.net/p/cacti/mailman/message/33072838/
# Get rebuild deps
apt-get -y install devscripts
apt-get -y build-dep cacti cacti-spine
# Create build environment
adduser bobbuilder --shell /bin/bash --disabled-password --gecos bobbuilder
# Switch to non-priviledged user for build
sudo su - bobbuilder
# Download ubuntu sources
mkdir -p ~/build/cacti
cd ~/build/cacti
apt-get -y source cacti
# Build 0.8.8c instead of Ubuntu version
wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz
cd cacti-0.8.8b+dfsg
uupdate ../cacti-0.8.8c.tar.gz -v 0.8.8c
# Remove patches not needed with 0.8.8c
cd ../cacti-0.8.8c/debian
sed -i.bak patches/series\
-e'/replace_treeview_by_jquery.jstree.patch/d' \
-e'/use_jquery_for_debian.patch/d' \
-e'/loadavg_multi_locale_friendly.patch/d' \
-e'/fix_php_strict_warning_in_ping.patch/d' \
-e'/fix_COMMENT_in_graph_regression_from_CVE-2013-1435.patch/d' \
-e'/fix_sql_injection_CVE-2013-5589.patch/d' \
-e'/fix_cross_site_scripting_CVE-2013-5588.patch/d' \
-e'/upgrade_script_misses_latest_releases.patch/d' \
-e'/fix_four_CVE-2014_issues.patch/d'
# Build
debuild -i -us -uc -b -j2
# Next we do cacti-spine
cd ~/build/cacti
apt-get -y source cacti-spine
# Build 0.8.8c of spine instead of Ubuntu version
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8c.tar.gz
cd cacti-spine-0.8.8b
uupdate ../cacti-spine-0.8.8c.tar.gz -v 0.8.8c
# Build
cd ../cacti-spine-0.8.8c/debian
debuild -i -us -uc -b -j2
# You should end up with something like this:
#
# -rw-r--r-- 1 bobbuilder bobbuilder 2413086 Dec 20 01:34 cacti_0.8.8c-0ubuntu1_all.deb
# -rw-r--r-- 1 bobbuilder bobbuilder 51064 Dec 20 01:34 cacti-spine_0.8.8c-0ubuntu1_amd64.deb
# Switch back to root
logout
# We need gdebi to properly install local package that depends on packages in repository
apt-get -y install gdebi-core
# Install our customized version
cd ~bobbuilder/build/cacti
gdebi --non-interactive cacti_0.8.8c-0ubuntu1_all.deb
gdebi --non-interactive cacti-spine_0.8.8c-0ubuntu1_amd64.deb
# Prevent updates to cacti
echo "cacti hold" | dpkg --set-selections
echo "cacti-spine hold" | dpkg --set-selections
# We prefer empty front page rather than Ubuntu advertisement
rm -f /var/www/html/index.html
touch /var/www/html/index.html
# Turn off useless PHP warnings filling logs that are hardcode enabled even in latest cacti version (why??)
sed -i.bak /usr/share/cacti/site/include/global.php \
-e's|error_reporting(.*|error_reporting(E_ALL \& ~E_DEPRECATED \& ~E_NOTICE \& ~E_STRICT);|g'
sed -i.bak /etc/php5/apache2/php.ini \
-e's|^error_reporting.*|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_NOTICE \& ~E_STRICT|g'
sed -i.bak /etc/php5/cli/php.ini \
-e's|^error_reporting.*|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_NOTICE \& ~E_STRICT|g'
# Restart apache to apply changes
service apache2 restart
# Change poller cycle from default 5 minutes to one minute
sed -i /etc/cron.d/cacti -e's|\*/5 \*|\*/1 \*|g'
service crond reload
# Rest is via Cacti web interface, see http://myserver.example.com/cacti/
# Install type: New install
# Paths should show all green, NET-SNMP is 5.x and RRDTool is 1.4.x
# Default username is "admin" and password is "admin" too
# You'll be forced to change admin password next
Select Console on top, then Configuration > Settings on left and Poller tab on top.
Change Poller Interval to Every Minute
Change Cron Interval to Every Minute
Click Save button hiding in lower right corner
Select Utilities > System Utilities on left and then click Rebuild Poller Cache
Install Ubuntu Server 14.04 x64 using defaults.
While not mandatory you probably want to enable OpenSSH server during install.
# Preparations, nothing to do with Cacti yet
# Login and switch to root
sudo su -
# Prevent useless questions from popping up
export DEBIAN_FRONTEND=noninteractive
# Remove unwanted packages
apt-get -y remove resolvconf
# Fix broken DNS
cat<<'__EOF__'>/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
__EOF__
# We don't want IPv6 on this host
echo "net.ipv6.conf.all.disable_ipv6=1" >>/etc/sysctl.conf
# Enable zswap by adding extra kernel parameter
sed -i.bak /etc/default/grub -e's|^GRUB_CMDLINE_LINUX_DEFAULT="|GRUB_CMDLINE_LINUX_DEFAULT="zswap.enabled=1 |g'
# Activate new kernel parameters on next boot
update-grub
# Update distribution
apt-get update
apt-get -y dist-upgrade
# Install some extra packages we need and like
apt-get -y install openssh-server screen joe lftp curl wget htop iftop \
mtr zip ntp open-vm-tools build-essential fail2ban
# Reboot
reboot
# Now we can start setting up Cacti part
# Prevent useless questions from popping up
export DEBIAN_FRONTEND=noninteractive
# Install some dependencies such as apache, mysqld and rrdtool
apt-get update
apt-get -y install apache2 php5 php5-mysql php5-snmp mysql-client mysql-server snmpd rrdtool
# Unfortunately Ubuntu version is outdated so we need to build our own package
# http://sourceforge.net/p/cacti/mailman/message/33072838/
# Get rebuild deps
apt-get -y install devscripts
apt-get -y build-dep cacti cacti-spine
# Create build environment
adduser bobbuilder --shell /bin/bash --disabled-password --gecos bobbuilder
# Switch to non-priviledged user for build
sudo su - bobbuilder
# Download ubuntu sources
mkdir -p ~/build/cacti
cd ~/build/cacti
apt-get -y source cacti
# Build 0.8.8c instead of Ubuntu version
wget http://www.cacti.net/downloads/cacti-0.8.8c.tar.gz
cd cacti-0.8.8b+dfsg
uupdate ../cacti-0.8.8c.tar.gz -v 0.8.8c
# Remove patches not needed with 0.8.8c
cd ../cacti-0.8.8c/debian
sed -i.bak patches/series\
-e'/replace_treeview_by_jquery.jstree.patch/d' \
-e'/use_jquery_for_debian.patch/d' \
-e'/loadavg_multi_locale_friendly.patch/d' \
-e'/fix_php_strict_warning_in_ping.patch/d' \
-e'/fix_COMMENT_in_graph_regression_from_CVE-2013-1435.patch/d' \
-e'/fix_sql_injection_CVE-2013-5589.patch/d' \
-e'/fix_cross_site_scripting_CVE-2013-5588.patch/d' \
-e'/upgrade_script_misses_latest_releases.patch/d' \
-e'/fix_four_CVE-2014_issues.patch/d'
# Build
debuild -i -us -uc -b -j2
# Next we do cacti-spine
cd ~/build/cacti
apt-get -y source cacti-spine
# Build 0.8.8c of spine instead of Ubuntu version
wget http://www.cacti.net/downloads/spine/cacti-spine-0.8.8c.tar.gz
cd cacti-spine-0.8.8b
uupdate ../cacti-spine-0.8.8c.tar.gz -v 0.8.8c
# Build
cd ../cacti-spine-0.8.8c/debian
debuild -i -us -uc -b -j2
# You should end up with something like this:
#
# -rw-r--r-- 1 bobbuilder bobbuilder 2413086 Dec 20 01:34 cacti_0.8.8c-0ubuntu1_all.deb
# -rw-r--r-- 1 bobbuilder bobbuilder 51064 Dec 20 01:34 cacti-spine_0.8.8c-0ubuntu1_amd64.deb
# Switch back to root
logout
# We need gdebi to properly install local package that depends on packages in repository
apt-get -y install gdebi-core
# Install our customized version
cd ~bobbuilder/build/cacti
gdebi --non-interactive cacti_0.8.8c-0ubuntu1_all.deb
gdebi --non-interactive cacti-spine_0.8.8c-0ubuntu1_amd64.deb
# Prevent updates to cacti
echo "cacti hold" | dpkg --set-selections
echo "cacti-spine hold" | dpkg --set-selections
# We prefer empty front page rather than Ubuntu advertisement
rm -f /var/www/html/index.html
touch /var/www/html/index.html
# Turn off useless PHP warnings filling logs that are hardcode enabled even in latest cacti version (why??)
sed -i.bak /usr/share/cacti/site/include/global.php \
-e's|error_reporting(.*|error_reporting(E_ALL \& ~E_DEPRECATED \& ~E_NOTICE \& ~E_STRICT);|g'
sed -i.bak /etc/php5/apache2/php.ini \
-e's|^error_reporting.*|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_NOTICE \& ~E_STRICT|g'
sed -i.bak /etc/php5/cli/php.ini \
-e's|^error_reporting.*|error_reporting = E_ALL \& ~E_DEPRECATED \& ~E_NOTICE \& ~E_STRICT|g'
# Restart apache to apply changes
service apache2 restart
# Change poller cycle from default 5 minutes to one minute
sed -i /etc/cron.d/cacti -e's|\*/5 \*|\*/1 \*|g'
service crond reload
# Rest is via Cacti web interface, see http://myserver.example.com/cacti/
# Install type: New install
# Paths should show all green, NET-SNMP is 5.x and RRDTool is 1.4.x
# Default username is "admin" and password is "admin" too
# You'll be forced to change admin password next
Select Console on top, then Configuration > Settings on left and Poller tab on top.
Change Poller Interval to Every Minute
Change Cron Interval to Every Minute
Click Save button hiding in lower right corner
Select Utilities > System Utilities on left and then click Rebuild Poller Cache
So, it seems we have server and cacti running. How about we add just something to see it's really working. Let's start easy with Cisco router/switch.
Click "Create devices for network" on Console tab
Click "Add" text on right corner of "Devices" box
Enter Description and hostname (or IP)
Set Host Template to "Cisco Router"
Set Downed Device Detection to "SNMP Uptime"
Set SNMP Version to v2
Enter your SNMP read-only community
Finally click Create on bottom right corner
Router information appears on top of the screen
Click "Create Graphs for this Host" on top right corner
Select interfaces we're interested from Data Query box
Change Graph Type in lower right corner from In/Out Bits to In/Out Bits (64-bit Counters)
Click Create on bottom right
Repeate above but set Graph Type to "In/Out Errors/Discarded packets"
Select Cisco - CPU Usage from Graph Templates box
Also add "ucd/net - Memory Usage" from dropdown menu in same Templates box
Click Create on bottom right
Change color of CPU chart - or don't default red should be fine
Click Management > Graph Trees on left and then Default Tree
Click Add on right side of Tree Items box
Change Tree Item type to Host and select router (Host) we just added
Set Graph Grouping Style to Graph Template
Click Create on right
While still on same screen set Graph Grouing Style to Data Query Index
Click Create on right
Click Graphs tab on top
Click our new host on left hand treeview
Wait for a while for data to populate from router. After you're confident it works we can finally proceed to ESXi part.
Hello, was having problems compiling spine 0.8.8c from official sources on Ubuntu 14.04.1 LTS. And this worked like a charm, this packet building tools seems like black magic to me. You're good.
ReplyDeleteThank you very much
did what you said but got error FATAL: Cannot connect to MySQL server on 'localhost'. Please make sure you have specified a valid MySQL database name in 'include/config.php'
ReplyDeletethis worked like a charm for me too!
ReplyDeleteWork without issue. Tryed same procedire form 0.8.8d, get an erro on spine part.
ReplyDeleteyou don't have to remove resolvconf, put nameserver lines on /etc/resolvconf/resolv.conf.d/base. That's all. Working fine for me.
ReplyDelete