Stackstate-Cacti Integration

Overview

Connect Cacti to Stackstate to:

  • Visualize Cacti metrics in Stackstate.
  • Correlate metrics captured by Cacti with the rest of your applications.

Setup

Installation

The Cacti check is packaged with the Agent, so simply install the agent.

Configuration

To capture Cacti metrics you need to install the StackState Agent.

  1. Create a stackstate user with read-only rights to the Cacti database

    sudo mysql -e "create user 'stackstate'@'localhost' identified by '<password>';"
    sudo mysql -e "grant select on cacti.* to 'stackstate'@'localhost';"
    

  2. Check user and rights

    mysql -u stackstate --password=<password> -e "show status" | grep Uptime && echo -e "\033[0;32mMySQL user - OK\033[0m" || echo -e "\033[0;31mCannot connect to MySQL\033[0m"
    
    mysql -u stackstate --password=<password> -D cacti -e "select * from data_template_data limit 1" && echo -e "\033[0;32mMySQL grant - OK\033[0m" || echo -e "\033[0;31mMissing SELECT grant\033[0m"
    

  3. Configure the Agent to connect to MySQL, edit conf.d/cacti.yaml

    init_config:
    
    instances:
        -   mysql_host: localhost
            mysql_user: stackstate
            mysql_password: 
        Generate Password
    
            rrd_path: /path/to/cacti/rra
            #field_names:
            #    - ifName
            #    - dskDevice
            #    - ifIndex
            #rrd_whitelist: /path/to/rrd_whitelist.txt
    

  4. Give the sts-agent user access to the RRD files

    sudo gpasswd -a sts-agent www-data
    sudo chmod -R g+rx /var/lib/cacti/rra/
    sudo su - sts-agent -c 'if [ -r /var/lib/cacti/rra/ ];
    then echo -e "\033[0;31msts-agent can read the RRD files\033[0m";
    else echo -e "\033[0;31msts-agent can not read the RRD files\033[0m";
    fi'
    

Validation

Execute the info command and verify that the integration check has passed. The output of the command should contain a section similar to the following:

Checks
======

  [...]

  cacti
  -----
      - instance #0 [OK]
      - Collected 8 metrics & 0 events

Data Collected

Metrics

cacti.hosts.count
(gauge)
The number of hosts monitored by Cacti
shown as host
cacti.metrics.count
(gauge)
The number of metrics collected from Cacti
shown as
cacti.rrd.count
(gauge)
The number of Cacti RRD files
shown as file
system.disk.free.last
(gauge)
The amount of disk space that is free - last polling value
shown as byte
system.disk.free.max
(gauge)
The amount of disk space that is free - max polling value
shown as byte
system.disk.free.min
(gauge)
The amount of disk space that is free - min polling value
shown as byte
system.disk.used.last
(gauge)
The amount of disk space that is used - last polling value
shown as byte
system.disk.used.max
(gauge)
The amount of disk space that is used - max polling value
shown as byte
system.disk.used.min
(gauge)
The amount of disk space that is used - min polling value
shown as byte
system.load.1.last
(gauge)
The average system load over one minute - last polling value
shown as
system.load.1.max
(gauge)
The average system load over one minute - max polling value
shown as
system.load.1.min
(gauge)
The average system load over one minute - min polling value
shown as
system.load.15.last
(gauge)
The average system load over 15 minute - last polling value
shown as
system.load.15.max
(gauge)
The average system load over 15 minute - max polling value
shown as
system.load.15.min
(gauge)
The average system load over 15 minute - min polling value
shown as
system.load.5.last
(gauge)
The average system load over five minute - last polling value
shown as
system.load.5.max
(gauge)
The average system load over five minute - max polling value
shown as
system.load.5.min
(gauge)
The average system load over five minute - min polling value
shown as
system.mem.buffered.last
(gauge)
The amount of physical RAM used for file buffers - last polling value
shown as byte
system.mem.buffered.max
(gauge)
The amount of physical RAM used for file buffers - max polling value
shown as byte
system.mem.buffered.min
(gauge)
The amount of physical RAM used for file buffers - min polling value
shown as byte
system.ping.latency
(gauge)
The system ping latency - avg polling value
shown as millisecond
system.ping.latency.max
(gauge)
The system ping latency - max polling value
shown as millisecond
system.proc.running.last
(gauge)
The number of processes running - last polling value
shown as process
system.proc.running.max
(gauge)
The number of processes running - max polling value
shown as process
system.proc.running.min
(gauge)
The number of processes running - min polling value
shown as process
system.swap.free.max
(gauge)
The amount of free swap space - max polling value
shown as byte
system.users.current.last
(gauge)
The number of logged in users - last polling value
shown as
system.users.current.max
(gauge)
The number of logged in users - max polling value
shown as
system.users.current.min
(gauge)
The number of logged in users - min polling value
shown as