What is FITB?
FITB (fit-bee) or "Fill in the blank" is a PHP and RRDtool based web interface designed to make polling every switch or router on your network easier. Think Cacti but simpler and automated.
FITB automatically polls every port on a list of switches you give it. It's feature list includes:
- Simple configuration: 1 line to add a new switch, just give it a name, address and SNMP community
- Precise polling: 1 minute poll intervals to make sure you never miss a spike in your network
- Easy searching: Search both interface aliases and names, and filter down by graph type and host
- Automatic discovery: FITB finds every port in use on the switch and graphs it, and stops when it goes down.
- Dynamic aggregate graph creation: shift click graphs to build on-the-fly aggregates and save them for later.
Screenshots and a guide to FITB are available here: http://www.flickr.com/photos/lozzd/sets/72157627375145065
- A webserver
- PHP (including CLI)
- Cron (to run the poller, although you can run by hand/in a loop)
- Some network switches supporting the standard network MIBs and SNMPv2
- Download/clone the repo into an appropriate folder either in your webservers directory or symlinked to it
Create a new database for FITB to keep it's state in. For example:
mysql> create database fitb; mysql> grant all on fitb.* to fitbuser@localhost IDENTIFIED BY 'f1tbP4ss';
Load the database structure into your database:
# mysql fitb < fitb.sql
Check permissions on the directory for your RRD files. By default, this is the "rrds" directory in the FITB root. Make sure this directory is writeable by the user you wish to run the poller as. Either as you, or create a new user just for FITB. Your webserver only needs read only access.
- Move config.php.sample to config.php, edit with your favourite editor and set the database connection information, and the path you created for your RRDs.
- At this point you should be able to load FITB in your browser without errors. Reward yourself with a beverage.
Configuring switches in FITB is designed to be as painless as possible. The procedure is as follows:
- Open config.php
- Copy a previous (or the example) line and edit it
- Save the file. The next time the poller runs (or when you run your poller) the graphs will be created.
The config line per switch is made up of the following:
"switchname" => array("prettyname" => "switchname", "enabled" => true, "showoninterface" => true, "ip" => "switchname.yourcompany.com", "snmpcommunity" => "public", "graphtypes" => array('bits','ucastpkts','errors')),
- switchname - The name used for the config file.
- prettyname - Generally keep this the same as above. Keep it simple.. It is used for the filename and in the interface
- enabled - True/false: Disables or enables polling of this host
- showoninterface - True/false: Allows you to hide a switch from the interface menus
- ip - The hostname or IP address of the host
- snmpcommunity - The SNMP community of the host
- graphtypes - An array of the types of graphs you want for this host. Currently supported:
- bits - bits/sec, in and out.
- ucastpkts - Unicast packets/sec, in and out.
- errors - Errors/sec in and out, and discards/sec in and out
- mcastpkts - Multicast packets/sec, in and out.
- bcastpkts - Broadcast packets/sec, in and out
Setting up polling
FITB is designed to poll every minute. To achieve this, I recommend setting up the poller parent to run in your favourite crond on your host.
*/1 * * * * /usr/bin/php /var/www/fitb/poller.php >> /var/www/fitb/poller.log 2>&1
The poller will spawn a child for every host in its configuration, and also run a cleanup job for any graphs due to be purged (purging of out of date/stale graphs is controlled from the config).
The poller child grabs the information for every port on that host, and if the port is in an UP state, creates/updates that port's graph. It also updates the port's alias if it has changed.
If a port goes down, it becomes marked as STALE and it will be pushed to the bottom of the interface. There is a configurable purge which also removes the graphs from the interface completely and removes the file from disk if it passes a certain age, thus keeping your disk clean of out of date ports.
The FITB interface
I highly suggest checking the screenshot guide for information on how the interface is laid out
The interface is designed to be as simple as possible: A small status line in the top right, along with the search function, and a list of hosts down the left.
As you drill down through the different graph types and hosts, the search filters in the top right change automatically. This means at any point you can expand or filter down your search to find the port you want quickly.
The search function allows for searching of both interface names and aliases, and the filter drop downs (graph type/host) update the view instantly.
There is a time period drop down in the top right that affects all the graphs in the current view. Due to FITB's 1 minute polling that means you can go down to a 5 minute view of any port.
Aggregate graphs can be created by shift-clicking desired component graphs. When one or more graphs have been added, a status indicator will appear on the bottom right of the page. Click the link in the status area to open the aggregate editor, fine tune your graph, and save for later. Note that this feature requires a modern browser.
- Your hosts must support SNMPv2, SNMPv1 did not have the information/resolution I required so it was written with v2 in mind. most switches support this though.
- Keep this inside your network. I can't be held responsible for massive security holes.
- PHP versions 5.3.0 and higher require that the time zone be explicitly set for date functions. You can either set your system date globally in php.ini, or you can set it in the config.php using a date_default_timezone_set() call.