There is a very nice open source snmp graphing and monitoring package avaiable called cacti. I have used it for almost a year now and have been very pleased with its functionality and ease of use.
Recently at work I had the need to graph a large number (300) of network devices and a handful of Linux servers. Being the sort of guy that would rather write scripts than manually enter 300 devices via the cacti web interface, I cobbled together some perl and php code. I had a list of network devices in a CSV file.
The format of the file is:
If you use the scripts below you will need to edit them to fit your own device data. They are provided for illustration purposes and will most likely not work for you “out of the box”.
Update See this thread for more advanced scripts.
Process to add hosts and create graphs for each
- fixCSV.pl Branches.CSV branches.csv
- Check branches.csv for empty IP address fields and remove
- mkBranchSql.pl branches.csv > branches.sql
- branches.sql ==> DB
- make_host_graph.pl branches.csv > host_graph.sql
- host_graph.sql ==> DB
- make_host_snmp_query.pl branches.csv > host_snmp_query.sql
- host_snmp_query.sql ==> DB
- foreach host_id do php run_data_query.php $host_id
- foreach host_id do php run_host_new_graphs.php $host_id
- Clear Poller Cache (php rebuild_poller_cache.php)
Process to add each host to proper state in graph tree
- create alphabetical flat file of state abbreviations, states
- mkBranchStatesSql.pl states > branches-states.sql
- branches-states.sql ==> DB
- mkGraphTreeSql.pl branches.csv > graph_tree_items.sql
- foreach host_id do php run_autocreate.php $host_id