Cacti Monitoring Tool

The CSCF cacti install is located on watcher.cscf and is accessible via cacti.cscf.

Cacti Monitoring

Setup

Installation

  • Configure watcher.cscf to listen on cacti.cscf's IP:
  • Edit /etc/network/interfaces and add the following lines to the end:
          # cacti.cscf
          auto eth0:1
          iface eth0:1 inet static
              address 129.97.15.231
              netmask 255.255.255.0
              network 129.97.15.0
          
    • The eth0:1 interface represents an alias for eth0. You should make sure that eth0:1 is unique; you can use eth0:2, eth0:3, etc... if you need multiple aliases.
    • ifup eth0:1

  • Install Apache and add the cacti vhost:
    • sudo apt-get install apache2 libapache2-mod-php5
    • Edit (as root) /etc/apache2/sites-available/cacti and add the following lines:
              <VirtualHost cacti.cscf>
                  ServerName cacti.cscf.uwaterloo.ca
                  ServerAlias cacti cacti.cscf
                  DocumentRoot /usr/share/cacti/site
                  # redirect to fqdn
                  RewriteEngine On
                  RewriteCond %{HTTP_HOST} ^cacti$|^cacti\.cscf$ [NC]
                  RewriteRule ^(.*)$ http://cacti.cscf.uwaterloo.ca$1 [R=301,L]
              </VirtualHost>
              
    • Enable mod_rewrite: sudo a2enmod rewrite
    • Enable the cacti vhost: sudo a2ensite cacti

  • Install cacti (and dependencies)
    • sudo apt-get install mysql-server cacti
    • Restart apache: sudo invoke-rc.d apache2 restart
    • Go to http://cacti.cscf/ and configure cacti (defaults should be fine)
    • We need cacti 0.8.7 but Gutsy Gibbon only includes 0.8.6. To install 0.8.7:

Performance Tuning

  • First you'll want to add some additional indexes by executing the following mysql statements (after selecting the cacti db) (e.g. in phpmyadmin):
    • ALTER TABLE `data_input_data` ADD INDEX ( value(8) )
    • ALTER TABLE `data_input_data` ADD INDEX ( t_value )
    • ALTER TABLE `graph_templates_item` ADD INDEX ( task_item_id )
    • ALTER TABLE `data_template_data` ADD INDEX ( data_input_id )
    • ALTER TABLE `data_local` ADD INDEX ( data_template_id )
    • ALTER TABLE `data_local` ADD INDEX ( host_id )

  • I also compiled and installed spine, the cacti c-based poller, as the php-based one was very slow:
    • Download cacti-spine-0.8.7.tar.gz from http://cacti.net/spine_download.php
    • tar -xf cacti-spine-0.8.7.tar.gz; cd cacti-spine-0.8.7
    • aclocal; libtoolize --force; autoconf; autoheader; automake; ./configure
    • make
    • sudo make install
    • sudo cp spine.conf /etc/
    • sudo chmod o-r /etc/spine.conf
    • sudo nano /etc/spine.conf
      • Edit the login details, which you can find in /etc/cacti/debian.php
    • Goto Cacti Settings -> Paths and change the spine path to /usr/local/sbin/spine
    • Goto Cacti Settings -> Poller and change the poller type to spine

Usage

You must run add_device_and_graphs.php as root (e.g. 'sudo add_device_and_graphs.php ...') on watcher.cscf.

add_device_and_graphs.php

NAME
    add_device_and_graphs.php

SYNOPSIS
    add_device_and_graphs.php [options] template hostname [tree]

DESCRIPTION
    Adds hostname to cacti and creates all relevant graphs indicated by
    template. Note that template may a partial string, as long as the string
    matches unambiguously to a single host template. If tree is specified,
    then the host is inserted into the graph tree. Header may be a path of
    partial strings, separated by forward-slashes (e.g. linux/cpu).

    -n=name
        name of device; defaults to hostname

    -c=community
        the public/read community; default UofW

    -v=version
        the snmp version; default 2

    -p=port
        the snmp port; default 161

    -i=ethX[,ethY...]
        list of interfaces to graph; prompt for interfaces by default

    -i  
        graph all interfaces

    -i32
        use 32-bit counters (defaults to 64-bit counters); this is needed for
        Solaris hosts, NetApps, and UPSes

    -dio=disk[,disk...]
        list of disks to graph disk i/o for; prompt for disks by default

    [The following are planned features; they are currently incomplete]

    -ts=sensor[,sensor...]
        list of temperature sensors to graph; prompt for sensors by default

    -fs=sensor[,sensor...]
        list of fan sensors to graph; prompt for sensors by default

    -dt=disk[,disk...]
        list of disks to graph temperatures for; prompt for disks by default

AUTHOR
    Written by David Bartley (dtbartle).

delete_device_and_graphs.php

NAME
    delete_device_and_graphs.php

SYNOPSIS
    delete_device_and_graphs.php hostname

DESCRIPTION
    Deletes hostname and associated graphs from cacti.

AUTHOR
    Written by David Bartley (dtbartle).

add_combined_graph.php

NAME
    add_combined_graph.php

SYNOPSIS
    add_combined_graphs.php [options] title
    data-template[*snmp-field*snmp-value][^data-source-name] tree
    [source-trees ...]

DESCRIPTION
    Adds a combined graph. The data-template argument indicates the type of
    data to graph (e.g. Logged in Users) and may be a partial string. The
    graph will be created at the specified tree. The source-tree arguments
    indicate which trees or hosts to include in the graph. If source-tree is
    a tree all children hosts will be added.

    -f=functions
        a comma-separated list of functions to include; possible functions
        are max, min, avg, and cur

    -w=width
        graph width

    -h=height
        graph height

    -r=yes|y|no|n|p|prompt
        whether to replace graphs with the same title; the default is to
        prompt when a graph with the same title is found

AUTHOR
    Written by David Bartley (dtbartle).

Network Weathermap

Weathermap is an application that uses RRD files to make graphs of network flow. It has the ability to plugin to cacti:

wget http://www.network-weathermap.com/files/php-weathermap-0.95b.zip
tar xf http://www.network-weathermap.com/download
cp -a weathermap /usr/share/cacti/plugins/
cd /usr/share/cacti/site/plugins/weathermap
mkdir /var/lib/weathermap
mv configs /var/lib/weathermap
mv output /var/lib/weathermap
chown www-data:www-data /var/lib/weathermap/*:w
ln -s /var/lib/weathermap/configs configs
ln -s /var/lib/weathermap/output output
vim ../../include/global.php
  After $plugins = array(); add:
    $plugins[] = 'weathermap';

User permissions must now be configured. To this goto https://cacti.cscf.uwaterloo.ca/user_admin.php. You will need to go into each user, and set the relevant realm permissions. You should now have a Weathermaps entry on the menu and Weathermap tab.

-- DavidBartley

Edit | Attach | Watch | Print version | History: r7 < r6 < r5 < r4 < r3 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r7 - 2009-01-26 - LawrenceFolland
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback