
This software provides graph services in the context of the 
Spontaneous Networking Platform.

Uses nodexchange/cnml as a input format, and provides traffic and
latency/availability graphs in image format by using mrtg/rrdtool 
collected history by simple HTTP URLs, therefore is easily
plugable to any web application.

PREREQUISITES:
You must have rrdtool, rrdtool-perl, rrdtool-php, mrtg and php-gd
Optionally git, in order to checkout the files

INSTALL:

1.-Checkout the latest GIT version into a directory accessible by an http server:

example:
cd /var/www/html
git clone git://github.com/guifi/snpservices.git

To publish the directory, you might create an alias into the apache configuration 
for the directory:

Alias /snpservices /var/www/html/snpservices

2.-Make the directory snpservices/tmp writable to everybody
chmod a+rw snpservices/tmp

3.-Create a guifi service at the database. Use this url
http://yourserver/snpservices

4.-Copy the common/config.php.template to config.php and edit it to set your values.
In particular take attention to:
-Set the Service ID (SNPGraphServerId) to match your service created in the database
-Point MRTGConfigSource. If you don't have a cached CNML, use your Data server, be sure
 you specify the zone you are using as at the server parameter
-Point CNMLSource. Use your Data server

IMPORTANT: You can skip 5 & 6 if you don't have old files to rename, however is a good 
idea to execute the 'wget' commant just to be sure that you data server is ready to 
graph feed your server. Think that may take a while to be ready for exporting your data.

5.-If you have the rrd files in an old format (devicename*.rrd)
If you have old graph files which you like to retain, rename them into the new
format, by creating a script with the following format:
wget -O x.sh "http://snpservices.guifi.net/snpservices/graphs/cnml2mrtgcsv.php?cp&server=ServerID#"
Where the server number is the number of your server

6.-If you simply want a list of the files at another server, get a list from them with:
wget -O x.sh "http://snpservices.guifi.net/snpservices/graphs/cnml2mrtgcsv.php?list&server=ServerID#"
Where the server number is the number of your server

7.-Install a cron job to run the mrtg and refresh your configi every 5 mins:
Can be something like this:
cd /var/www/snpservices/graphs; php mrtgcsv2mrtgcfg.php; 
/usr/bin/mrtg ../data/mrtg.cfg --lock-file /var/lock/mrtg/guifi_l --confcache-file

