System Engineering

Install Cacti on OpenSUSE 12.3

1. Install requirements

# add repository
# mirror was expired(2014-12-22) : zypper ar -f -c -n openSUSE-12.3-server:monitoring  repo-monitoring
zypper ar -f -c -n openSUSE-12.3-server:monitoring  repo-monitoring
# install
zypper install cacti cacti-spine cacti-plugin-docs cacti-plugin-hostinfo cacti-plugin-tools apache2 apache2-doc apache2-prefork

2. Create user cacti

useradd -d /srv/www/cacti -s /bin/bash -g nobody cacti
mkdir ~cacti/.ssh
chown cacti:www ~cacti/.ssh
chmod 750 ~cacti/.ssh

# You must input blank password after below command !!!
sudo -u cacti ssh-keygen -t rsa

chown cacti:www ~cacti/.ssh/id_rsa
chmod 440 ~cacti/.ssh/id_rsa

3. Create mysql user

CREATE USER cacti@localhost

4. Create DB schema

mysql -u root -p cacti < ~cacti/cacti.sql

5. Configure cacti

vi ~cacti/include/config.php
# Add mysql connection information ...

chown wwwrun:root ~cacti/include/config.php
chmod 600 ~cacti/include/config.php

6. Configure Apache

vi /etc/apache2/httpd.conf

Alias /cacti/ /srv/www/cacti/
<Directory /srv/www/cacti/>
  Options None
  #order allow,deny
  #allow from all
  #AuthName "NMS Access"
  #AuthType Basic
  #AuthUserFile /srv/www/cacti/.htpasswd
  #Require valid-user
  Order deny,allow
  Deny from all
  Allow from
  DirectoryIndex index.php index.html

7. Configure from Web UI

admin / admin

8. Case of using spine

chmod a+s /usr/bin/spine
cp /etc/spine.conf.dist /etc/spine.conf

vi /etc/spine.conf
# Add mysql connection information ...

chown wwwrun:root /etc/spine.conf
chmod 600 /etc/spine.conf


♦  Configuration of  monitoring taget servers

vi /etc/ssh/sshd_config

PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no
Match User cacti Address *,!IP_OF_CACTI_SERVER/32
ForceCommand /bin/false

useradd -d /home/cacti -s /bin/bash -g nobody cacti
mkdir ~cacti/.ssh
chown cacti:root ~cacti/.ssh
chmod 755 ~cacti/.ssh

# Copy from cacti server ...
cat >> ~cacti/.ssh/authorized_keys
vi /etc/apache2/httpd.conf

<IfModule mod_status.c>
  ExtendedStatus On
  <Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from localhost
GRANT SUPER, PROCESS ON *.* TO 'cacti'@'%' IDENTIFIED BY "secret";
# Connection test
ssh -i ~cacti/.ssh/id_rsa -p 30022 cacti@IP_OF_CACTI_SERVER


♦  Import percona plugins & templates #1 – mysql & ssh

cp ss_get_by_ssh.php ~cacti/scripts/
cp ss_get_mysql_stats.php ~cacti/scripts/

vi ~cacti/scripts/ss_get_by_ssh.php
# port of sshd , path of id_rsa ...

vi ~cacti/scripts/ss_get_mysql_stats.php
# mysql connection informations ...

chown wwwrun:root ~cacti/scripts/ss_get_mysql_stats.php
chmod 600 ~cacti/scripts/ss_get_mysql_stats.php

Import XML templetes from Web-UI


♦  Import percona plugins & templates #2 – mssql

# Downlod from
zypper install libfreetds freetds-tools
vi /etc/freetds.conf
# mssql connection informations ...

cp ss_win_mssql.php ~cacti/scripts/
vi ~cacti/scripts/ss_win_mssql.php 
# Add "array_shift" again to Line 11 (Maybe bug?) array_shift($_SERVER["argv"]);
# Disable Line 24-29, 72-73. (code for Memcached)

chown wwwrun:root ~cacti/scripts/ss_win_mssql.php
chmod 600 ~cacti/scripts/ss_win_mssql.php

Modify&run”sql_server_2005-2008.sql”on mssql server.

Import XML templetes from Web-UI. (cacti_host_template_windows_-_sql_server.xml)


♦  Import my additional templates

Aiden’s Multicore CPU templates for Cacti


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.