Hello, Plenty of people have asked about how to get graphs remotely. You may have a JFFNMS system setup, and then a publically reachable webserver somewhere else and would like to display graphs on it, but not give everyone direct access to your NMS.
This is one way of doing it. Please be careful that you protect this URL you setup because, by default, this method may mean anyone who can hit your JFFNMS server can run pretty much any function they want, including deleting your entire JFFNMS database. The idea is to change one file on the JFFNMS server and then have the other webserver call this page to "pull through" the graph. On the jffnms server, edit or rename then edit, a file called htdocs/admin/satellite.php You want to remove the satellite checks and hard-code the sat_id to 1. The diff looks like: 11c7 < if ($jffnms_satellite_uri=="none") die("Satellite not configured.\n"); //we are not configured to be a satellite --- > // if ($jffnms_satellite_uri=="none") die("Satellite not > configured.\n"); //we are not configured to be a satellite 19c15 < if (!$sat_id) die("Destination Satellite not Specified.\n"); --- > $sat_id=1; Let's assume you call this file satellite2.php At this point anyone who knows the magic URLS can do anything the feel like, After the extract() function, you shoudl be checking the class and method variables to make sure you want them to be things you want. for example to only allow interface graphs: if ($class != 'interfaces' || $method != 'graph') { die "bad method"; } OK, on the server, you need to set some variables: $interface_id = the id of the interface you want to graph $graph_type_graph1 = the name of graph1, from graph types table $graph1_sx = size of graph1 in pixels $graph1_sy = size of graph2 in pixels $graph1_title = tile of graph1 "MyServer eth0" $start_time = unixtime of when the graph starts $stop_time = unixtime of when graph ends Let's say you want to graph: interface id 100 using the graphs plugin called "traffic" the graph will be 500x150 pixels title is "Server1 eth0" start time is 1139360340 stop time is 1139446740 You would do the following: <?php $params = array('100', 'traffic', '500', '150', 'Server1 eth0', 1139360340, 1139446740); $url = "http://jffnms.example.net/jffnms/admin/satellite2.php?capabilities=S&class=interfaces&method=graph&parms=".urlencode(serialize($params))."&sat_id=1"; $reply = ''; if ( ($fp = fopen($url, 'r')) != FALSE) { while(!feof($fp)) { $reply .= fgets($fp); } fclose($fp); $ok, data = unserialize($mystr); } // $data holds the base64 graph, dump to a file $fp = fopen('mygraph, 'wb+'); $graph_data = base64_decode($data); fputs($fp, $graph_data); fclose($fp); ?> <img src="mygraph"> - Craig -- Craig Small GnuPG:1C1B D893 1418 2AF4 45EE 95CB C76C E5AC 12CA DFA5 Eye-Net Consulting http://www.enc.com.au/ MIEE Debian developer csmall at : enc.com.au ieee.org debian.org ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642 _______________________________________________ jffnms-users mailing list jffnms-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jffnms-users