### WeatherMap4RRD-ng ### This is the re-make of weathermap4rrd by Alex Fontelle. Please check-out http://weathermap4rrd.tropicalex.net/. Code comes with no warranty! Code is distributed under GNU/GPL licence, so is weathermap4rrd. # READ FIRST! ## What is this about? - It's demo what can be done or, may be, how things shouldn't be done. - It's tribute to original weathermap4rrd and it's autor. - It's prolonged life to weathermap4rrd. - It's weathermap which runs under PHP5, thus has prolonged life of use. - I did it because I'm actually using it and thus it fits my needs. - Some features were added, some were removed. - It should be bug-free. Please report any bugs/problems. - Please let me know if you use this "thing". You'll make me happy and save the puppy. - Please don't send me any i-hate-you e-mails because of use of XML/XSL/XPath. It's the way it is and I think I know all pros and cons. - Good ideas are always welcome. But remember, it's weather map, not Nagios. # File structure of weathermap4rrd-ng wmp4rrd-ng/ |-- LICENSE |-- background - background images in png format; |-- changelog |-- css - css styles; |-- currentvalues.php - current values of specified link; |-- documentation.txt - this file; |-- graph.php - single graph in png format; |-- index.php |-- lib | |-- configfile.php - config parser, default vars; | |-- dlib.php | |-- graphic.php - graphic stuff, drawing; | `-- rrd.php - rrd handler; |-- modules | |-- drawmap.php - draws map; | |-- index.php - draws map, generates html output; | `-- linkgraph.php - outputs 3 graphs(html page); |-- nodeicons - node icons in png format; |-- overlib - overlib .js files; |-- weathermap.xml.example - example config file; `-- xsl `-- layout |-- layout.xsl - html layout; `-- linkgraph.xsl - linkgraph.php layout; # File structure of weathermap4rrd-ng-editor - please note here are only differences since editor is just module to weathermap4rrd-ng wmp4rrd-ng-editor/ |-- internode.php - outputs image of internode; |-- jscripts - JavaScript files; |-- label.php - outputs image of label; |-- legend.php - outputs image of legend; |-- modules | |-- editor.php - editor module; | |-- formglobal.php - global opts. module; | |-- formlink.php - link opts. module; | |-- formnode.php - node opts. module; |-- positioning.js - must be writeable, positions for editor; |-- resize.js - part of wz; |-- title.php - outputs image of title; |-- transparentpixel.gif - part of wz; |-- wz_dragdrop.js - drag'n'drop .js file; `-- xsl |-- js | `-- positioning.js - base for pos. file; `layout # Installation * GDlib 2.0.x with PNG support(v2.0.18 is recommended) * RRDtools * PHP5 configure options: --with-gd --with-pcre-regex --with-xsl --enable-xml * unpack and copy to your website. * don't forget to check write permissions(weathermap.xml, positioning.js - for editor). * edit lib/configfile.php, lib/rrd.php and change default vars according to your system. * for map out - http://yoursite/directory/index.php * for editor - http://yoursite/directory/index.php?module=editor # Tweaks ## absolute path - edit index.php and modify $path to the full path to index.php. - this tweak is optional and should help you save some resources, - since PHP will use static (full) paths instead of relative ones. ## "static" image - primary disadvantage is .xml config gets parsed everytime weathermap is viewed; - edit modules/index.php and change value 'private $staticout = 0;' to 1 in $PUBLIC path - edit modules/drawmap.php and change value 'private $imgtostdout = 0;' to 1 in $NONPUBLIC path - define outputfile in your .xml config file - copy index.php in doc_root to ie. drawmap-sh.php - edit drawmap-sh.php and add line: index.html; - edit modules/drawmap.php and change value 'private $imgtostdout = 0;' to 1 in $NONPUBLIC path ... ## how-to add more background images or node icons? - just copy images under background or nodeicons. - images must be in .png format. ## how to turn-on debug info? - edit lib/dlib.php and change: public $debug = 0; to 1; ## how to debug modules/drawmap.php - call drawmap module with parameter debug=1 - you can omit network test with parameter nonettest=0 - ie. http://localhost/index.php?module=drawmap&debug=1 ## scale X autoscale - these are concurrent settings - autoscale overrules scale - if no *scale is defined, then default autoscale takes place # ToDo - group filter; - solve "fixme" and "todo" comments in code,- mostly done; # Ideas - snippets such as "yellow papers" with commentary inside - "time travel"(history) which, I believe, is in weathermap4rrd - display only "%" instead of "% & values" ## Settings ### ## GLOBAL root | |-- arrowwidth - int; |-- autoscale | |-- nodivisons - int; | |-- rstart - 0-255(int); | |-- rend - 0-255(int); | |-- gstart - 0-255(int); | |-- gend - 0-255(int); | |-- bstart - 0-255(int); | `-- bend - 0-255(int); |-- background - path to background image; |-- drawgrid - turns on/off image grid(int); |-- font - font size(1-5pt on GD scale); |-- height - png image(map) height; |-- htmlfile - static out of index.php; |-- ipcheck - do node ip checks; 1 || 0; |-- link -> |-- legend | |-- x - legend x position; | |-- y - legend y position; | `-- legendstyle - legend style; original || line; |-- node -> |-- outputfile - path to png image out; |-- refresh - map(html) refresh time in seconds; |-- scale | `-- entry | |-- low - low value(int); | |-- high - high value(int); | |-- r - Red color(0-255); | |-- b - Blue color(0-255); | `-- g - Green color(0-255); |-- title | |-- bg //background color | | |-- r - Red color(0-255); | | |-- g - Green color(0-255); | | `-- b - Blue color(0-255); | |-- fg //foreground color | | |-- r - Red color(0-255); | | |-- g - Green color(0-255); | | `-- b - Blue color(0-255); | |-- text - legend title; | |-- x - title x position; | `-- y - title y position; `-- width - png image(map) width; # ## NODE --\ |-- name - xml node name; no whitespaces allowed(preg_replace active); |-- label - node label; |-- labeltype - label type square/round; |-- x - x position in map; |-- y - y position in map; |-- icon - path to icon png image; |-- iconx - icon x position in map(not relative to node pos!); |-- icony - icon y position in map(not relative to node pos!); |-- icontpt - icon transparency(0-100%) |-- iconresize - icon resize(?-?%); |-- ip - node ip address; depends - check; |-- check - ping || tcp:port; `-- nodeinfourl - url link; # ## LINK --\ |-- arrow - arrow type (normal || circle || halfarrow); |-- bandwidth - max link capacity(int); |-- displayvalue - display current bandwidth value(1 || 0); |-- group - ? group name; used for filtering(string); |-- from - link 'from' node($node->name); |-- inodegroup - internal var; unique random number(int(5)); |-- inpos - inbound traffic position in rrd file(int); |-- internode | |-- x - internode x position(int); | `-- y - internode y position(int); |-- internodedisplay - display internode(s)(1 || 0); |-- internodedisplaynum - display internode(s) number(s)(1 || 0); |-- linkoverlibgraph - 1 || linkgraph(eq.1) || currentvalues || custom_link; |-- linkinfourl - globalgraph || custom.php; |-- nodes - not used; deprecated by options 'from' and 'to'; |-- outpos - outbound traffic position in rrd file(int); |-- target - link input/output rrd file/mtrg page; |-- targetin - link input rrd file/mrtg page; |-- targetout - link output rrd file/mrtg page; |-- to - link 'to' node($node->name); `-- unit - kbits || Mbits || Kbytes || Mbytes;