├── README.md ├── changes.diff ├── check-gdbug.php ├── check.php ├── configs ├── .htaccess └── index.php ├── data-pick.php ├── docs ├── example │ ├── Gradient_BK_800.png │ ├── Vera.ttf │ ├── VeraBI.ttf │ ├── VeraBd.ttf │ ├── VeraIt.ttf │ ├── VeraMoBI.ttf │ ├── VeraMoBd.ttf │ ├── VeraMoIt.ttf │ ├── VeraMono.ttf │ ├── VeraSe.ttf │ ├── VeraSeBd.ttf │ ├── background.png │ ├── example.conf │ ├── example.html │ ├── example.png │ ├── graph_image.png │ ├── graph_page.html │ ├── my_router.png │ └── overlib.js ├── fonts │ ├── PTC55F-webfont.ttf │ ├── PTC75F-webfont.ttf │ ├── PTN57F-webfont.ttf │ ├── PTN77F-webfont.ttf │ ├── PTS55F-webfont.ttf │ └── PTS75F-webfont.ttf ├── howto.pdf ├── howto.png ├── images │ ├── arrowstyle-classic.png │ ├── arrowstyle-compact.png │ ├── bwstyle-angled.png │ ├── bwstyle-classic.png │ ├── cacti_mainscreen.png │ ├── cacti_maps_manage.png │ ├── cacti_step1.png │ ├── cacti_step2.png │ ├── cacti_user_manage.png │ ├── cacti_wmap_settings.png │ ├── commentstyle-center.png │ ├── commentstyle-edge.png │ ├── compass-points.png │ ├── contrast.png │ ├── font-sizes.png │ ├── howto-thumb.jpg │ ├── keystyle-classic.png │ ├── keystyle-horizontal.png │ ├── keystyle-inverted.png │ ├── keystyle-tags.png │ ├── keystyle-vertical.png │ ├── labelangle+labeloffset.png │ ├── link-comments.png │ ├── linkoffset-defaults.png │ ├── linkoffset-east50west50.png │ ├── linkoffset-eastwest.png │ ├── linkoffset-parallel.png │ ├── linkoffset-radial.png │ ├── viastyle-angled.png │ ├── viastyle-curved.png │ ├── weathermap-example.png │ └── weathermap-mini.png ├── index.html ├── kube101 │ └── css │ │ └── kube.min.css ├── manual.css └── pages │ ├── advanced.html │ ├── cacti-plugin.html │ ├── changes.html │ ├── cli-reference.html │ ├── config-reference.html │ ├── editor.html │ ├── errorcodes.html │ ├── faq.html │ ├── install-cacti-editor.html │ ├── install-cacti.html │ ├── install-cli-editor.html │ ├── install-cli.html │ ├── main.html │ ├── targets.html │ └── upgrading.html ├── editor-resources ├── editor.css ├── editor.js ├── exclamation.png ├── index.php ├── jquery-latest.min.js └── oldeditor.css ├── editor.php ├── images ├── Cloud-Filled.png ├── Cloud-line.png ├── Firewall.png ├── HPMini.png ├── Host.png ├── PAD.png ├── Router.png ├── WorkgroupSwitch.png ├── application.png ├── application_side_list.png ├── application_xp_terminal.png ├── background1_950x625_197.jpg ├── blue-ball-64.png ├── blueboard1024.png ├── btn_recalc.png ├── button_editgroups.png ├── button_settings.gif ├── bw_gradient_1024.png ├── comment.png ├── cross.png ├── emoticon_smile.png ├── emoticon_unhappy.png ├── error.png ├── exclamation.png ├── filecabinet.png ├── flag_blue.png ├── flag_green.png ├── flag_orange.png ├── flag_pink.png ├── flag_purple.png ├── flag_yellow.png ├── green-ball-64.png ├── grey-ball-64.png ├── hollow32.png ├── index.php ├── monitor.png ├── page_white.png ├── red-ball-64.png ├── s_tab_weathermap.gif ├── s_tab_weathermap_red.gif ├── tab_weathermap.gif ├── tab_weathermap_red.gif ├── tick.png ├── uk1024.png ├── updown_0.png ├── updown_1.png ├── updown_2.png ├── world.png ├── world_link.png ├── wrench.png ├── wrench_orange.png └── yellow-ball-64.png ├── index.php ├── lib ├── .DS_Store ├── .htaccess ├── HTML_ImageMap.class.php ├── WeatherMap.functions.php ├── WeatherMap.keywords.inc.php ├── WeatherMapLink.class.php ├── WeatherMapNode.class.php ├── Weathermap.class.php ├── datasources │ ├── README.txt │ ├── WeatherMapDataSource_cactihost.php │ ├── WeatherMapDataSource_cactithold.php │ ├── WeatherMapDataSource_dbsample.php │ ├── WeatherMapDataSource_dsstats.php │ ├── WeatherMapDataSource_external.php.disabled │ ├── WeatherMapDataSource_fping.php │ ├── WeatherMapDataSource_mrtg.php │ ├── WeatherMapDataSource_rrd.php │ ├── WeatherMapDataSource_skeleton.php.txt │ ├── WeatherMapDataSource_snmp.php │ ├── WeatherMapDataSource_static.php │ ├── WeatherMapDataSource_tabfile.php │ ├── WeatherMapDataSource_time.php │ └── WeatherMapDataSource_wmdata.php ├── ds-common.php ├── editor.inc.php ├── index.php ├── poller-common.php ├── post │ └── WeatherMapPostProcessorExample.php └── pre │ └── WeatherMapPreProcessorExample.php ├── map-poller.php ├── navbar-custom-old.inc.php ├── navbar-custom.inc.php ├── overlib.js └── weathermap /README.md: -------------------------------------------------------------------------------- 1 | 1. Install the Weathermap in the Observium / LibreNMS folder 2 | 3 | ``` 4 | cd /opt/observium/html 5 | git clone https://github.com/ZerxXxes/weathermap-for-observium.git weathermap 6 | ``` 7 | 8 | 2. Edit data-pick.php and make sure the variables at the start are all ok. 9 | 10 | 3. Within editor.php, make sure you set $ENABLED=true and check the correct url for $weathermap_url; 11 | 12 | 4. Make the configs directory writeable by your web server, either chown apache:apache configs/ or chmod 777 configs (I'd highly advise you choose the first option, replace apache:apache with your web servers user and group.) 13 | 14 | 5. Point your browser to your install /weathermap/editor.php (i.e http://testurl.org/weathermap/editor.php) 15 | 16 | 6. Create your maps, please note when you create a MAP, please click Map Style, ensure Overlib is selected for HTML Style and click submit. 17 | 18 | 7. Enable the cron process: 19 | 20 | ``` 21 | */5 * * * * /opt/observium/html/weathermap/weathermap --config=/opt/observium/html/weathermap/configs/config.conf --image-uri=http://testurl.org/weathermap/maps/config.png 2>/dev/null 1>/dev/null 22 | ``` 23 | 24 | 8. If you are installing this into Observium then you can use the navbar-custom.inc.php by putting it into /opt/observium/html/includes/. 25 | 26 | **** IMPORTANT SECURITY ***** 27 | 28 | It is highly recommended that you set $ENABLED=false in editor.php when you are not editing maps as this is accessible by anyone unless you secure it via .htaccess or your web server config. 29 | -------------------------------------------------------------------------------- /changes.diff: -------------------------------------------------------------------------------- 1 | Only in weathermap.orig/: .DS_Store 2 | Only in weathermap/: .git 3 | Only in weathermap/: INSTALL 4 | diff -ur weathermap.orig/README weathermap/README 5 | --- weathermap.orig/README 2013-03-25 09:40:50.000000000 +0000 6 | +++ weathermap/README 2013-12-06 02:15:56.000000000 +0000 7 | @@ -1,3 +1,7 @@ 8 | +This is modified version of PHP Network Weathermap (orginal README is below) 9 | + 10 | +The modified version starts at version 0.1 by Neil Lathwood (neil@lathwood.co.uk) and currently includes basic support for picking out nodes and links from your observium install. See INSTALL for details. 11 | + 12 | This is PHP Network Weathermap, version 0.97b by Howard Jones (howie@thingy.com) 13 | 14 | See the docs sub-directory for full HTML documentation, FAQ and example config. 15 | Only in weathermap.orig/: cacti-pick.php 16 | Only in weathermap/: changes.diff 17 | Only in weathermap.orig/configs: simple.conf 18 | Only in weathermap/: data-pick.php 19 | diff -ur weathermap.orig/editor-resources/editor.js weathermap/editor-resources/editor.js 20 | --- weathermap.orig/editor-resources/editor.js 2013-04-02 23:57:10.000000000 +0100 21 | +++ weathermap/editor-resources/editor.js 2013-12-06 02:15:56.000000000 +0000 22 | @@ -92,7 +92,7 @@ 23 | 24 | if(fromplug===1) 25 | { 26 | - jQuery("#tb_newfile").click( function() {window.location = "weathermap-cacti-plugin-mgmt.php";} ) 27 | + jQuery("#tb_newfile").click( function() {window.location = "weathermap-observium-plugin-mgmt.php";} ) 28 | } 29 | else 30 | { 31 | @@ -126,8 +126,8 @@ 32 | jQuery('.wm_submit').click(do_submit); 33 | jQuery('.wm_cancel').click(cancel_op); 34 | 35 | - jQuery('#link_cactipick').click(cactipicker).attr("href","#"); 36 | - jQuery('#node_cactipick').click(nodecactipicker).attr("href","#"); 37 | + jQuery('#link_observiumpick').click(observiumpicker).attr("href","#"); 38 | + jQuery('#node_observiumpick').click(nodeobserviumpicker).attr("href","#"); 39 | 40 | jQuery('#xycapture').mouseover(function(event) {coord_capture(event);}); 41 | jQuery('#xycapture').mousemove(function(event) {coord_update(event);}); 42 | @@ -238,12 +238,12 @@ 43 | document.frmMain.submit(); 44 | } 45 | 46 | -function cactipicker() 47 | +function observiumpicker() 48 | { 49 | // make sure it isn't already opened 50 | if (!newWindow || newWindow.closed) 51 | { 52 | - newWindow = window.open("", "cactipicker", "scrollbars=1,status=1,height=400,width=400,resizable=1"); 53 | + newWindow = window.open("", "observiumpicker", "scrollbars=1,status=1,height=400,width=400,resizable=1"); 54 | } 55 | 56 | else if (newWindow.focus) 57 | @@ -252,17 +252,17 @@ 58 | newWindow.focus(); 59 | } 60 | 61 | - // newWindow.location = "cacti-pick.php?command=link_step1"; 62 | - newWindow.location = "cacti-pick.php?command=link_step1"; 63 | + // newWindow.location = "data-pick.php?command=link_step1"; 64 | + newWindow.location = "data-pick.php?command=link_step1"; 65 | } 66 | 67 | 68 | -function nodecactipicker() 69 | +function nodeobserviumpicker() 70 | { 71 | // make sure it isn't already opened 72 | if (!newWindow || newWindow.closed) 73 | { 74 | - newWindow = window.open("", "cactipicker", "scrollbars=1,status=1,height=400,width=400,resizable=1"); 75 | + newWindow = window.open("", "observiumpicker", "scrollbars=1,status=1,height=400,width=400,resizable=1"); 76 | } 77 | 78 | else if (newWindow.focus) 79 | @@ -271,7 +271,7 @@ 80 | newWindow.focus(); 81 | } 82 | 83 | - newWindow.location = "cacti-pick.php?command=node_step1"; 84 | + newWindow.location = "data-pick.php?command=node_step1"; 85 | } 86 | 87 | function show_context_help(itemid, targetid) 88 | @@ -630,11 +630,17 @@ 89 | jQuery('#link_commentposin').prepend(""); 90 | } 91 | 92 | - document.getElementById('link_nodename1').firstChild.nodeValue = mylink.a; 93 | - document.getElementById('link_nodename1a').firstChild.nodeValue = mylink.a; 94 | - document.getElementById('link_nodename1b').firstChild.nodeValue = mylink.a; 95 | + var mynode1 = Nodes[mylink.a]; 96 | + var mynode2 = Nodes[mylink.b]; 97 | + //document.getElementById('link_nodename1').firstChild.nodeValue = mylink.a; 98 | + document.getElementById('link_nodename1').firstChild.nodeValue = mynode1.label; 99 | + //document.getElementById('link_nodename1a').firstChild.nodeValue = mylink.a; 100 | + document.getElementById('link_nodename1a').firstChild.nodeValue = mynode1.label; 101 | + //document.getElementById('link_nodename1b').firstChild.nodeValue = mylink.a; 102 | + document.getElementById('link_nodename1b').firstChild.nodeValue = mynode1.label; 103 | 104 | - document.getElementById('link_nodename2').firstChild.nodeValue = mylink.b; 105 | + //document.getElementById('link_nodename2').firstChild.nodeValue = mylink.b; 106 | + document.getElementById('link_nodename2').firstChild.nodeValue = mynode2.label; 107 | 108 | document.getElementById('param').value = mylink.name; 109 | 110 | @@ -729,4 +735,4 @@ 111 | // add an onblur/onfocus handler to all the visible items 112 | 113 | jQuery("input").focus(help_handler).blur(help_handler); 114 | -} 115 | \ No newline at end of file 116 | +} 117 | diff -ur weathermap.orig/editor.php weathermap/editor.php 118 | --- weathermap.orig/editor.php 2013-04-10 23:14:36.000000000 +0100 119 | +++ weathermap/editor.php 2013-12-06 02:15:56.000000000 +0000 120 | @@ -15,10 +15,11 @@ 121 | 122 | // sensible defaults 123 | $mapdir='configs'; 124 | -$cacti_base = '../../'; 125 | -$cacti_url = '/'; 126 | -$ignore_cacti=FALSE; 127 | +$observium_base = '../../'; 128 | +$observium_url = '/'; 129 | +$ignore_observium=FALSE; 130 | $configerror = ''; 131 | +$whats_installed = ''; 132 | 133 | $config_loaded = @include_once 'editor-config.php'; 134 | 135 | @@ -29,7 +30,7 @@ 136 | 137 | if( isset($_COOKIE['wmeditor'])) 138 | { 139 | - $parts = split(":",$_COOKIE['wmeditor']); 140 | + //$parts = preg_split(":",$_COOKIE['wmeditor']); 141 | 142 | if( (isset($parts[0])) && (intval($parts[0]) == 1) ) { $use_overlay = TRUE; } 143 | if( (isset($parts[1])) && (intval($parts[1]) == 1) ) { $use_relative_overlay = TRUE; } 144 | @@ -42,30 +43,37 @@ 145 | } 146 | 147 | // check if the goalposts have moved 148 | -if( is_dir($cacti_base) && file_exists($cacti_base."/include/global.php") ) 149 | +if( is_dir($observium_base) && file_exists($observium_base."/config.php") ) 150 | { 151 | // include the cacti-config, so we know about the database 152 | - include_once($cacti_base."/include/global.php"); 153 | - $config['base_url'] = $cacti_url; 154 | - $cacti_found = TRUE; 155 | -} 156 | -elseif( is_dir($cacti_base) && file_exists($cacti_base."/include/config.php") ) 157 | -{ 158 | - // include the cacti-config, so we know about the database 159 | - include_once($cacti_base."/include/config.php"); 160 | - 161 | - $config['base_url'] = $cacti_url; 162 | - $cacti_found = TRUE; 163 | + include_once($observium_base."/config.php"); 164 | + include_once($observium_base."/includes/defaults.inc.php"); 165 | + //include_once($observium_base."/includes/definitions.inc.php"); 166 | + //include_once($observium_base."/includes/functions.php"); 167 | + //include_once($observium_base."html/includes/functions.inc.php"); 168 | + //include_once($observium_base."html/includes/authenticate.inc.php"); 169 | + //$config['base_url'] = $cacti_url; 170 | + $observium_found = TRUE; 171 | + if($config['project_name'] == 'LibreNMS') { 172 | + $whats_installed = 'LibreNMS'; 173 | + } else { 174 | + $whats_installed = 'Observium'; 175 | + } 176 | } 177 | else 178 | { 179 | - $cacti_found = FALSE; 180 | + $observium_found = FALSE; 181 | } 182 | 183 | -if($cacti_found && isset($plugins)) 184 | -{ 185 | - # here, we know we're part of a plugin - do auth stuff 186 | -} 187 | +//if ($_SESSION['userlevel'] < '5') 188 | +//{ 189 | +// include("$observium_base/html/includes/error-no-perm.inc.php"); 190 | +//} else { 191 | + 192 | +//if($observium_found && isset($plugins)) 193 | +//{ 194 | +// # here, we know we're part of a plugin - do auth stuff 195 | +//} 196 | 197 | if(! is_writable($mapdir)) 198 | { 199 | @@ -940,7 +948,7 @@ 200 | 210 | 'Hover' Graph URL 211 | 212 | - [Pick from Cacti] 213 | + [Pick from ] 214 | 215 | 216 | Icon Filename 217 | @@ -1114,7 +1122,7 @@ 218 | 219 |
220 |
221 | - Link from '%NODE1%' to '%NODE2%' 222 | + Link from '%NAME2%' to '%NODE2%' 223 |
224 | 225 | 226 | @@ -1136,8 +1144,8 @@ 227 | 228 | 229 | Data Source 230 | - [Pick 231 | - from Cacti] 232 | + [Pick 233 | + from ] 234 | 235 | 236 | Link Width 237 | @@ -1496,4 +1504,5 @@ 238 | 243 | Only in weathermap/lib: .DS_Store 244 | diff -ur weathermap.orig/lib/editor.inc.php weathermap/lib/editor.inc.php 245 | --- weathermap.orig/lib/editor.inc.php 2013-04-02 23:58:42.000000000 +0100 246 | +++ weathermap/lib/editor.inc.php 2013-12-06 02:15:56.000000000 +0000 247 | @@ -128,11 +128,12 @@ 248 | $errormessage .= $configerror.'

'; 249 | } 250 | 251 | - if (! $cacti_found && !$ignore_cacti) { 252 | - $errormessage .= '$cacti_base is not set correctly. Cacti integration will be disabled in the editor.'; 253 | - if ($config_loaded != 1) { 254 | - $errormessage .= " You might need to copy editor-config.php-dist to editor-config.php and edit it."; 255 | - } 256 | + if ( !$observium_found && !$ignore_observium) { 257 | + //$errormessage .= '$cacti_base is not set correctly. Cacti integration will be disabled in the editor.'; 258 | + //$errormessage .= "$observium_found and $ignore_observium"; 259 | + //if ($config_loaded != 1) { 260 | + //$errormessage .= " You might need to copy editor-config.php-dist to editor-config.php and edit it."; 261 | + //} 262 | } 263 | 264 | if ($errormessage != '') { 265 | Only in weathermap.orig/: logout.php 266 | Only in weathermap/: map-poller.php 267 | Only in weathermap.orig/: net-data.txt 268 | Only in weathermap.orig/: output 269 | Only in weathermap.orig/: random-bits 270 | Only in weathermap.orig/: setup.php 271 | diff -ur weathermap.orig/weathermap weathermap/weathermap 272 | --- weathermap.orig/weathermap 2013-04-02 20:50:32.000000000 +0100 273 | +++ weathermap/weathermap 2013-12-06 02:15:56.000000000 +0000 274 | @@ -37,6 +37,7 @@ 275 | "version", 276 | "help", 277 | "image-uri=", 278 | + "base-href=", 279 | "config=", 280 | "output=", 281 | "debug", 282 | @@ -85,6 +86,10 @@ 283 | $options_output['imageuri'] = $o[1]; 284 | break; 285 | 286 | + case '--base-href': 287 | + // $map->basehref=$o[1]; 288 | + $options_output['basehref'] = $o[1]; 289 | + break; 290 | case '--dumpconfig': 291 | //$map->dumpconfig=$o[1]; 292 | // $options_output['dumpconfig'] = $o[1]; 293 | @@ -163,6 +168,7 @@ 294 | print " --output {filename} - filename to write image. Default weathermap.png\n"; 295 | print " --htmloutput {filename} - filename to write HTML. Default weathermap.html\n\n"; 296 | 297 | + print " --base-href {uri} - URI for Weathermap, i.e /weathermap/\n"; 298 | print " --image-uri {uri} - URI to prefix tags in HTML.\n"; 299 | print " --bulge - Enable link-bulging mode. See manual.\n\n"; 300 | 301 | @@ -256,6 +262,7 @@ 302 | $fd=fopen($htmlfile, 'w'); 303 | fwrite($fd, 304 | ''); 305 | + fwrite($fd,"basehref\">"); 306 | if($map->htmlstylesheet != '') fwrite($fd,''); 307 | fwrite($fd,'' . $map->ProcessString($map->title, $map) . ''); 308 | 309 | Only in weathermap.orig/: weathermap-cacti-plugin-mgmt.php 310 | Only in weathermap.orig/: weathermap-cacti-plugin.css 311 | Only in weathermap.orig/: weathermap-cacti-plugin.php 312 | Only in weathermap.orig/: weathermap-cacti-rebuild.php 313 | Only in weathermap.orig/: weathermap.conf 314 | -------------------------------------------------------------------------------- /check-gdbug.php: -------------------------------------------------------------------------------- 1 | "); 15 | 16 | print wordwrap("This program will test if your PHP installation is using a buggy GD library."); 17 | print ($env=='CLI'?"\n\n":"\n

"); 18 | 19 | print wordwrap("If you are, you should either use PHP's built-in (aka 'bundled') GD library, or update to GD Version 2.0.34 or newer. Weathermap REQUIRES working Alpha support."); 20 | print ($env=='CLI'?"\n\n":"\n

"); 21 | 22 | print wordwrap("Let's see if you have the GD transparency bug..."); 23 | print ($env=='CLI'?"\n\n":"\n

"); 24 | print wordwrap("If you see no more output, or a segfault, then you do, and you'll need to upgrade."); 25 | print ($env=='CLI'?"\n\n":"\n

"); 26 | print wordwrap("If you get other errors, like 'undefined function', then run check.php to\nmake sure that your PHP installation is otherwise OK."); 27 | print ($env=='CLI'?"\n\n":"\n

"); 28 | print "Here we go..."; 29 | print ($env=='CLI'?"\n\n":"\n

"); 30 | 31 | // make sure even the affected folks can see the explanation 32 | ob_flush(); 33 | flush(); 34 | 35 | $temp_width = 10; 36 | $temp_height = 10; 37 | 38 | $node_im=imagecreatetruecolor($temp_width,$temp_height ); 39 | imageSaveAlpha($node_im, TRUE); 40 | $nothing=imagecolorallocatealpha($node_im,128,0,0,127); 41 | imagefill($node_im, 0, 0, $nothing); 42 | imagedestroy($node_im); 43 | 44 | print "...nope. We got past the risky part, so that's good.\nYour GD library looks healthy.\n"; 45 | print ($env=='CLI'?"\n":"\n

"); 46 | ?> -------------------------------------------------------------------------------- /configs/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Order deny,allow 3 | Deny from all 4 | 5 | -------------------------------------------------------------------------------- /configs/index.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /docs/example/Gradient_BK_800.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/Gradient_BK_800.png -------------------------------------------------------------------------------- /docs/example/Vera.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/Vera.ttf -------------------------------------------------------------------------------- /docs/example/VeraBI.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraBI.ttf -------------------------------------------------------------------------------- /docs/example/VeraBd.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraBd.ttf -------------------------------------------------------------------------------- /docs/example/VeraIt.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraIt.ttf -------------------------------------------------------------------------------- /docs/example/VeraMoBI.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraMoBI.ttf -------------------------------------------------------------------------------- /docs/example/VeraMoBd.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraMoBd.ttf -------------------------------------------------------------------------------- /docs/example/VeraMoIt.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraMoIt.ttf -------------------------------------------------------------------------------- /docs/example/VeraMono.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraMono.ttf -------------------------------------------------------------------------------- /docs/example/VeraSe.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraSe.ttf -------------------------------------------------------------------------------- /docs/example/VeraSeBd.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/VeraSeBd.ttf -------------------------------------------------------------------------------- /docs/example/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/background.png -------------------------------------------------------------------------------- /docs/example/example.conf: -------------------------------------------------------------------------------- 1 | # 2 | # some initial comments... 3 | # 4 | # This sample configuration file demonstrates most of the basic features of 5 | # PHP Weathermap, along with some of the cosmetic and layout changes possible 6 | # 7 | # NOTE: to use this file as it stands, you need to keep it together with 8 | # the relevant font, background and icon image files. 9 | 10 | 11 | BACKGROUND background.png 12 | HTMLOUTPUTFILE example.html 13 | IMAGEOUTPUTFILE example.png 14 | TITLE Network Overview 15 | HTMLSTYLE overlib 16 | KEYPOS 10 400 17 | 18 | # define some new TrueType fonts - built-in ones go from 1 to 5, so start high 19 | FONTDEFINE 100 ./VeraIt.ttf 8 20 | FONTDEFINE 101 ./Vera.ttf 12 21 | FONTDEFINE 102 ./Vera.ttf 9 22 | 23 | KEYFONT 102 24 | 25 | LINK DEFAULT 26 | BANDWIDTH 100M 27 | BWLABEL bits 28 | BWFONT 100 29 | OVERLIBWIDTH 395 30 | OVERLIBHEIGHT 153 31 | WIDTH 4 32 | 33 | NODE DEFAULT 34 | LABELFONT 101 35 | 36 | NODE transit 37 | POSITION 400 180 38 | LABEL TRANSIT 39 | 40 | # a little splash of background colour for these nodes 41 | NODE isp1 42 | POSITION 250 100 43 | LABEL ISP1 44 | INFOURL http://www.isp1.com/support/lookingglass.html 45 | LABELBGCOLOR 255 224 224 46 | 47 | NODE isp2 48 | POSITION 550 100 49 | LABEL ISP2 50 | INFOURL http://www.isp2.net/portal/ 51 | LABELBGCOLOR 224 255 224 52 | 53 | NODE core 54 | POSITION 400 300 55 | LABEL core 56 | INFOURL https://core.mynet.net/admin/ 57 | 58 | NODE customer1 59 | LABEL xy.com 60 | POSITION 150 370 61 | 62 | NODE customer2 63 | LABEL ww.co.uk 64 | POSITION 250 450 65 | 66 | NODE infra 67 | LABEL INFRASTRUCTURE 68 | POSITION 450 450 69 | 70 | # this node has an icon, and so we push the label to the South edge of it, so it 71 | # can still be read 72 | NODE sync 73 | LABEL Sync 74 | ICON my_router.png 75 | LABELOFFSET S 76 | LABELFONT 2 77 | POSITION 550 370 78 | # the icon is taken from a Nagios icon pack: 79 | # http://www.nagiosexchange.org/Image_Packs.75.0.html?&tx_netnagext_pi1[p_view]=110&tx_netnagext_pi1[page]=10%3A10 80 | 81 | NODE site1 82 | LABEL site1 83 | POSITION 700 220 84 | 85 | NODE site2 86 | LABEL site2 87 | POSITION 750 420 88 | 89 | LINK sync-core 90 | NODES sync core 91 | TARGET data/sync_traffic_in_259.rrd 92 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=256&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 93 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=256 94 | # 95 | # Site1 has two E1s, so we use NODE-offsets to allow them to run parallel 96 | # 97 | 98 | LINK sync-site1a 99 | NODES sync:N site1:W 100 | WIDTH 3 101 | TARGET data/sync_traffic_in_257.rrd 102 | BANDWIDTH 2M 103 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=254&rra_id=0&graph_nolegend=true&graph_height=100&graph_width= 104 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=126 105 | 106 | LINK sync-site1b 107 | NODES sync:E site1:SE 108 | WIDTH 3 109 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=255&rra_id=0&graph_nolegend=true&graph_height=100&graph_width= 110 | TARGET data/sync_traffic_in_258.rrd 111 | BANDWIDTH 2M 112 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=56 113 | 114 | # 115 | # site2 also has two links, but this time we use the VIA to curve the links 116 | # 117 | LINK sync-site2a 118 | NODES sync site2 119 | WIDTH 3 120 | VIA 650 380 121 | TARGET data/sync_traffic_in_251.rrd 122 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=248&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 123 | BANDWIDTH 1M 124 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=252 125 | 126 | LINK sync-site2b 127 | NODES sync site2 128 | WIDTH 3 129 | VIA 650 420 130 | TARGET data/sync_traffic_in_252.rrd 131 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=228&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 132 | BANDWIDTH 1M 133 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=561 134 | 135 | # 136 | # ISP 1 has a several links, again, but they prefer to see one arrow, and the aggregate bandwidth 137 | # so we use multiple TARGETs on one line, here, to sum the data 138 | 139 | LINK transit-isp1 140 | NODES transit isp1 141 | TARGET data/trans1_traffic_in_352.rrd data/trans1_traffic_in_378.rrd data/trans1_traffic_in_420.rrd 142 | BANDWIDTH 10M 143 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=355&rra_id=0&graph_nolegend=true&graph_height=100&graph_width= 144 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=633 145 | 146 | LINK transit-isp2 147 | NODES transit isp2 148 | TARGET data/trans1_traffic_in_438.rrd 149 | BANDWIDTH 34M 150 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=433&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 151 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=265 152 | 153 | LINK core-transit 154 | NODES transit core 155 | TARGET data/trans1_traffic_in_350.rrd 156 | ARROWSTYLE compact 157 | WIDTH 4 158 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=347&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 159 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=122 160 | 161 | LINK cust1-core 162 | NODES customer1 core 163 | TARGET data/extreme_traffic_in_299.rrd 164 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=296&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 165 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=237 166 | 167 | LINK cust2-core 168 | NODES customer2 core 169 | TARGET data/extreme_traffic_in_286.rrd 170 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=283&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 171 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=222 172 | 173 | LINK infra-core 174 | NODES infra core 175 | TARGET data/extreme_traffic_in_294.rrd 176 | OVERLIBGRAPH http://support.mynet.net/cacti/graph_image.php?local_graph_id=291&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300 177 | INFOURL http://support.mynet.net/cacti/graph.php?rra_id=all&local_graph_id=228 178 | -------------------------------------------------------------------------------- /docs/example/example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/example.png -------------------------------------------------------------------------------- /docs/example/graph_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/graph_image.png -------------------------------------------------------------------------------- /docs/example/graph_page.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | Your router history 7 | 8 | 9 | 10 | 11 |

Your history here

12 |
13 | 14 |
15 | 16 |

And this would normally be a page within your Cacti or MRTG system.

17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/example/my_router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/example/my_router.png -------------------------------------------------------------------------------- /docs/fonts/PTC55F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/fonts/PTC55F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTC75F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/fonts/PTC75F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTN57F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/fonts/PTN57F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTN77F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/fonts/PTN77F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTS55F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/fonts/PTS55F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTS75F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/fonts/PTS75F-webfont.ttf -------------------------------------------------------------------------------- /docs/howto.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/howto.pdf -------------------------------------------------------------------------------- /docs/howto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/howto.png -------------------------------------------------------------------------------- /docs/images/arrowstyle-classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/arrowstyle-classic.png -------------------------------------------------------------------------------- /docs/images/arrowstyle-compact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/arrowstyle-compact.png -------------------------------------------------------------------------------- /docs/images/bwstyle-angled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/bwstyle-angled.png -------------------------------------------------------------------------------- /docs/images/bwstyle-classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/bwstyle-classic.png -------------------------------------------------------------------------------- /docs/images/cacti_mainscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/cacti_mainscreen.png -------------------------------------------------------------------------------- /docs/images/cacti_maps_manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/cacti_maps_manage.png -------------------------------------------------------------------------------- /docs/images/cacti_step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/cacti_step1.png -------------------------------------------------------------------------------- /docs/images/cacti_step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/cacti_step2.png -------------------------------------------------------------------------------- /docs/images/cacti_user_manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/cacti_user_manage.png -------------------------------------------------------------------------------- /docs/images/cacti_wmap_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/cacti_wmap_settings.png -------------------------------------------------------------------------------- /docs/images/commentstyle-center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/commentstyle-center.png -------------------------------------------------------------------------------- /docs/images/commentstyle-edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/commentstyle-edge.png -------------------------------------------------------------------------------- /docs/images/compass-points.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/compass-points.png -------------------------------------------------------------------------------- /docs/images/contrast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/contrast.png -------------------------------------------------------------------------------- /docs/images/font-sizes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/font-sizes.png -------------------------------------------------------------------------------- /docs/images/howto-thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/howto-thumb.jpg -------------------------------------------------------------------------------- /docs/images/keystyle-classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/keystyle-classic.png -------------------------------------------------------------------------------- /docs/images/keystyle-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/keystyle-horizontal.png -------------------------------------------------------------------------------- /docs/images/keystyle-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/keystyle-inverted.png -------------------------------------------------------------------------------- /docs/images/keystyle-tags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/keystyle-tags.png -------------------------------------------------------------------------------- /docs/images/keystyle-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/keystyle-vertical.png -------------------------------------------------------------------------------- /docs/images/labelangle+labeloffset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/labelangle+labeloffset.png -------------------------------------------------------------------------------- /docs/images/link-comments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/link-comments.png -------------------------------------------------------------------------------- /docs/images/linkoffset-defaults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/linkoffset-defaults.png -------------------------------------------------------------------------------- /docs/images/linkoffset-east50west50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/linkoffset-east50west50.png -------------------------------------------------------------------------------- /docs/images/linkoffset-eastwest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/linkoffset-eastwest.png -------------------------------------------------------------------------------- /docs/images/linkoffset-parallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/linkoffset-parallel.png -------------------------------------------------------------------------------- /docs/images/linkoffset-radial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/linkoffset-radial.png -------------------------------------------------------------------------------- /docs/images/viastyle-angled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/viastyle-angled.png -------------------------------------------------------------------------------- /docs/images/viastyle-curved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/viastyle-curved.png -------------------------------------------------------------------------------- /docs/images/weathermap-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/weathermap-example.png -------------------------------------------------------------------------------- /docs/images/weathermap-mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/docs/images/weathermap-mini.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Start Here 7 | 8 | 9 | 10 |
11 |
12 | 13 | 20 | 21 | 22 | 23 |

New 24 | Users should start here.

25 | 26 |

Documentation Guide

27 |

New in 0.97b, there is a Security Notes section that you should read.

28 | 29 |

There are several sections, including 30 | Introduction, 31 | Installation, 32 | The Basics, 33 | FAQ, 34 | Reference, and 35 | Advanced Topics. There are seperate 36 | pages for the 37 | Cacti Plugin, and for the 38 | optional web-based editor. There is also a 39 | reference page for 40 | all the error codes that Weathermap can 41 | produce, with an explanation, and another 42 | reference for the built-in datasource 43 | plugins.

44 | 45 |

For existing users, there's an overview to the 46 | changes from the previous version, and a 47 | guide to upgrading.

48 | 49 |

There are also a growing number of articles at 50 | network-weathermap.com 51 | about specific tricks and techniques for making your own maps, including 52 | animation, non-network maps and more!

53 | 54 |

What I'm trying to say is 55 | RTFM, 56 | but in a more polite way! 57 | :-) I put a fair amount of my own time and effort into writing the 58 | program, and then a whole bunch 59 | more into writing the manual and other documentation - more than a thousand hours by now. I also spend my 60 | spare time supporting Weathermap users [I'm one of the all-time most active users on the Cacti forums], but a lot of questions asked are 61 | answered in the manual, or worse still, in the FAQ section. 62 | Please take a look.

63 | 64 |

Visual Guides

65 | 66 |

If you are more visually-minded, like me, then the following might also help:

67 | 68 |
69 |
70 |

71 | 72 |

73 | 74 |

Diagram explaining a lot of the basic map 75 | formatting commands. Look in the 76 | Configuration Reference 77 | for more information on the commands mentioned. 78 | 79 |
Larger version | 80 | PDF version

81 |
82 | 83 |
84 |

85 | 86 |

87 | 88 |

Sample output from php-weathermap, using data 89 | collected by Cacti and MRTG. 90 | 91 |
Larger version

92 |

This is from the Example Map section of the manual.

93 |
94 |
95 | 96 |
97 | 98 |
99 |
100 | 101 | 102 | -------------------------------------------------------------------------------- /docs/manual.css: -------------------------------------------------------------------------------- 1 | @font-face {font-family: 'PT Sans'; 2 | src: url('fonts/pts55f_w.eot'); 3 | src: local('PT Sans'), url('fonts/PTS55F_W.woff') format('woff'),url('fonts/PTS55F-webfont.ttf') format('truetype'), url('fonts/PTS55F_W.svg#PTSans-Regular') format('svg');} 4 | 5 | @font-face {font-family: 'PT Sans'; 6 | font-style: italic; 7 | src: url('fonts/pts56f_w.eot'); 8 | src: local('PT Sans Italic'), url('fonts/PTS56F_W.woff') format('woff'),url('fonts/PTS56F-webfont.ttf') format('truetype'), url('fonts/PTS56F_W.svg#PTSans-Italic') format('svg');} 9 | 10 | @font-face {font-family: 'PT Sans'; 11 | src: url('fonts/pts75f_w.eot'); 12 | font-style: normal; 13 | font-weight: bold; 14 | src: local('PT Sans Bold'), url('fonts/PTS75F_W.woff') format('woff'),url('fonts/PTS75F-webfont.ttf') format('truetype'), url('fonts/PTS75F_W.svg#PTSans-Bold') format('svg');} 15 | 16 | @font-face {font-family: 'PT Sans'; 17 | font-style: italic; 18 | font-weight: bold; 19 | src: url('fonts/pts76f_w.eot'); 20 | src: local('PT Sans Bold Italic'), url('fonts/PTS76F_W.woff') format('woff'),url('fonts/PTS76F-webfont.ttf') format('truetype'), url('fonts/PTS76F_W.svg#PTSans-BoldItalic') format('svg');} 21 | 22 | .tocentry { padding-right: 1em; } 23 | 24 | body { 25 | font-family: 'PT Sans', Helvetica, Arial, sans-serif; 26 | font-size: 15px; 27 | min-width: 960px; 28 | } 29 | 30 | .wrapper { 31 | margin: auto; 32 | width: 940px; 33 | padding: 0 10px; 34 | clear: both; 35 | } 36 | 37 | figure { margin-bottom: 1.5em; 38 | padding-left: 1.5em; 39 | } 40 | 41 | .changes dl { padding-left: 1.5em; } 42 | 43 | .definition { 44 | padding-left: 1.5em; 45 | overflow: hidden; 46 | margin-bottom: 1em; 47 | border-radius: 3px; 48 | background: #ffffff; 49 | background: -moz-linear-gradient(top, #ffffff 0%, #e5e5e5 100%); 50 | background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ffffff), color-stop(100%,#e5e5e5)); 51 | background: -webkit-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); 52 | background: -o-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); 53 | background: -ms-linear-gradient(top, #ffffff 0%,#e5e5e5 100%); 54 | background: linear-gradient(to bottom, #ffffff 0%,#e5e5e5 100%); 55 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#e5e5e5',GradientType=0 ); 56 | box-shadow: 0 1px 2px rgba(0, 0, 0, .5); 57 | } 58 | 59 | .examples blockquote { border: none;} 60 | blockquote.example { border: none;} 61 | 62 | tt.clioption { font-weight: bold; font-size: 105%; white-space: nowrap; } 63 | #content { margin-top: 1em; } 64 | 65 | #nav { 66 | width:100%; 67 | overflow:hidden; 68 | /* (en|de) Bugfix:IE - collapsing horizontal margins */ 69 | position:relative; 70 | line-height:1em; 71 | background: #222; 72 | 73 | } 74 | 75 | #nav ul { 76 | margin:0; 77 | padding: 0.5em 1.5em; 78 | /* (en|de) Bugfix:IE - Doubled Float Margin Bug */ 79 | display:inline; 80 | float:left; /* LTR */ 81 | } 82 | 83 | #nav ul li { 84 | /* (en|de) Bugfix:IE - Doubled Float Margin Bug */ 85 | display:inline; 86 | float:left; /* LTR */ 87 | font-size:1.0em; 88 | line-height:1em; 89 | list-style-type:none; 90 | margin: 0 .25em 0 0; 91 | padding:0; 92 | } 93 | 94 | #nav ul li a, 95 | #nav ul li strong { 96 | background:transparent; 97 | color:#aaa; 98 | display:block; 99 | font-size:1em; 100 | line-height: 2em; 101 | padding: 0 0.5em; 102 | font-weight:normal; 103 | text-decoration:none; 104 | text-shadow: 0 1px 1px rgba(0,0,0,.5); 105 | width:auto; 106 | } 107 | 108 | #nav ul li a:focus, 109 | #nav ul li a:hover, 110 | #nav ul li a:active { 111 | color: #ccc; 112 | background:#666; 113 | background: rgba(255,255,255,.25); 114 | -webkit-border-radius: 0.2em; 115 | -moz-border-radius: 0.2em; 116 | border-radius: 0.2em; 117 | text-decoration:none; 118 | outline: 0 none; 119 | } 120 | 121 | #nav ul li.active { 122 | background:#666; 123 | background: rgba(255,255,255,.3); 124 | -webkit-border-radius: 0.2em; 125 | -moz-border-radius: 0.2em; 126 | border-radius: 0.2em; 127 | color: #fff; 128 | } 129 | 130 | #nav ul li.active strong, 131 | #nav ul li.active a:focus, 132 | #nav ul li.active a:hover, 133 | #nav ul li.active a:active { 134 | background:transparent; 135 | color:#fff; 136 | text-decoration:none; 137 | } -------------------------------------------------------------------------------- /docs/pages/cli-reference.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Command-line option Reference 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 | 38 |
39 |

Command-line options Reference

The unix 40 | man-style specification for weathermap is: 41 | 42 |
43 | ./weathermap [--config configfile] [--output 44 | pngfile] [--htmloutput htmlfile] [--image-uri 45 | URI] [--debug] [--dumpafter] [--dumpconfig 46 | newconfigfile] [--sizedebug] [--define var=value] 47 |
As you can see, 48 | all the parameters are optional! By default the script will look 49 | for a configuration file called 50 | weathermap.conf, and produce a PNG image file called 51 | weathermap.png. 52 | 53 |

Options

54 |

--output is used to specify the name of the PNG file that is 55 | created. This can also now be specified inside the configuration file, 56 | instead.

57 | 58 |

--config is used to specify the name of the configuration 59 | file that is read.

60 | 61 |

--debug enables a lot of chatty debug output that may be 62 | useful in the event of a problem. In case 63 | --debug isn't verbose enough for you, 64 | --dumpafter dumps the whole of the internal structure used by 65 | weathermap at the end of a run. Note that particularly with PHP 4.x, 66 | it's possible that this will never end, as the way that references to 67 | objects are handled has changed between PHP 4 and PHP 5.

68 | 69 |

--dumpconfig writes out a new configuration file after 70 | reading in the specified one. This is useful when migrating older 71 | configuration files, as it will remove extra stuff made redundant by the 72 | newer 'default link and node' style of 73 | configuration. Obviously, you should be careful not to overwrite your 74 | existing configuration files!

75 | 76 |

--sizedebug simply tells weathermap to draw the links with 77 | themaximum bandwidth shown, not the current. It only works if 78 | BWLABEL is set to 'bits', but it is useful for checking you have the 79 | right sized links once you have finished your map.

80 | 81 |

--define allows you to define additional internal variables 82 | for this run. It is equivalent to a 83 | SET line in the global 84 | section of the map configuration file.

85 | 86 |

--htmloutput specifies the name for an HTML file to be 87 | generated to go with the PNG image file. This HTML can include imagemap 88 | and DHTML features to make your weathermap interactive to different 89 | degrees. This is governed by the 90 | HTMLSTYLE 91 | global setting, and INFOURL and 92 | OVERLIBGRAPH settings in NODE and LINK definitions. This can 93 | also now be specified inside the configuration file, instead.

94 | 95 |

--image-uri specifies the URI used in an HTML file 96 | generated. If you are generating HTML in a different directory from the 97 | one the image is created, then weathermap will probably get the <img 98 | src=""> tag wrong. This option allows you to override the contents of 99 | the src attribute, if you know better.

100 |
101 |
102 |
103 | 104 | 105 | -------------------------------------------------------------------------------- /docs/pages/editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - The Map Editor 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 |

The Map Editor

38 | 39 |

Note: This section is basically unaltered from 40 | the v0.7 manual. The editor hasn't really changed since then, except to fix 41 | some bugs, and work with the new config directives 42 | - that is to say, it won't edit them, but nor will it remove/damage them. 43 | It's still true to say that the editor is the easiest way to initially lay 44 | out your map, and pick your TARGETs if you use Cacti, but after that, some 45 | hand-editing will help with cosmetics. 46 |

47 | 48 |

New in version 0.7, there is a partially-complete interactive editor 49 | included. In this release, it allows for visual layout of nodes and links, 50 | modification of most parameters, and some integration with Cacti for picking 51 | data-sources. 52 | It is not integrated into Cacti's management pages, OR access 53 | control.

54 | 55 |

To use the editor, you need to make a few extra considerations beyond 56 | those needed by the command-line weathermap software, as detailed in the 57 | Installation Guide. 58 |

59 | 60 |

61 | Once you have all that taken care of, put a copy of one of your 62 | configuration files into the configs directory you just created, and then go 63 | to: http://www.your.web.server/cacti/php-weathermap/editor.php (or 64 | whereever you put it). You should get a menu to either create a map, or open 65 | the ones you just put in that directory. 66 |

67 | 68 |

69 | Hopefully, the actual editor is fairly self-explanatory. 70 | 71 |

    72 |
  • You can click on any existing node or link to get it's properties 73 | and change them.
  • You can delete a node or link from the 74 | properties box. For nodes, you can move them from the properties box 75 | too.
  • You can move the key or timestamp by clicking on them, 76 | also.
  • If you set up the Cacti-related options in the 77 | editor-config.php file, then you should also see an additional option to 78 | pick a data source directly from Cacti, in the Link Properties 79 | box.
  • To create a new node, choose the 'Add Node' button at the 80 | top and then click on the map where you want the node to be.
  • To 81 | create a new link, choose the 'Add Link' button then click on the two 82 | nodes to link together, in turn. There are separate buttons at the top 83 | for changing various global parameters.
  • 84 | 85 |
  • There is no save 86 | - Every change is written back to the configuration file immediately. 87 | Make a backup copy if you feel the need to.
  • 88 |
89 |

90 | 91 |

92 | There are a number of things not editable in the editor currently: 93 | 94 |

    95 |
  • background images and icons 96 | - it's intended that the editor will allow you to upload image files to 97 | the server, which will then appear in a list where appropriate.
  • 98 | 99 |
  • colours 100 | - there's no way to pick colours currently, either for the map elements 101 | or for the scale.
  • 102 | 103 |
  • defaults 104 | - the editor lags behind the current command-line software here. It 105 | generates 'old-style' global options for some features where the correct 106 | thing to do is make changes to the DEFAULT link and node definitions. 107 | Similarly, there is no per-node or per-link adjustment of things like 108 | font, label style or label offset.
  • 109 | 110 |
  • NODE TARGETs
  • 111 | 112 |
  • Multiple SCALEs
  • 113 | 114 |
  • Curves
  • 115 | 116 |
  • Link offsets or Label offsets
  • 117 |
118 | 119 | Luckily, the editor shouldn't damage any of these things that you put into 120 | the configuration file by hand, so it's safe to do some work in the editor 121 | where it's quicker or more intuitive, and then fine-tune the file by hand. 122 |

123 | 124 |
125 |
126 | 127 | 128 | -------------------------------------------------------------------------------- /docs/pages/install-cacti-editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Installation - Cacti Plugin & Editor 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 | 38 |

Installation

39 | 40 |

Cacti plugin and Editor

41 | 42 |

Requirements

43 | 44 |

Before doing anything else, please verify that your 45 | Plugin Architecture is working 46 | properly with a simpler plugin, like 47 | Links or 48 | Tools. Weathermap is relatively 49 | complex, and fault-finding both your Cacti Plugin Architecture and 50 | Weathermap at the same time will make life harder for you!

51 | 52 |

You will need the 'pcre' and 'gd' PHP modules in 53 | both your command-line and server-side (mod_php/ISAPI) PHP. The 54 | poller-process runs using the command-line PHP, and the editor uses the 55 | server-side one. In some situations it is possible to have two completely 56 | different PHP installations serving these two 57 | - if you install from a package, then re-install from source, but to a 58 | different directory, for example. The editor and the poller process should 59 | both warn you if the part they need is not present.

60 | 61 |

You can then use the pre-install checker to see if your PHP environment 62 | has everything it needs. To do this, you need to run a special 63 | check.php script, twice...

64 | 65 |

First, go to http://yourcactiserver/plugins/weathermap/check.php to see 66 | if your webserver PHP (mod_php, ISAPI etc) is OK. Then, from a 67 | command-prompt run 68 | php check.php to see if your command-line PHP is OK. If any modules 69 | or functions are missing, you will get a warning, and an explanation of what 70 | will be affected (not all of the things that are checked are deadly 71 | problems).

72 | 73 |

Before you start using it, you might want to change one PHP setting. 74 | Weathermap uses a fair bit of memory by PHP standards, as it builds the 75 | image for the map in memory before saving it. As a result, your PHP process 76 | may run out of memory. PHP has a 'safety valve' built-in, to stop 77 | runaway scripts from killing your server, which defaults to 8MB in most 78 | versions (this has changed in 5.2.x). This is controlled by the 79 | 'memory_limit =' line in php.ini. You may need to increase this to 32MB or 80 | even more if you have problems. In fact, the current Cacti manual suggests 81 | 128MB. These problems will typically show up as the poller process just 82 | dying with no warning or error message, as PHP kills the script.

83 | 84 |

Installation

85 | 86 |

To use the Cacti plugin, you 87 | must unpack the zip file into a directory called 88 | '<cacti_root>/plugins/weathermap'. The zip contains a folder 89 | called 'weathermap' already, so unzipping it in the plugins folder should do 90 | the job.

91 | 92 |

File Permissions

93 | 94 |

95 | You will need to change the permissions on the 96 | output directory, so that the Cacti poller process can write to it. 97 | This is the same as you would have done for the 98 | rra directory while installing Cacti itself originally. For a *nix 99 | system, it will be something like: 100 | 101 |

102 |
103 |                                 chown cactiuser output
104 | 
105 |
106 | 107 |

Getting Started

108 | 109 |

To actually enable the plugin, you need to add a line to your Cacti 110 | config file. This file is includes/config.php for Cacti 0.8.6 and 111 | includes/global.php for Cacti 0.8.7(a through f), then includes/config.php again for 0.8.7g and newer: 112 | 113 | 114 |

115 |
116 |                                 $plugins = array();
117 |                                 $plugins[] = 'monitor';
118 |                                 $plugins[] = 'weathermap';
119 | 
120 |
121 | 122 |

123 | Now, refresh your Cacti page, to be sure that everything is still working 124 | right. If not, remove the line you just added and you should return to 125 | normal. Make a note of any error message and let me know! 126 |

127 | 128 |

129 | Assuming it all looks fine (but not 130 | very different), you can start to enable Weathermap. Log in as 'admin' or 131 | another user with User Management rights, go to the User Management section 132 | under Tools in the Cacti console, and then choose your own username from the 133 | list. Check the two new 'realms' boxes that should be there 134 | - View Weathermaps, and Manage Weathermaps 135 | - and then click Save. A 'Weathermap' tab should appear at the top of the 136 | page.

137 | 138 |

That's it! The Weathermap plugin is installed. To go further, you need 139 | some weathermap configuration files to define your maps. You can do this in 140 | two ways 141 | - using the Web-based map editor, or by editing the text-based configuration 142 | files directly.

143 | 144 |

To use the editor, you need to make a few more changes (see below).

145 | 146 |

To learn more about actually using the Cacti plugin, see the 147 | Cacti Plugin page.

148 | 149 |

The Editor

150 | 151 |

Once you have weathermap itself working, continue onto the editor:

152 | 153 |

154 | Copy the editor-config.php-dist file to 155 | editor-config.php. If you want to be able to pick data sources from 156 | your Cacti installation by name, edit the file and make sure that the line 157 | that sets 158 | $cacti_base is correct, and that the base URI below that is also 159 | correct for your Cacti installation (these two lines are marked CHANGE in 160 | the file). 161 |

162 | 163 |

164 | Make sure that your webserver can write to the configs directory. To do 165 | this, you need to know which user your webserver runs as (maybe 'nobody', 166 | 'www' or 'httpd' on most *nixes) and then run: 167 | 168 |

169 |
chown www configs
170 |                                 chmod u+w configs
171 |
172 | 173 | In a pinch, you can just chmod 777 configs, but this 174 | really isn't a recommended solution for a production system.

175 | 176 |

On Windows, the same applies 177 | - the user that runs the webserver runs as should have permissions to write 178 | new files, and change existing files in the configs folder.

179 |

180 | 181 |

Since version 0.97, you now also need to enable the editor. The reason is 182 | so that you can't have the editor enabled without knowing about it. The 183 | editor allows access to your config files without authentication (it doesn't 184 | use Cacti's authentication), so you should consider using features in your 185 | webserver to limit who can access 186 | editor.php. For example, on an Apache server, something like: 187 | 188 |

189 |                             <Directory /var/www/html/cacti/plugins/weathermap>
190 |                                 <Files editor.php>
191 |                                     Order Deny,Allow
192 |                                     Deny from all
193 |                                     Allow from 127.0.0.1
194 |                                 </FilesMatch>
195 |                             </Directory>
196 |     
197 | When you are happy that the world can't edit your maps, then enable the 198 | editor. This is done by editing the top of editor.php and changing 199 | $ENABLED=false; to $ENABLED=true;

200 | 201 |

202 | You should now be able to go to 203 | http://your.server/cacti/plugins/weathermap/editor.php in a browser, and get 204 | a welcome page that offers to load or create a config file. That's it. All 205 | done. Please see the 206 | editor manual page for more about 207 | using the editor! 208 |

209 | 210 |

You can also edit an existing map from the Cacti web interface, by 211 | choosing Manage..Weathermaps and then clicking on the name of a config file 212 | in the list of active maps. The editor will open with that map loaded.

213 | 214 |

215 | Important Security Note: The editor allows 216 | anyone who can access editor.php to change the configuration files 217 | for your network weathermaps. There is no authentication built-in for 218 | editing, even with the Cacti Plugin. This is why the configuration file 219 | doesn't exist by default 220 | - the editor won't work until you choose to make it work. It's recommended 221 | that you either: 222 | 223 |

  • change the ownership of configuration files so that the editor can't 224 | write to them once they are complete, or
  • use your webserver's 225 | authentication and access control facilities to limit who can access the 226 | editor.php URL. On apache, this can be done using the FilesMatch directive 227 | and mod_access.
  • 228 |
229 |

230 | 231 |
232 |
233 | 234 | 235 | -------------------------------------------------------------------------------- /docs/pages/install-cacti.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Installation - Cacti Plugin 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 | 38 |

Installation

39 | 40 |

Cacti plugin

41 | 42 |

Requirements

43 | 44 |

Before doing anything else, please verify that your 45 | Plugin Architecture is working 46 | properly with a simpler plugin, like 47 | Links or 48 | Tools. Weathermap is relatively 49 | complex, and fault-finding both your Cacti Plugin Architecture and 50 | Weathermap at the same time will make life harder for you!

51 | 52 |

You will need the 'pcre' and 'gd' PHP modules in 53 | your command-line PHP. The poller-process runs using the 54 | command-line PHP which is not always the same as the server-side one. In 55 | some situations it is possible to have two completely different PHP 56 | installations serving these two 57 | - if you install from a package, then re-install from source, but to a 58 | different directory, for example. The poller process should warn you if the 59 | part it needs is not present.

60 | 61 |

Before you start using it, you might want to change one PHP setting. 62 | Weathermap uses a fair bit of memory by PHP standards, as it builds the 63 | image for the map in memory before saving it. As a result, your PHP process 64 | may run out of memory. PHP has a 'safety valve' built-in, to stop 65 | runaway scripts from killing your server, which defaults to 8MB in most 66 | versions (this has changed in 5.2.x). This is controlled by the 67 | 'memory_limit =' line in php.ini. You may need to increase this to 32MB or 68 | even more if you have problems. In fact, the current Cacti manual suggests 69 | 128MB. These problems will typically show up as the poller process just 70 | dying with no warning or error message, as PHP kills the script.

71 | 72 |

Installation

73 | 74 |

To use the Cacti plugin, you 75 | must unpack the zip file into a directory called 76 | '<cacti_root>/plugins/weathermap'. The zip contains a folder 77 | called 'weathermap' already, so unzipping it in the plugins folder should do 78 | the job.

79 | 80 |

You can then use the pre-install checker to see if your PHP environment 81 | has everything it needs. To do this, you need to run a special 82 | check.php script, twice...

83 | 84 |

First, go to http://yourcactiserver/plugins/weathermap/check.php to see 85 | if your webserver PHP (mod_php, ISAPI etc) is OK. Then, from a 86 | command-prompt run 87 | php check.php to see if your command-line PHP is OK. If any modules 88 | or functions are missing, you will get a warning, and an explanation of what 89 | will be affected (not all of the things that are checked are deadly 90 | problems).

91 | 92 |

File Permissions

93 | 94 |

95 | You will need to change the permissions on the 96 | output directory, so that the Cacti poller process can write to it. 97 | This is the same as you would have done for the 98 | rra directory while installing Cacti itself originally. For a *nix 99 | system, it will be something like: 100 | 101 |

102 |
103 |                                 chown cactiuser output
104 | 
105 |
106 | 107 |

Getting Started

108 | 109 |

To actually enable the plugin, you need to add a line to your Cacti 110 | config file. This file is includes/config.php for Cacti 0.8.6 and 111 | includes/global.php for Cacti 0.8.7(a through f), then includes/config.php again for 0.8.7g and newer: 112 | 113 |

114 |
115 |                                 $plugins = array();
116 |                                 $plugins[] = 'monitor';
117 |                                 $plugins[] = 'weathermap';
118 | 
119 |
120 | 121 |

122 | Now, refresh your Cacti page, to be sure that everything is still working 123 | right. If not, remove the line you just added and you should return to 124 | normal. Make a note of any error message and let me know! 125 |

126 | 127 |

128 | Assuming it all looks fine (but not 129 | very different), you can start to enable Weathermap. Log in as 'admin' or 130 | another user with User Management rights, go to the User Management section 131 | under Tools in the Cacti console, and then choose your own username from the 132 | list. Check the two new 'realms' boxes that should be there 133 | - View Weathermaps, and Manage Weathermaps 134 | - and then click Save. A 'Weathermap' tab should appear at the top of the 135 | page.

136 | 137 |

That's it! The Weathermap plugin is installed. To go further, you need 138 | some weathermap configuration files to define your maps. You can do this in 139 | two ways 140 | - using the Web-based map editor, or by editing the text-based configuration 141 | files directly.

142 | 143 |

To use the editor, you need to make a few more changes.

144 | 145 |

To learn more about actually using the Cacti plugin, see the 146 | Cacti Plugin page.

147 | 148 |
149 |
150 | 151 | 152 | -------------------------------------------------------------------------------- /docs/pages/install-cli-editor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Installation - Command-Line Tool and Editor 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 |

Installation

38 | 39 |

Command-Line Tool and Editor

40 | 41 |

Requirements

42 | 43 |

You will need the 'pcre' and 'gd' PHP modules in 44 | both your command-line and server-side (mod_php/ISAPI) PHP. The 45 | command-line tool runs using the command-line PHP, and the editor uses the 46 | server-side one. In some situations it is possible to have two completely 47 | different PHP installations serving these two 48 | - if you install from a package, then re-install from source, but to a 49 | different directory, for example. The editor and the CLI tool should both 50 | warn you if the part they need is not present.

> 51 | 52 |

The command-line tool uses the Console_Getopt 53 | PEAR module. This comes as standard 54 | with PEAR, so you should be able to just install PEAR to get it. This may be 55 | a seperate package/port/RPM on your system, or you may need to install it 56 | from pear.php.net

57 | 58 |

Before you start using it, you might want to change one PHP setting. 59 | Weathermap uses a fair bit of memory by PHP standards, as it builds the 60 | image for the map in memory before saving it. As a result, your PHP process 61 | may run out of memory. PHP has a 'safety valve' built-in, to stop 62 | runaway scripts from killing your server, which defaults to 8MB in most 63 | versions (this has changed in 5.2.x). This is controlled by the 64 | 'memory_limit =' line in php.ini. You may need to increase this to 32MB or 65 | even more if you have problems. These problems will typically show up as the 66 | process just dying with no warning or error message, as PHP kills the 67 | script.

68 | 69 |

Installation

70 | 71 |

Unpack the zip file into a directory somewhere. If you are intending to 72 | use the browser-based editor, then the directory that you unpack the zip 73 | file into should be within the 'web space' on the web server that runs your 74 | data-collection application (that is, Cacti, MRTG, or similar) 75 | - /var/www/html, /usr/local/www/data or whatever it is for you.

76 | 77 |

You can then use the pre-install checker to see if your PHP environment 78 | has everything it needs. To do this, you need to run a special 79 | check.php script, twice...

80 | 81 |

First, go to http://yourcactiserver/plugins/weathermap/check.php to see 82 | if your webserver PHP (mod_php, ISAPI etc) is OK. Then, from a 83 | command-prompt run 84 | php check.php to see if your command-line PHP is OK. If any modules 85 | or functions are missing, you will get a warning, and an explanation of what 86 | will be affected (not all of the things that are checked are deadly 87 | problems).

88 | 89 |

90 | You'll need to edit two lines in the weathermap file: 91 | 92 |

    93 |
  • If you are on a Unix-based platform (BSD, OS X, Linux etc), the path 94 | in the very top line should be the full path to your command-line php 95 | executable (usr/bin/php, or /usr/local/bin/php usually).
  • 96 | 97 |
  • Around line 30 or so, you may need to change the path to your 98 | rrdtool executable, if you are intending to use RRD-based datasources 99 | for your maps.
  • 100 |
101 |

102 | 103 |

Testing

104 | 105 | That should be it! You should be able to run 106 | 107 |

108 | 109 |
110 | ./weathermap 111 | 112 |
113 | 114 | or 115 | 116 |
117 | 118 | php weathermap (on Windows you will need this one) 119 |

from a shell or command prompt, and get a (rather boring) 120 | weathermap.png file in return. If you don't, you 121 | should get some kind of error to help you figure out why.

122 | 123 |

Editor

124 | 125 |

Once you have weathermap itself working, continue onto the editor:

126 | 127 |

128 | Copy the editor-config.php-dist file to 129 | editor-config.php. If you use Cacti, and want to be able to pick 130 | data sources from your Cacti installation by name, edit the file and make 131 | sure that the line that sets 132 | $cacti_base is correct, and that the base URI below that is also 133 | correct for your Cacti installation (these two lines are marked CHANGE in 134 | the file). 135 |

136 | 137 |

138 | Make sure that your webserver can write to the configs directory. To do 139 | this, you need to know which user your webserver runs as (maybe 'nobody', 140 | 'www' or 'httpd' on most *nixes) and then run: 141 | 142 |

143 |
chown www configs
144 |                                 chmod u+w configs
145 |
146 | 147 | In a pinch, you can just chmod 777 configs, but this 148 | really isn't a recommended solution for a production system.

149 | 150 |

On Windows, the same applies 151 | - the user that runs the webserver runs as should have permissions to write 152 | new files, and change existing files in the configs folder.

153 | 154 |

155 | 156 |

Since version 0.97, you now also need to enable the editor. The reason is 157 | so that you can't have the editor enabled without knowing about it. The 158 | editor allows access to your config files without authentication, so you 159 | should consider using features in your webserver to limit who can access 160 | editor.php. For example, on an Apache server, something like: 161 | 162 |

163 |                             <Directory /var/www/html/weathermap>
164 |                                 <Files editor.php>
165 |                                     Order Deny,Allow
166 |                                     Deny from all
167 |                                     Allow from 127.0.0.1
168 |                                 </FilesMatch>
169 |                             </Directory>
170 |     
171 | When you are happy that the world can't edit your maps, then enable the 172 | editor. This is done by editing the top of editor.php and changing 173 | $ENABLED=false; to $ENABLED=true;

174 | 175 |

176 | You should now be able to go to 177 | http://yourserver/wherever-you-unpacked-weathermap/editor.php in a browser, 178 | and get a welcome page that offers to load or create a config file. That's 179 | it. All done. Please see the 180 | editor manual page for more about 181 | using the editor! 182 |

183 | 184 |

185 | Important Security Note: The editor allows 186 | anyone who can access editor.php to change the configuration files 187 | for your network weathermaps. There is no authentication built-in for 188 | editing, even with the Cacti Plugin. This is why the configuration file 189 | doesn't exist by default 190 | - the editor won't work until you choose to make it work. It's recommended 191 | that you either: 192 | 193 |

  • change the ownership of configuration files so that the editor can't 194 | write to them once they are complete, or
  • use your webserver's 195 | authentication and access control facilities to limit who can access the 196 | editor.php URL. On apache, this can be done using the FilesMatch directive 197 | and mod_access.
  • 198 |
199 |

200 | 201 |
202 |
203 | 204 | 205 | -------------------------------------------------------------------------------- /docs/pages/install-cli.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Installation - Command-Line Tool Only 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 |

Installation

38 | 39 |

Command-Line Tool Only

40 | 41 |

Requirements

42 | 43 |

You will need the 'pcre' and 'gd' PHP modules in 44 | your command-line PHP. The command-line tool runs using the 45 | command-line PHP which is not always the same as the server-side one. In 46 | some situations it is possible to have two completely different PHP 47 | installations serving these two 48 | - if you install from a package, then re-install from source, but to a 49 | different directory, for example. The CLI tool should warn you if the part 50 | it needs is not present.

51 | 52 |

The command-line tool uses the Console_Getopt 53 | PEAR module. This comes as standard 54 | with PEAR, so you should be able to just install PEAR to get it. This may be 55 | a seperate package/port/RPM on your system, or you may need to install it 56 | from pear.php.net

57 | 58 |

Before you start using it, you might want to change one PHP setting. 59 | Weathermap uses a fair bit of memory by PHP standards, as it builds the 60 | image for the map in memory before saving it. As a result, your PHP process 61 | may run out of memory. PHP has a 'safety valve' built-in, to stop 62 | runaway scripts from killing your server, which defaults to 8MB in most 63 | versions (this has changed in 5.2.x). This is controlled by the 64 | 'memory_limit =' line in php.ini. You may need to increase this to 32MB or 65 | even more if you have problems. These problems will typically show up as the 66 | process just dying with no warning or error message, as PHP kills the 67 | script.

68 | 69 |

You can then use the pre-install checker to see if your PHP environment 70 | has everything it needs. To do this, you need to run a special 71 | check.php script. From a command-prompt run 72 | php check.php to see if your command-line PHP is OK. If any modules 73 | or functions are missing, you will get a warning, and an explanation of what 74 | will be affected (not all of the things that are checked are deadly 75 | problems).

76 | 77 |

Installation

78 | 79 |

Unpack the zip file into a directory somewhere. If you intend to just use 80 | the 'traditional' hand-written text configuration files, then it can be 81 | anywhere on the same server that runs your data-collection software (MRTG, 82 | Cricket, Cacti).

83 | 84 |

85 | You'll need to edit two lines in the weathermap file: 86 | 87 |

    88 |
  • If you are on a Unix-based platform (BSD, OS X, Linux etc), the path 89 | in the very top line should be the full path to your command-line php 90 | executable (usr/bin/php, or /usr/local/bin/php usually).
  • 91 | 92 |
  • Around line 30 or so, you may need to change the path to your 93 | rrdtool executable, if you are intending to use RRD-based datasources 94 | for your maps.
  • 95 |
That should be it! You should be able to run 96 |

97 | 98 |
99 | ./weathermap 100 | 101 |
102 | 103 | or 104 | 105 |
106 | 107 | php weathermap (on Windows you will need this one) 108 |

from a shell or command prompt, and get a (rather boring) 109 | weathermap.png file in return. If you don't, you 110 | should get some kind of error to help you figure out why.

111 | 112 |
113 |
114 | 115 | 116 | -------------------------------------------------------------------------------- /docs/pages/upgrading.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.97c - Upgrading 7 | 8 | 9 | 10 | 25 |
26 |
27 | 28 | 35 | 36 | 37 | 38 |

Upgrading From Previous Versions

39 | 40 |

Make a backup of your working weathermap directory before you do 41 | this! Just in case you do need to roll back.

42 | 43 |

You should be able to upgrade from any previous version by simply 44 | unpacking the new one over the top. The files that will need to be changed 45 | afterwards are the same ones you edited when you first installed: 46 | 47 |

    48 |
  • If you use the editor, then copy your editor-config.php out of the 49 | way, copy the new editor-config.php-dist over the top of the in-place 50 | editor-config.php and then make the same changes you made in your 51 | original install (cacti path and URI). 52 | This is especially important when upgrading to 0.92
  • 53 | 54 |
  • If you use the command-line tool, you will need to put the path to 55 | rrdtool back in, around line 30 of the 'weathermap' file.
  • 56 |

57 | 58 |

Any necessary database updates for Cacti users should be taken care of 59 | automatically.

60 | 61 |
62 |
63 | 64 | 65 | -------------------------------------------------------------------------------- /editor-resources/editor.css: -------------------------------------------------------------------------------- 1 | /* http://colorblender.com/?preloadblend=BC00008A513EFFF2DE5E5550857C73FCFCFC */ 2 | 3 | body { 4 | font-family: 'Lucida Grande', Arial, sans-serif; 5 | margin: 0; 6 | padding: 0; 7 | background: #5D5E5E; 8 | } 9 | 10 | #mainpage { 11 | padding-top: 58px; 12 | } 13 | 14 | /****************************************/ 15 | 16 | #welcome { 17 | width: 550px; 18 | margin-left: auto; 19 | margin-right: auto; 20 | cursor: pointer; 21 | background: white; 22 | color: black; 23 | border: 1px black solid; 24 | padding: 10px; 25 | } 26 | 27 | .license { 28 | font-size: 70%; 29 | } 30 | 31 | .emph { 32 | font-size: 150%; 33 | font-weight: bold; 34 | text-align: center; 35 | } 36 | 37 | /****************************************/ 38 | 39 | #toolbar { 40 | position: fixed; 41 | top: 0px; 42 | left: 0px; 43 | height: 32px; 44 | width: 100%; 45 | color: white; 46 | border-bottom: gray solid 1px; 47 | z-index: 1000; 48 | opacity: 0.9; 49 | display: none; 50 | background: #2D3E70; 51 | } 52 | 53 | #version { 54 | font-size: 70%; 55 | padding-left: 10px; 56 | padding-right: 10px; 57 | float: right; 58 | } 59 | 60 | #filenameholder { 61 | font-size: 70%; 62 | padding-left: 10px; 63 | padding-right: 10px; 64 | float: left; 65 | } 66 | 67 | #busy { 68 | display: none; 69 | } 70 | 71 | .viamarker { 72 | z-index: 500; 73 | position: absolute; 74 | } 75 | 76 | /****************************************/ 77 | 78 | /* #themap { margin-left: auto; margin-right: auto; padding: 0; width: 800px; padding-top: 10px; display: none; } */ 79 | #existingdata { 80 | border: none; 81 | position: absolute; 82 | left: 10px; 83 | top: 58px; 84 | } 85 | 86 | /****************************************/ 87 | 88 | #filepicker { 89 | width: 500px; 90 | margin-left: auto; 91 | margin-right: auto; 92 | display: none; 93 | padding: 10px; 94 | background: white; 95 | color: black; 96 | border: 1px black solid; 97 | } 98 | 99 | #filelist { 100 | list-style: none; 101 | margin: 0; 102 | border: 0; 103 | padding: 0; 104 | width: 400px; 105 | background: #ddd; 106 | border: 1px solid gray; 107 | border-right: 2px solid gray; 108 | border-bottom: 2px solid gray; 109 | font-size: 110%; 110 | margin-left: auto; 111 | margin-right: auto; 112 | } 113 | 114 | #filelist li { 115 | border-bottom: 1px solid gray; 116 | font-weight: bold; 117 | } 118 | 119 | #filelist li a em { 120 | font-size: 90%; 121 | font-weight: normal; 122 | font-family: serif; 123 | } 124 | 125 | #filelist li a { 126 | padding: 4px; 127 | text-decoration: none; 128 | color: black; 129 | width: 99%; 130 | display: block; 131 | } 132 | 133 | #filelist li a:hover { 134 | color: white; 135 | background: #2D3E70; 136 | } 137 | 138 | #filelist li a img { 139 | border: none; 140 | padding: 2px; 141 | } 142 | 143 | #filelist li#status em { 144 | font-size: 90%; 145 | font-weight: normal; 146 | font-family: serif; 147 | } 148 | 149 | 150 | /****************************************/ 151 | 152 | .draggablenode { 153 | cursor: move; 154 | } 155 | 156 | .tb_info { 157 | color: #ccc; 158 | font-style: italic; 159 | } 160 | 161 | .tb_help { 162 | color: black; 163 | border-left: white; 164 | } 165 | 166 | ul#tblist { 167 | list-style-type: none; 168 | background-color: whitesmoke; 169 | width: 100%; 170 | height: 24px; 171 | padding: 0; 172 | } 173 | 174 | ul#tblist li { 175 | float: left; 176 | display: block; 177 | text-align: center; 178 | font: normal small-caps normal 12px "Lucida Grande", Lucida, Verdana, sans-serif; 179 | margin: 1px; 180 | background-color: #efefef; 181 | padding: 3px 2px 3px 5px; 182 | } 183 | 184 | a.tb_button { 185 | padding-left: 18px; 186 | background: url(add.png) no-repeat left top; 187 | text-decoration: none; 188 | color: black; 189 | } 190 | 191 | /* Individual icons for the toolbar*/ 192 | a#btn_changefile { 193 | background: url(bullet_disk.png) no-repeat left top; 194 | } 195 | 196 | a#btn_refresh { 197 | background: url(arrow_refresh.png) no-repeat left top; 198 | } -------------------------------------------------------------------------------- /editor-resources/exclamation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/editor-resources/exclamation.png -------------------------------------------------------------------------------- /editor-resources/index.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /editor-resources/oldeditor.css: -------------------------------------------------------------------------------- 1 | #mainview { background: #ccc; padding-top: 60px; } 2 | 3 | body { font-family: 'Gill Sans', Verdana, sans-serif; margin:0; } 4 | #toolbar { font-family: Verdana, sans-serif; } 5 | 6 | #toolbar { position: fixed; top:0px; left: 0px; width: 100%; 7 | color: white; border-bottom: gray solid 1px; 8 | z-index: 10; opacity: 0.9; 9 | background: #1958b7; 10 | } 11 | 12 | #dlgEditorSettings { display: none; z-index: 7; position: absolute;top: 80px;left: 50px;} 13 | 14 | #dlgNodeProperties { display: none; z-index: 2; position: absolute;top: 100px;left: 100px;} 15 | #dlgTextEdit { display: none; z-index: 4; position: absolute;top: 150px;left: 150px;} 16 | #dlgLinkProperties { display: none; z-index: 3; position: absolute; top: 80px; left: 150px; } 17 | #dlgMapProperties { display: none; z-index: 1; position: absolute;top: 90px; left: 120px;} 18 | #dlgMapStyle { display: none; z-index: 1; position: absolute;top: 40px; left: 50px;} 19 | 20 | #dlgColours { display: none; z-index: 1; position: absolute;top: 140px; left: 90px;} 21 | #dlgImages { display: none; z-index: 1; position: absolute;top: 120px; left: 70px;} 22 | 23 | #dlgTextEdit textarea { padding: 3px;} 24 | 25 | /* some fudges for the Welcome screen*/ 26 | #dlgStart { z-index: 1; position: absolute; top: 90px; left: 60px; width: 600px;} 27 | #dlgStart .dlgBody ul { list-style: none; } 28 | #dlgStart .dlgBody ul a { text-decoration: none; color: white; font-weight: bold;} 29 | 30 | #existingdata { border: 0px; } 31 | 32 | #withjs { 33 | display: none; 34 | /* to hide the page until our Javascript is running. Otherwise the whole thing fails really. */ 35 | } 36 | 37 | #nojs { 38 | /* border: 3px dashed red; 39 | background: #fee; 40 | padding: 5px; 41 | /* the warning bit we'll show unless the javascript hides it */ 42 | font-size: 80%; 43 | /* padding: 5px; */ 44 | margin: 25px; 45 | } 46 | 47 | div.dlgTitlebar ul { 48 | float: right; 49 | font-size: 8pt; 50 | font-weight: bold; 51 | font-style: italic; 52 | white-space: nowrap; 53 | } 54 | 55 | div.dlgTitlebar ul li { 56 | display: inline; 57 | } 58 | 59 | a.dlgTitlebar { 60 | padding:3px 3px; 61 | font-size: 8pt; 62 | font-weight: bold; 63 | font-style: italic; 64 | background:#aaa; 65 | color:#fff; 66 | text-decoration:none; 67 | padding: 3px; 68 | border: 1px white dotted; 69 | margin: 2px; 70 | } 71 | 72 | div.dlgTitlebar ul li a { 73 | float:right; 74 | padding:3px 3px; 75 | background:#aaa; 76 | color:#fff; 77 | text-decoration:none; 78 | padding: 3px; 79 | border: 1px white dotted; 80 | margin: 2px; 81 | cursor: pointer; 82 | } 83 | 84 | a.dlgTitlebar { cursor: pointer; } 85 | 86 | div.dlgTitlebar ul li a:hover { 87 | color:#fff; 88 | background:#69c; 89 | } 90 | 91 | a.dlgTitlebar:hover { 92 | color:#fff; 93 | background:#69c; 94 | } 95 | 96 | #toolbar ul { 97 | float:left; 98 | width:100%; 99 | margin:0; 100 | padding:0; 101 | font-size:11px; 102 | color:#fff; 103 | /* background:#ccc;*/ 104 | background: #1958b7; 105 | /* margin-bottom: 10px; */ 106 | } 107 | 108 | #toolbar ul li.tb_help { 109 | font-style: italic; 110 | padding: 2px; 111 | } 112 | 113 | #toolbar ul li { 114 | display:inline; 115 | } 116 | 117 | #toolbar ul li.tb_active { 118 | float:left; 119 | padding:5px 10px; 120 | text-decoration:none; 121 | 122 | border-left: #508fc4 2px solid; 123 | border-right: #1958b7 2px solid; 124 | border-top: #508fc4 2px solid; 125 | border-bottom: #1958b7 2px solid; 126 | 127 | cursor: pointer; 128 | text-align: center; 129 | 130 | background: #2175bc; 131 | color:#fff; 132 | } 133 | 134 | #toolbar ul li.tb_coords { 135 | float:left; 136 | padding:7px 12px; 137 | text-decoration:none; 138 | width: 70px; 139 | 140 | text-align: center; 141 | 142 | 143 | background: #1958b7; 144 | color:#fff; 145 | } 146 | 147 | 148 | #toolbar ul li.tb_active:hover { 149 | color:#fff; 150 | background:#2586d7; 151 | } 152 | 153 | .dlgProperties { 154 | width: 600px; 155 | background: #077; 156 | margin: 5px; 157 | font-size: 8pt; 158 | color: white; 159 | } 160 | 161 | .dlgBody { 162 | padding: 5px; 163 | font-size: 12pt; 164 | } 165 | 166 | .comment { font-style: italic; font-size: 80%;} 167 | 168 | .dlgHelp { 169 | font-size: 10pt; 170 | line-height: 12pt; 171 | background: #099; 172 | height: 48pt; 173 | padding: 5px; 174 | } 175 | 176 | .dlgTitlebar { 177 | font-size: 12pt; 178 | font-weight: bold; 179 | background: #099; 180 | padding-left: 5px; 181 | padding-right: 4px; 182 | padding-top: 2px; 183 | padding-bottom: 2px; 184 | } 185 | 186 | .debug { line-height: 2.5; margin: 10px; font-size: 70%; background: yellow; border: 1px dashed black; padding: 4px;} 187 | .debug input { font-size: 80%; } 188 | .debug h1 { font-size: 8pt; border-bottom: 1px solid grey; text-align: left;} 189 | .debug span { position: relative; } 190 | .debug span label {position:absolute; top:-1.5em; left:0; font:bold 100%/1 sans-serif; } 191 | 192 | th { color: white; font-weight: bold; text-align: right; font-size: 8pt;} 193 | td { color: white; font-weight: normal; text-align: left; font-size: 8pt;} 194 | 195 | #xycapture { cursor: crosshair; } 196 | 197 | .alert { 198 | background: #fff6bf url(exclamation.png) center no-repeat; 199 | background-position: 15px 50%; /* x-pos y-pos */ 200 | text-align: left; 201 | padding: 5px 20px 5px 45px; 202 | border-top: 2px solid #ffd324; 203 | border-bottom: 2px solid #ffd324; 204 | } 205 | 206 | .fontsamples { height: 64px; width: 300px; overflow: auto; } 207 | 208 | .cactilink, .cactinode { white-space: nowrap; } 209 | 210 | #item_configtext { overflow: scroll; white-space: nowrap; } 211 | -------------------------------------------------------------------------------- /images/Cloud-Filled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/Cloud-Filled.png -------------------------------------------------------------------------------- /images/Cloud-line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/Cloud-line.png -------------------------------------------------------------------------------- /images/Firewall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/Firewall.png -------------------------------------------------------------------------------- /images/HPMini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/HPMini.png -------------------------------------------------------------------------------- /images/Host.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/Host.png -------------------------------------------------------------------------------- /images/PAD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/PAD.png -------------------------------------------------------------------------------- /images/Router.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/Router.png -------------------------------------------------------------------------------- /images/WorkgroupSwitch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/WorkgroupSwitch.png -------------------------------------------------------------------------------- /images/application.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/application.png -------------------------------------------------------------------------------- /images/application_side_list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/application_side_list.png -------------------------------------------------------------------------------- /images/application_xp_terminal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/application_xp_terminal.png -------------------------------------------------------------------------------- /images/background1_950x625_197.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/background1_950x625_197.jpg -------------------------------------------------------------------------------- /images/blue-ball-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/blue-ball-64.png -------------------------------------------------------------------------------- /images/blueboard1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/blueboard1024.png -------------------------------------------------------------------------------- /images/btn_recalc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/btn_recalc.png -------------------------------------------------------------------------------- /images/button_editgroups.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/button_editgroups.png -------------------------------------------------------------------------------- /images/button_settings.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/button_settings.gif -------------------------------------------------------------------------------- /images/bw_gradient_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/bw_gradient_1024.png -------------------------------------------------------------------------------- /images/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/comment.png -------------------------------------------------------------------------------- /images/cross.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/cross.png -------------------------------------------------------------------------------- /images/emoticon_smile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/emoticon_smile.png -------------------------------------------------------------------------------- /images/emoticon_unhappy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/emoticon_unhappy.png -------------------------------------------------------------------------------- /images/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/error.png -------------------------------------------------------------------------------- /images/exclamation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/exclamation.png -------------------------------------------------------------------------------- /images/filecabinet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/filecabinet.png -------------------------------------------------------------------------------- /images/flag_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/flag_blue.png -------------------------------------------------------------------------------- /images/flag_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/flag_green.png -------------------------------------------------------------------------------- /images/flag_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/flag_orange.png -------------------------------------------------------------------------------- /images/flag_pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/flag_pink.png -------------------------------------------------------------------------------- /images/flag_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/flag_purple.png -------------------------------------------------------------------------------- /images/flag_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/flag_yellow.png -------------------------------------------------------------------------------- /images/green-ball-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/green-ball-64.png -------------------------------------------------------------------------------- /images/grey-ball-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/grey-ball-64.png -------------------------------------------------------------------------------- /images/hollow32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/hollow32.png -------------------------------------------------------------------------------- /images/index.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /images/monitor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/monitor.png -------------------------------------------------------------------------------- /images/page_white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/page_white.png -------------------------------------------------------------------------------- /images/red-ball-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/red-ball-64.png -------------------------------------------------------------------------------- /images/s_tab_weathermap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/s_tab_weathermap.gif -------------------------------------------------------------------------------- /images/s_tab_weathermap_red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/s_tab_weathermap_red.gif -------------------------------------------------------------------------------- /images/tab_weathermap.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/tab_weathermap.gif -------------------------------------------------------------------------------- /images/tab_weathermap_red.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/tab_weathermap_red.gif -------------------------------------------------------------------------------- /images/tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/tick.png -------------------------------------------------------------------------------- /images/uk1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/uk1024.png -------------------------------------------------------------------------------- /images/updown_0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/updown_0.png -------------------------------------------------------------------------------- /images/updown_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/updown_1.png -------------------------------------------------------------------------------- /images/updown_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/updown_2.png -------------------------------------------------------------------------------- /images/world.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/world.png -------------------------------------------------------------------------------- /images/world_link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/world_link.png -------------------------------------------------------------------------------- /images/wrench.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/wrench.png -------------------------------------------------------------------------------- /images/wrench_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/wrench_orange.png -------------------------------------------------------------------------------- /images/yellow-ball-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/images/yellow-ball-64.png -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ZerxXxes/weathermap-for-observium/599bdb330ebbf9e6e8f9fb15e01bde8040c767e5/lib/.DS_Store -------------------------------------------------------------------------------- /lib/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Order deny,allow 3 | Deny from all 4 | 5 | -------------------------------------------------------------------------------- /lib/HTML_ImageMap.class.php: -------------------------------------------------------------------------------- 1 | and also specifying part of 11 | // an image with an IMAGE control. 12 | // 13 | // 14 | class HTML_ImageMap_Area 15 | { 16 | var $href; 17 | var $name; 18 | var $id; 19 | var $alt; 20 | var $z; 21 | var $extrahtml; 22 | 23 | function common_html() 24 | { 25 | $h = ""; 26 | if($this->name != "") 27 | { 28 | // $h .= " alt=\"".$this->name."\" "; 29 | $h .= "id=\"".$this->name."\" "; 30 | } 31 | if($this->href != "") 32 | { 33 | $h .= "href=\"".$this->href."\" "; 34 | } 35 | else { $h .= "nohref "; } 36 | if($this->extrahtml != "") 37 | { 38 | $h .= $this->extrahtml." "; 39 | } 40 | return $h; 41 | } 42 | 43 | } 44 | 45 | class HTML_ImageMap_Area_Polygon extends HTML_ImageMap_Area 46 | { 47 | var $points = array(); 48 | var $minx,$maxx,$miny,$maxy; // bounding box 49 | var $npoints; 50 | 51 | function asHTML() 52 | { 53 | foreach ($this->points as $point) 54 | { 55 | $flatpoints[] = $point[0]; 56 | $flatpoints[] = $point[1]; 57 | } 58 | $coordstring = join(",",$flatpoints); 59 | 60 | return 'common_html().'shape="poly" coords="'.$coordstring.'" />'; 61 | } 62 | 63 | function asJSON() 64 | { 65 | $json = "{ \"shape\":'poly', \"npoints\":".$this->npoints.", \"name\":'".$this->name."',"; 66 | 67 | $xlist = ''; 68 | $ylist = ''; 69 | foreach ($this->points as $point) 70 | { 71 | $xlist .= $point[0].","; 72 | $ylist .= $point[1].","; 73 | } 74 | $xlist = rtrim($xlist,", "); 75 | $ylist = rtrim($ylist,", "); 76 | $json .= " \"x\": [ $xlist ], \"y\":[ $ylist ], \"minx\": ".$this->minx.", \"miny\": ".$this->miny.", \"maxx\":".$this->maxx.", \"maxy\":".$this->maxy."}"; 77 | 78 | return($json); 79 | } 80 | 81 | function hitTest($x,$y) 82 | { 83 | $c = 0; 84 | // do the easy bounding-box test first. 85 | if( ($x < $this->minx) || ($x>$this->maxx) || ($y<$this->miny) || ($y>$this->maxy)) 86 | { 87 | return false; 88 | } 89 | 90 | // Algotithm from from 91 | // http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html#The%20C%20Code 92 | for ($i = 0, $j = $this->npoints-1; $i < $this->npoints; $j = $i++) 93 | { 94 | // print "Checking: $i, $j\n"; 95 | $x1 = $this->points[$i][0]; 96 | $y1 = $this->points[$i][1]; 97 | $x2 = $this->points[$j][0]; 98 | $y2 = $this->points[$j][1]; 99 | 100 | // print "($x,$y) vs ($x1,$y1)-($x2,$y2)\n"; 101 | 102 | if (((($y1<=$y) && ($y<$y2)) || (($y2<=$y) && ($y<$y1))) && 103 | ($x < ($x2 - $x1) * ($y - $y1) / ($y2 - $y1) + $x1)) 104 | { 105 | $c = !$c; 106 | } 107 | } 108 | 109 | return ($c); 110 | } 111 | 112 | function HTML_ImageMap_Area_Polygon ( $name="", $href="",$coords) 113 | { 114 | $c = $coords[0]; 115 | 116 | $this->name = $name; 117 | $this->href= $href; 118 | $this->npoints = count($c)/2; 119 | 120 | if( intval($this->npoints) != ($this->npoints)) 121 | { 122 | die("Odd number of points!"); 123 | } 124 | 125 | for ($i=0; $ipoints[] = $point; 133 | } 134 | 135 | $this->minx = min($xlist); 136 | $this->maxx = max($xlist); 137 | $this->miny = min($ylist); 138 | $this->maxy = max($ylist); 139 | 140 | // print $this->asHTML()."\n"; 141 | } 142 | 143 | } 144 | 145 | class HTML_ImageMap_Area_Rectangle extends HTML_ImageMap_Area 146 | { 147 | var $x1,$x2,$y1,$y2; 148 | 149 | function HTML_ImageMap_Area_Rectangle ( $name="", $href="",$coords) 150 | { 151 | 152 | $c = $coords[0]; 153 | 154 | $x1 = round($c[0]); 155 | $y1 = round($c[1]); 156 | $x2 = round($c[2]); 157 | $y2 = round($c[3]); 158 | 159 | // sort the points, so that the first is the top-left 160 | if($x1>$x2) 161 | { 162 | $this->x1=$x2; 163 | $this->x2=$x1; 164 | } 165 | else 166 | { 167 | $this->x1=$x1; 168 | $this->x2=$x2; 169 | } 170 | 171 | if($y1>$y2) 172 | { 173 | $this->y1=$y2; 174 | $this->y2=$y1; 175 | } 176 | else 177 | { 178 | $this->y1=$y1; 179 | $this->y2=$y2; 180 | } 181 | 182 | $this->name = $name; 183 | $this->href = $href; 184 | } 185 | 186 | function hitTest($x,$y) 187 | { 188 | return ( ($x > $this->x1) && ($x < $this->x2) && ($y > $this->y1) && ($y < $this->y2) ); 189 | } 190 | 191 | function asHTML() 192 | { 193 | $coordstring = join(",",array($this->x1,$this->y1,$this->x2,$this->y2)); 194 | return 'common_html().'shape="rect" coords="'.$coordstring.'" />'; 195 | 196 | } 197 | 198 | function asJSON() 199 | { 200 | $json = "{ \"shape\":'rect', "; 201 | 202 | $json .= " \"x1\":".$this->x1.", \"y1\":".$this->y1.", \"x2\":".$this->x2.", \"y2\":".$this->y2.", \"name\":'".$this->name."'}"; 203 | 204 | return($json); 205 | } 206 | 207 | } 208 | 209 | class HTML_ImageMap_Area_Circle extends HTML_ImageMap_Area 210 | { 211 | var $centx,$centy, $edgex, $edgey; 212 | 213 | function asHTML() 214 | { 215 | $coordstring = join(",",array($this->centx,$this->centy,$this->edgex,$this->edgey) ); 216 | return 'common_html().'shape="circle" coords="'.$coordstring.'" />'; 217 | } 218 | 219 | function hitTest($x,$y) 220 | { 221 | $radius1 = ($this->edgey - $this->centy) * ($this->edgey - $this->centy) 222 | + ($this->edgex - $this->centx) * ($this->edgex - $this->centx); 223 | 224 | $radius2 = ($this->edgey - $y) * ($this->edgey - $y) 225 | + ($this->edgex - $x) * ($this->edgex - $x); 226 | 227 | return ($radius2 <= $radius1); 228 | } 229 | 230 | function HTML_ImageMap_Area_Circle($name="", $href="",$coords) 231 | { 232 | $c = $coords[0]; 233 | 234 | $this->name = $name; 235 | $this->href = $href; 236 | $this->centx = round($c[0]); 237 | $this->centy = round($c[1]); 238 | $this->edgex = round($c[2]); 239 | $this->edgey = round($c[3]); 240 | } 241 | } 242 | 243 | class HTML_ImageMap 244 | { 245 | var $shapes; 246 | var $nshapes; 247 | var $name; 248 | 249 | function HTML_ImageMap($name="") 250 | { 251 | $this->Reset(); 252 | $this->name = $name; 253 | } 254 | 255 | function Reset() 256 | { 257 | $this->shapes = array(); 258 | $this->nshapes = 0; 259 | $this->name = ""; 260 | } 261 | 262 | // add an element to the map - takes an array with the info, in a similar way to HTML_QuickForm 263 | function addArea($element) 264 | { 265 | if (is_object($element) && is_subclass_of($element, 'html_imagemap_area')) { 266 | $elementObject = &$element; 267 | } else { 268 | $args = func_get_args(); 269 | $className = "HTML_ImageMap_Area_".$element; 270 | $elementObject = new $className($args[1],$args[2],array_slice($args, 3)); 271 | } 272 | 273 | $this->shapes[] =& $elementObject; 274 | $this->nshapes++; 275 | // print $this->nshapes." shapes\n"; 276 | } 277 | 278 | // do a hit-test based on the current map 279 | // - can be limited to only match elements whose names match the filter 280 | // (e.g. pick a building, in a campus map) 281 | function hitTest($x,$y,$namefilter="") 282 | { 283 | $preg = '/'.$namefilter.'/'; 284 | foreach ($this->shapes as $shape) 285 | { 286 | if($shape->hitTest($x,$y)) 287 | { 288 | if( ($namefilter == "") || ( preg_match($preg,$shape->name) ) ) 289 | { 290 | return $shape->name; 291 | } 292 | } 293 | } 294 | return false; 295 | } 296 | 297 | // update a property on all elements in the map that match a name 298 | // (use it for retro-actively adding in link information to a pre-built geometry before generating HTML) 299 | // returns the number of elements that were matched/changed 300 | function setProp($which, $what, $where) 301 | { 302 | $count = 0; 303 | for($i=0; $ishapes); $i++) 304 | { 305 | // this USED to be a substring match, but that broke some things 306 | // and wasn't actually used as one anywhere. 307 | if( ($where == "") || ( $this->shapes[$i]->name==$where) ) 308 | { 309 | switch($which) 310 | { 311 | case 'href': 312 | $this->shapes[$i]->href= $what; 313 | break; 314 | case 'extrahtml': 315 | $this->shapes[$i]->extrahtml= $what; 316 | #print "IMAGEMAP: Found $where and adding $which\n"; 317 | break; 318 | } 319 | $count++; 320 | } 321 | } 322 | return $count; 323 | } 324 | 325 | // update a property on all elements in the map that match a name as a substring 326 | // (use it for retro-actively adding in link information to a pre-built geometry before generating HTML) 327 | // returns the number of elements that were matched/changed 328 | function setPropSub($which, $what, $where) 329 | { 330 | 331 | $count = 0; 332 | for($i=0; $ishapes); $i++) 333 | { 334 | if( ($where == "") || ( strstr($this->shapes[$i]->name,$where)!=FALSE ) ) 335 | { 336 | switch($which) 337 | { 338 | case 'href': 339 | $this->shapes[$i]->href= $what; 340 | break; 341 | case 'extrahtml': 342 | $this->shapes[$i]->extrahtml= $what; 343 | break; 344 | } 345 | $count++; 346 | } 347 | } 348 | return $count; 349 | } 350 | 351 | // Return the imagemap as an HTML client-side imagemap for inclusion in a page 352 | function asHTML() 353 | { 354 | $html = 'name != "") 356 | { 357 | $html .= ' name="'.$this->name.'"'; 358 | } 359 | $html .=">\n"; 360 | foreach ($this->shapes as $shape) 361 | { 362 | $html .= $shape->asHTML()."\n"; 363 | $html .= "\n"; 364 | } 365 | $html .= "\n"; 366 | 367 | return $html; 368 | } 369 | 370 | function subJSON($namefilter="",$reverseorder=false) 371 | { 372 | $json = ''; 373 | 374 | $preg = '/'.$namefilter.'/'; 375 | foreach ($this->shapes as $shape) 376 | { 377 | if( ($namefilter == "") || ( preg_match($preg,$shape->name) )) 378 | { 379 | if($reverseorder) 380 | { 381 | $json = $shape->asJSON().",\n".$json; 382 | } 383 | else 384 | { 385 | $json .= $shape->asJSON().",\n"; 386 | } 387 | } 388 | } 389 | $json = rtrim($json,"\n, "); 390 | $json .= "\n"; 391 | 392 | return $json; 393 | } 394 | 395 | // return HTML for a subset of the map, specified by the filter string 396 | // (suppose you want some partof your UI to have precedence over another part 397 | // - the imagemap is checked from top-to-bottom in the HTML) 398 | // - skipnolinks -> in normal HTML output, we don't need areas for things with no href 399 | function subHTML($namefilter="",$reverseorder=false, $skipnolinks=false) 400 | { 401 | $html = ""; 402 | $preg = '/'.$namefilter.'/'; 403 | 404 | foreach ($this->shapes as $shape) 405 | { 406 | # if( ($namefilter == "") || ( preg_match($preg,$shape->name) )) 407 | if( ($namefilter == "") || ( strstr($shape->name, $namefilter) !== FALSE )) 408 | { 409 | if(!$skipnolinks || $shape->href != "" || $shape->extrahtml != "" ) 410 | { 411 | if($reverseorder) 412 | { 413 | $html = $shape->asHTML()."\n".$html; 414 | } 415 | else 416 | { 417 | $html .= $shape->asHTML()."\n"; 418 | } 419 | } 420 | 421 | } 422 | } 423 | return $html; 424 | } 425 | 426 | } 427 | // vim:ts=4:sw=4: 428 | ?> 429 | -------------------------------------------------------------------------------- /lib/datasources/README.txt: -------------------------------------------------------------------------------- 1 | Some of these datasource plugins are rather sketchy or even completely non-working. 2 | 3 | In particular: 4 | dbsample doesn't do anything. 5 | snmp isn't really useful, but has some work done on it. 6 | external has had no real testing yet 7 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_cactihost.php: -------------------------------------------------------------------------------- 1 | context == 'cacti') 8 | { 9 | if( function_exists('db_fetch_row') ) 10 | { 11 | return(TRUE); 12 | } 13 | else 14 | { 15 | wm_debug('ReadData CactiHost: Cacti database library not found.\n'); 16 | } 17 | } 18 | else 19 | { 20 | wm_debug("ReadData CactiHost: Can only run from Cacti environment.\n"); 21 | } 22 | 23 | return(FALSE); 24 | } 25 | 26 | function Recognise($targetstring) 27 | { 28 | if(preg_match("/^cactihost:(\d+)$/",$targetstring,$matches)) 29 | { 30 | return TRUE; 31 | } 32 | else 33 | { 34 | return FALSE; 35 | } 36 | } 37 | 38 | function ReadData($targetstring, &$map, &$item) 39 | { 40 | 41 | $data[IN] = NULL; 42 | $data[OUT] = NULL; 43 | $data_time = 0; 44 | 45 | if(preg_match("/^cactihost:(\d+)$/",$targetstring,$matches)) 46 | { 47 | $cacti_id = intval($matches[1]); 48 | 49 | $SQL = "select * from host where id=$cacti_id"; 50 | // 0=disabled 51 | // 1=down 52 | // 2=recovering 53 | // 3=up 54 | 55 | $state = -1; 56 | $result = db_fetch_row($SQL); 57 | if(isset($result)) 58 | { 59 | // create a note, which can be used in icon filenames or labels more nicely 60 | if($result['status'] == 1) { $state = 1; $statename = 'down'; } 61 | if($result['status'] == 2) { $state = 2; $statename = 'recovering'; } 62 | if($result['status'] == 3) { $state = 3; $statename = 'up'; } 63 | if($result['disabled']) { $state = 0; $statename = 'disabled'; } 64 | 65 | $data[IN] = $state; 66 | $data[OUT] = $state; 67 | $item->add_note("state",$statename); 68 | $item->add_note("cacti_description",$result['description']); 69 | 70 | $item->add_note("cacti_hostname",$result['hostname']); 71 | $item->add_note("cacti_curtime",$result['cur_time']); 72 | $item->add_note("cacti_avgtime",$result['avg_time']); 73 | $item->add_note("cacti_mintime",$result['min_time']); 74 | $item->add_note("cacti_maxtime",$result['max_time']); 75 | $item->add_note("cacti_availability",$result['availability']); 76 | 77 | $item->add_note("cacti_faildate",$result['status_fail_date']); 78 | $item->add_note("cacti_recdate",$result['status_rec_date']); 79 | } 80 | } 81 | 82 | wm_debug ("CactiHost ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 83 | 84 | return( array($data[IN], $data[OUT], $data_time) ); 85 | } 86 | } 87 | 88 | 89 | // vim:ts=4:sw=4: 90 | ?> 91 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_cactithold.php: -------------------------------------------------------------------------------- 1 | context == 'cacti') 31 | { 32 | if( !function_exists('db_fetch_row') ) 33 | { 34 | wm_debug("ReadData CactiTHold: Cacti database library not found. [THOLD001]\n"); 35 | return(FALSE); 36 | } 37 | 38 | $thold_present = false; 39 | 40 | if (function_exists("api_plugin_is_enabled")) { 41 | if (api_plugin_is_enabled('thold')) { 42 | $thold_present = true; 43 | } 44 | } 45 | 46 | if ( isset($plugins) && in_array('thold',$plugins)) { 47 | $thold_present = true; 48 | } 49 | 50 | if ( !$thold_present) { 51 | wm_debug("ReadData CactiTHold: THold plugin not enabled. [THOLD002]\n"); 52 | } 53 | 54 | $sql = "show tables"; 55 | $result = db_fetch_assoc($sql) or die (mysql_error()); 56 | $tables = array(); 57 | 58 | foreach($result as $index => $arr) { 59 | foreach ($arr as $t) { 60 | $tables[] = $t; 61 | } 62 | } 63 | 64 | if( !in_array('thold_data', $tables) ) 65 | { 66 | wm_debug('ReadData CactiTHold: thold_data database table not found. [THOLD003]\n'); 67 | return(FALSE); 68 | } 69 | 70 | return(TRUE); 71 | } 72 | else 73 | { 74 | wm_debug("ReadData CactiTHold: Can only run from Cacti environment. [THOLD004]\n"); 75 | } 76 | 77 | return(FALSE); 78 | } 79 | 80 | function Recognise($targetstring) 81 | { 82 | if(preg_match("/^cacti(thold|monitor):(\d+)$/",$targetstring,$matches)) 83 | { 84 | return TRUE; 85 | } 86 | elseif(preg_match("/^cactithold:(\d+):(\d+)$/",$targetstring,$matches)) 87 | { 88 | return TRUE; 89 | } 90 | else 91 | { 92 | return FALSE; 93 | } 94 | } 95 | 96 | function ReadData($targetstring, &$map, &$item) 97 | { 98 | 99 | $data[IN] = NULL; 100 | $data[OUT] = NULL; 101 | $data_time = 0; 102 | 103 | if(preg_match("/^cactithold:(\d+):(\d+)$/",$targetstring,$matches)) 104 | { 105 | // Returns 0 if threshold is not breached, 1 if it is. 106 | // use target aggregation to build these up into a 'badness' percentage 107 | // takes the same two values that are visible in thold's own URLs (the actual thold ID isn't shown anywhere) 108 | 109 | $rra_id = intval($matches[1]); 110 | $data_id = intval($matches[2]); 111 | 112 | $SQL2 = "select thold_alert from thold_data where rra_id=$rra_id and data_id=$data_id and thold_enabled='on'"; 113 | $result = db_fetch_row($SQL2); 114 | if(isset($result)) 115 | { 116 | if($result['thold_alert'] > 0) { $data[IN]=1; } 117 | else { $data[IN] = 0; } 118 | $data[OUT] = 0; 119 | } 120 | } 121 | elseif(preg_match("/^cacti(thold|monitor):(\d+)$/",$targetstring,$matches)) 122 | { 123 | $type = $matches[1]; 124 | $id = intval($matches[2]); 125 | 126 | if($type=='thold') 127 | { 128 | // VERY simple. Returns 0 if threshold is not breached, 1 if it is. 129 | // use target aggregation to build these up into a 'badness' percentage 130 | $SQL2 = "select thold_alert from thold_data where id=$id and thold_enabled='on'"; 131 | $result = db_fetch_row($SQL2); 132 | if(isset($result)) 133 | { 134 | if($result['thold_alert'] > 0) { $data[IN]=1; } 135 | else { $data[IN] = 0; } 136 | $data[OUT] = 0; 137 | } 138 | } 139 | 140 | if($type=='monitor') 141 | { 142 | wm_debug("CactiTHold ReadData: Getting cacti basic state for host $id\n"); 143 | $SQL = "select * from host where id=$id"; 144 | 145 | // 0=disabled 146 | // 1=down 147 | // 2=recovering 148 | // 3=up 149 | // 4=tholdbreached 150 | 151 | $state = -1; 152 | $statename = ''; 153 | $result = db_fetch_row($SQL); 154 | if(isset($result)) 155 | { 156 | // create a note, which can be used in icon filenames or labels more nicely 157 | if($result['status'] == 1) { $state = 1; $statename = 'down'; } 158 | if($result['status'] == 2) { $state = 2; $statename = 'recovering'; } 159 | if($result['status'] == 3) { $state = 3; $statename = 'up'; } 160 | if($result['disabled']) { $state = 0; $statename = 'disabled'; } 161 | 162 | $data[IN] = $state; 163 | $data[OUT] = 0; 164 | $item->add_note("state",$statename); 165 | $item->add_note("cacti_description",$result['description']); 166 | 167 | $item->add_note("cacti_hostname",$result['hostname']); 168 | $item->add_note("cacti_curtime",$result['cur_time']); 169 | $item->add_note("cacti_avgtime",$result['avg_time']); 170 | $item->add_note("cacti_mintime",$result['min_time']); 171 | $item->add_note("cacti_maxtime",$result['max_time']); 172 | $item->add_note("cacti_availability",$result['availability']); 173 | 174 | $item->add_note("cacti_faildate",$result['status_fail_date']); 175 | $item->add_note("cacti_recdate",$result['status_rec_date']); 176 | } 177 | wm_debug("CactiTHold ReadData: Basic state for host $id is $state/$statename\n"); 178 | 179 | wm_debug("CactiTHold ReadData: Checking threshold states for host $id\n"); 180 | $numthresh = 0; 181 | $numfailing = 0; 182 | $SQL2 = "select rra_id, data_id, thold_alert from thold_data,data_local where thold_data.rra_id=data_local.id and data_local.host_id=$id and thold_enabled='on'"; 183 | # $result = db_fetch_row($SQL2); 184 | $queryrows = db_fetch_assoc($SQL2); 185 | if( is_array($queryrows) ) 186 | { 187 | foreach ($queryrows as $th) { 188 | $desc = $th['rra_id']."/".$th['data_id']; 189 | $v = $th['thold_alert']; 190 | $numthresh++; 191 | if(intval($th['thold_alert']) > 0) 192 | { 193 | wm_debug("CactiTHold ReadData: Seen threshold $desc failing ($v)for host $id\n"); 194 | $numfailing++; 195 | } 196 | else 197 | { 198 | wm_debug("CactiTHold ReadData: Seen threshold $desc OK ($v) for host $id\n"); 199 | } 200 | } 201 | } 202 | else 203 | { 204 | wm_debug("CactiTHold ReadData: Failed to get thold info for host $id\n"); 205 | } 206 | 207 | wm_debug("CactiTHold ReadData: Checked $numthresh and found $numfailing failing\n"); 208 | 209 | if( ($numfailing > 0) && ($numthresh > 0) && ($state==3) ) 210 | { 211 | $state = 4; 212 | $statename = "tholdbreached"; 213 | $item->add_note("state",$statename); 214 | $item->add_note("thold_failcount",$numfailing); 215 | $item->add_note("thold_failpercent",($numfailing/$numthresh)*100); 216 | $data[IN] = $state; 217 | $data[OUT] = $numfailing; 218 | wm_debug("CactiTHold ReadData: State is $state/$statename\n"); 219 | } 220 | elseif( $numthresh>0 ) 221 | { 222 | $item->add_note("thold_failcount",0); 223 | $item->add_note("thold_failpercent",0); 224 | wm_debug("CactiTHold ReadData: Leaving state as $state\n"); 225 | } 226 | } 227 | } 228 | 229 | wm_debug ("CactiTHold ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 230 | 231 | return( array($data[IN], $data[OUT], $data_time) ); 232 | } 233 | } 234 | 235 | 236 | // vim:ts=4:sw=4: 237 | ?> 238 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_dbsample.php: -------------------------------------------------------------------------------- 1 | get_hint('dbplug_dbuser'); 38 | $database_pass = $map->get_hint('dbplug_dbpass'); 39 | $database_name = $map->get_hint('dbplug_dbname'); 40 | $database_host = $map->get_hint('dbplug_dbhost'); 41 | 42 | $key = mysql_real_escape_string($matches[1]); 43 | 44 | $SQL = "select in,out from table where host=$key LIMIT 1"; 45 | if(mysql_connect($database_host,$database_user,$database_pass)) 46 | { 47 | if(mysql_select_db($database_name)) 48 | { 49 | $result = mysql_query($SQL); 50 | if (!$result) 51 | { 52 | wm_warn("dbsample ReadData: Invalid query: " . mysql_error()."\n"); 53 | } 54 | else 55 | { 56 | $row = mysql_fetch_assoc($result); 57 | $data[IN] = $row['in']; 58 | $data[OUT] = $row['out']; 59 | } 60 | } 61 | else 62 | { 63 | wm_warn("dbsample ReadData: failed to select database: ".mysql_error()."\n"); 64 | } 65 | } 66 | else 67 | { 68 | wm_warn("dbsample ReadData: failed to connect to database server: ".mysql_error()."\n"); 69 | } 70 | 71 | $data_time = now(); 72 | } 73 | 74 | 75 | wm_debug ("RRD ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[IN]).",$data_time)\n"); 76 | 77 | return( array($data[IN], $data[OUT], $data_time) ); 78 | } 79 | } 80 | 81 | // vim:ts=4:sw=4: 82 | ?> 83 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_dsstats.php: -------------------------------------------------------------------------------- 1 | context=='cacti') 11 | { 12 | if( !function_exists('db_fetch_row') ) 13 | { 14 | wm_debug("ReadData DSStats: Cacti database library not found. [DSSTATS001]\n"); 15 | return(FALSE); 16 | } 17 | if(function_exists("api_plugin_is_enabled")) 18 | { 19 | if(! api_plugin_is_enabled('dsstats')) 20 | { 21 | wm_debug("ReadData DSStats: DSStats plugin not enabled (new-style). [DSSTATS002B]\n"); 22 | return(FALSE); 23 | } 24 | } 25 | else 26 | { 27 | if( !isset($plugins) || !in_array('dsstats',$plugins)) 28 | { 29 | wm_debug("ReadData DSStats: DSStats plugin not enabled (old-style). [DSSTATS002A]\n"); 30 | return(FALSE); 31 | } 32 | } 33 | 34 | $sql = "show tables"; 35 | $result = db_fetch_assoc($sql) or die (mysql_error()); 36 | $tables = array(); 37 | 38 | foreach($result as $index => $arr) { 39 | foreach ($arr as $t) { 40 | $tables[] = $t; 41 | } 42 | } 43 | 44 | if( !in_array('data_source_stats_hourly_last', $tables) ) 45 | { 46 | wm_debug('ReadData DSStats: data_source_stats_hourly_last database table not found. [DSSTATS003]\n'); 47 | return(FALSE); 48 | } 49 | 50 | return(TRUE); 51 | } 52 | 53 | return(FALSE); 54 | } 55 | 56 | # dsstats:::: 57 | 58 | function Recognise($targetstring) 59 | { 60 | if(preg_match("/^dsstats:([a-z]+):(\d+):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/",$targetstring,$matches)) 61 | { 62 | return TRUE; 63 | } 64 | elseif(preg_match("/^dsstats:(\d+):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/",$targetstring,$matches)) 65 | { 66 | return TRUE; 67 | } 68 | else 69 | { 70 | return FALSE; 71 | } 72 | } 73 | 74 | 75 | 76 | // Actually read data from a data source, and return it 77 | // returns a 3-part array (invalue, outvalue and datavalid time_t) 78 | // invalue and outvalue should be -1,-1 if there is no valid data 79 | // data_time is intended to allow more informed graphing in the future 80 | function ReadData($targetstring, &$map, &$item) 81 | { 82 | global $config; 83 | 84 | $dsnames[IN] = "traffic_in"; 85 | $dsnames[OUT] = "traffic_out"; 86 | $data[IN] = NULL; 87 | $data[OUT] = NULL; 88 | 89 | $inbw = NULL; 90 | $outbw = NULL; 91 | $data_time = 0; 92 | 93 | $table = ""; 94 | $keyfield = "rrd_name"; 95 | $datatype = ""; 96 | $field = ""; 97 | 98 | if(preg_match("/^dsstats:(\d+):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/",$targetstring,$matches)) 99 | { 100 | $local_data_id = $matches[1]; 101 | $dsnames[IN] = $matches[2]; 102 | $dsnames[OUT] = $matches[3]; 103 | 104 | $datatype = "last"; 105 | 106 | if($map->get_hint("dsstats_default_type") != '') { 107 | $datatype = $map->get_hint("dsstats_default_type"); 108 | wm_debug("Default datatype changed to ".$datatype.".\n"); 109 | } 110 | }elseif(preg_match("/^dsstats:([a-z]+):(\d+):([\-a-zA-Z0-9_]+):([\-a-zA-Z0-9_]+)$/",$targetstring,$matches)) 111 | { 112 | $dsnames[IN] = $matches[3]; 113 | $dsnames[OUT] = $matches[4]; 114 | $datatype = $matches[1]; 115 | $local_data_id = $matches[2]; 116 | } 117 | 118 | if( substr($datatype,0,5) == "daily") $table = "data_source_stats_daily"; 119 | if( substr($datatype,0,6) == "weekly") $table = "data_source_stats_weekly"; 120 | if( substr($datatype,0,7) == "monthly") $table = "data_source_stats_monthly"; 121 | if( substr($datatype,0,6) == "hourly") $table = "data_source_stats_hourly"; 122 | if( substr($datatype,0,6) == "yearly") $table = "data_source_stats_yearly"; 123 | 124 | if( substr($datatype,-7) == "average" ) $field = "average"; 125 | if( substr($datatype,-4) == "peak" ) $field = "peak"; 126 | 127 | if($datatype == "last") 128 | { 129 | $field = "calculated"; 130 | $table = "data_source_stats_hourly_last"; 131 | } 132 | 133 | if($datatype == "wm") 134 | { 135 | $field = "last_calc"; 136 | $table = "weathermap_data"; 137 | $keyfield = "data_source_name"; 138 | } 139 | 140 | if($table != "" and $field != "") 141 | { 142 | $SQL = sprintf("select %s as name, %s as result from %s where local_data_id=%d and (%s='%s' or %s='%s')", 143 | $keyfield, $field, 144 | $table, $local_data_id, $keyfield, 145 | mysql_escape_string($dsnames[IN]), $keyfield, mysql_escape_string($dsnames[OUT]) 146 | ); 147 | 148 | $results = db_fetch_assoc($SQL); 149 | if(sizeof($results)>0) 150 | { 151 | foreach ($results as $result) 152 | { 153 | foreach ( array(IN,OUT) as $dir) 154 | { 155 | if( ($dsnames[$dir] == $result['name']) && ($result['result'] != -90909090909) && ($result['result'] !='U') ) 156 | { 157 | $data[$dir] = $result['result']; 158 | } 159 | } 160 | } 161 | } 162 | 163 | if($datatype=='wm' && ($data[IN] == NULL || $data[OUT] == NULL) ) 164 | { 165 | wm_debug("Didn't get data for 'wm' source. Inserting new tasks."); 166 | // insert the required details into weathermap_data, so it will be picked up next time 167 | $SQL = sprintf("select data_template_data.data_source_path as path from data_template_data,data_template_rrd where data_template_data.local_data_id=data_template_rrd.local_data_id and data_template_rrd.local_data_id=%d", 168 | $local_data_id 169 | ); 170 | $result = db_fetch_row($SQL); 171 | if(sizeof($result)>0) 172 | { 173 | $db_rrdname = $result['path']; 174 | wm_debug("Filename is $db_rrdname"); 175 | foreach (array(IN,OUT) as $dir) 176 | { 177 | if($data[$dir] === NULL) 178 | { 179 | $SQLins = "insert into weathermap_data (rrdfile, data_source_name, sequence, local_data_id) values ('" . 180 | mysql_real_escape_string($db_rrdname) . "','" . 181 | mysql_real_escape_string($dsnames[$dir]) . "', 0," . 182 | $local_data_id.")"; 183 | // warn($SQLins); 184 | db_execute($SQLins); 185 | } 186 | } 187 | } 188 | else 189 | { 190 | wm_warn("DSStats ReadData: Failed to find a filename for DS id $local_data_id [WMDSTATS01]"); 191 | } 192 | } 193 | } 194 | 195 | // fill all that other information (ifSpeed, etc) 196 | if($local_data_id>0) UpdateCactiData($item, $local_data_id); 197 | 198 | wm_debug ("DSStats ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 199 | 200 | return( array($data[IN], $data[OUT], $data_time) ); 201 | } 202 | } 203 | 204 | // vim:ts=4:sw=4: 205 | ?> 206 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_external.php.disabled: -------------------------------------------------------------------------------- 1 | add_hint("external_line1",$lines[0]); 66 | $item->add_hint("external_line2",$lines[1]); 67 | $item->add_hint("external_line3",$lines[2]); 68 | $item->add_hint("external_line4",$lines[3]); 69 | $data_time = time(); 70 | } 71 | else 72 | { 73 | wm_warn("ExternalScript ReadData: Not enough lines read from external script ($i read, 4 expected) [WMEXT02]\n"); 74 | } 75 | } 76 | } 77 | 78 | wm_debug ("ExternalScript ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 79 | 80 | return( array($data[IN], $data[OUT], $data_time) ); 81 | } 82 | } 83 | 84 | // vim:ts=4:sw=4: 85 | 86 | ?> 87 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_fping.php: -------------------------------------------------------------------------------- 1 | fping_cmd = "/usr/local/sbin/fping"; 20 | 21 | return(TRUE); 22 | } 23 | 24 | // this function will get called for every datasource, even if we replied FALSE to Init. 25 | // (so that we can warn the user that it *would* have worked, if only the plugin could run) 26 | // SO... don't do anything in here that relies on the things that Init looked for, because they might not exist! 27 | function Recognise($targetstring) 28 | { 29 | if(preg_match("/^fping:(\S+)$/",$targetstring,$matches)) 30 | { 31 | // save the address. This way, we can do ONE fping call for all the pings in the map. 32 | // fping does it all in parallel, so 10 hosts takes the same time as 1 33 | $this->addresscache[]=$matches[1]; 34 | return TRUE; 35 | } 36 | else 37 | { 38 | return FALSE; 39 | } 40 | } 41 | 42 | function ReadData($targetstring, &$map, &$item) 43 | { 44 | $data[IN] = NULL; 45 | $data[OUT] = NULL; 46 | $data_time = 0; 47 | 48 | #debug("-------------------------\n"); 49 | #print_r($this->addresscache); 50 | #debug("-------------------------\n"); 51 | 52 | $ping_count = intval($map->get_hint("fping_ping_count")); 53 | if($ping_count==0) $ping_count = 5; 54 | 55 | if(preg_match("/^fping:(\S+)$/",$targetstring,$matches)) 56 | { 57 | $target = $matches[1]; 58 | 59 | $pattern = "/^$target\s:"; 60 | for($i=0;$i<$ping_count;$i++) $pattern .= "\s(\S+)"; 61 | $pattern .= "/"; 62 | 63 | if(is_executable($this->fping_cmd)) 64 | { 65 | $command = $this->fping_cmd." -t100 -r1 -p20 -u -C $ping_count -i10 -q $target 2>&1"; 66 | wm_debug("Running $command\n"); 67 | $pipe=popen($command, "r"); 68 | 69 | $count = 0; $hitcount=0; 70 | if (isset($pipe)) 71 | { 72 | while (!feof($pipe)) 73 | { 74 | $line=fgets($pipe, 4096); 75 | $count++; 76 | wm_debug("Output: $line"); 77 | 78 | if(preg_match($pattern, $line, $matches)) 79 | { 80 | wm_debug("Found output line for $target\n"); 81 | $hitcount++; 82 | $loss = 0; 83 | $ave = 0; 84 | $total = 0; 85 | $cnt = 0; 86 | $min = 999999; 87 | $max = 0; 88 | for($i=1;$i<=$ping_count;$i++) 89 | { 90 | if($matches[$i]=='-') 91 | { $loss+=(100/$ping_count); } 92 | else 93 | { 94 | $cnt++; 95 | $total += $matches[$i]; 96 | $max = max($matches[$i],$max); 97 | $min = min($matches[$i],$min); 98 | } 99 | } 100 | if($cnt >0) $ave = $total/$cnt; 101 | 102 | wm_debug("Result: $cnt $min -> $max $ave $loss\n"); 103 | } 104 | } 105 | pclose ($pipe); 106 | if($count==0) 107 | { 108 | wm_warn("FPing ReadData: No lines read. Bad hostname? ($target) [WMFPING03]\n"); 109 | } 110 | else 111 | { 112 | if($hitcount == 0) 113 | { 114 | wm_warn("FPing ReadData: $count lines read. But nothing returned for target??? ($target) Try running with DEBUG to see output. [WMFPING02]\n"); 115 | } 116 | else 117 | { 118 | $data[IN] = $ave; 119 | $data[OUT] = $loss; 120 | $item->add_note("fping_min",$min); 121 | $item->add_note("fping_max",$max); 122 | } 123 | } 124 | } 125 | } 126 | else 127 | { 128 | wm_warn("FPing ReadData: Can't find fping executable. Check path at line 19 of WeatherMapDataSource_fping.php [WMFPING01]\n"); 129 | } 130 | } 131 | 132 | wm_debug ("FPing ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 133 | 134 | return( array($data[IN], $data[OUT], $data_time) ); 135 | } 136 | } 137 | 138 | // vim:ts=4:sw=4: 139 | ?> 140 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_mrtg.php: -------------------------------------------------------------------------------- 1 | get_hint('mrtg_value'); 28 | $matchperiod = $item->get_hint('mrtg_period'); 29 | $swap = intval($item->get_hint('mrtg_swap')); 30 | $negate = intval($item->get_hint('mrtg_negate')); 31 | 32 | if($matchvalue =='') $matchvalue = "cu"; 33 | if($matchperiod =='') $matchperiod = "d"; 34 | 35 | $fd=fopen($targetstring, "r"); 36 | 37 | if ($fd) 38 | { 39 | while (!feof($fd)) 40 | { 41 | $buffer=fgets($fd, 4096); 42 | wm_debug("MRTG ReadData: Matching on '${matchvalue}in $matchperiod' and '${matchvalue}out $matchperiod'\n"); 43 | 44 | if (preg_match("/<\!-- ${matchvalue}in $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[IN] = $matches[1] * 8; } 45 | if (preg_match("/<\!-- ${matchvalue}out $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[OUT] = $matches[1] * 8; } 46 | } 47 | fclose($fd); 48 | # don't bother with the modified time if the target is a URL 49 | if(! preg_match('/^[a-z]+:\/\//',$targetstring) ) 50 | { 51 | $data_time = filemtime($targetstring); 52 | } 53 | } 54 | else 55 | { 56 | // some error code to go in here 57 | wm_debug ("MRTG ReadData: Couldn't open ($targetstring). \n"); 58 | } 59 | 60 | if($swap==1) 61 | { 62 | wm_debug("MRTG ReadData: Swapping IN and OUT\n"); 63 | $t = $data[OUT]; 64 | $data[OUT] = $data[IN]; 65 | $data[IN] = $t; 66 | } 67 | 68 | if($negate) 69 | { 70 | wm_debug("MRTG ReadData: Negating values\n"); 71 | $data[OUT] = -$data[OUT]; 72 | $data[IN] = -$data[IN]; 73 | } 74 | 75 | wm_debug ("MRTG ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 76 | 77 | return( array($data[IN], $data[OUT], $data_time) ); 78 | } 79 | } 80 | 81 | // vim:ts=4:sw=4: 82 | ?> 83 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_skeleton.php.txt: -------------------------------------------------------------------------------- 1 | 50 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_snmp.php: -------------------------------------------------------------------------------- 1 | down_cache = array(); 22 | 23 | if(function_exists('snmpget')) { return(TRUE); } 24 | wm_debug("SNMP DS: snmpget() not found. Do you have the PHP SNMP module?\n"); 25 | 26 | return(FALSE); 27 | } 28 | 29 | 30 | function Recognise($targetstring) 31 | { 32 | if(preg_match("/^snmp:([^:]+):([^:]+):([^:]+):([^:]+)$/",$targetstring,$matches)) 33 | { 34 | return TRUE; 35 | } 36 | else 37 | { 38 | return FALSE; 39 | } 40 | } 41 | 42 | function ReadData($targetstring, &$map, &$item) 43 | { 44 | $data[IN] = NULL; 45 | $data[OUT] = NULL; 46 | $data_time = 0; 47 | 48 | $timeout = 1000000; 49 | $retries = 2; 50 | $abort_count = 0; 51 | 52 | $in_result = NULL; 53 | $out_result = NULL; 54 | 55 | if($map->get_hint("snmp_timeout") != '') { 56 | $timeout = intval($map->get_hint("snmp_timeout")); 57 | wm_debug("Timeout changed to ".$timeout." microseconds.\n"); 58 | } 59 | 60 | if($map->get_hint("snmp_abort_count") != '') { 61 | $abort_count = intval($map->get_hint("snmp_abort_count")); 62 | wm_debug("Will abort after $abort_count failures for a given host.\n"); 63 | } 64 | 65 | if($map->get_hint("snmp_retries") != '') { 66 | $retries = intval($map->get_hint("snmp_retries")); 67 | wm_debug("Number of retries changed to ".$retries.".\n"); 68 | } 69 | 70 | if(preg_match("/^snmp:([^:]+):([^:]+):([^:]+):([^:]+)$/",$targetstring,$matches)) 71 | { 72 | $community = $matches[1]; 73 | $host = $matches[2]; 74 | $in_oid = $matches[3]; 75 | $out_oid = $matches[4]; 76 | 77 | if( 78 | ($abort_count == 0) 79 | || ( 80 | ( $abort_count>0 ) 81 | && ( !isset($this->down_cache[$host]) || intval($this->down_cache[$host]) < $abort_count ) 82 | ) 83 | ) 84 | { 85 | if(function_exists("snmp_get_quick_print")) 86 | { 87 | $was = snmp_get_quick_print(); 88 | snmp_set_quick_print(1); 89 | } 90 | if(function_exists("snmp_get_valueretrieval")) 91 | { 92 | $was2 = snmp_get_valueretrieval(); 93 | } 94 | 95 | if(function_exists('snmp_set_oid_output_format')) 96 | { 97 | snmp_set_oid_output_format ( SNMP_OID_OUTPUT_NUMERIC ); 98 | } 99 | if(function_exists('snmp_set_valueretrieval')) 100 | { 101 | snmp_set_valueretrieval(SNMP_VALUE_PLAIN); 102 | } 103 | 104 | if($in_oid != '-') 105 | { 106 | $in_result = snmpget($host,$community,$in_oid,$timeout,$retries); 107 | if($in_result !== FALSE) 108 | { 109 | $data[IN] = floatval($in_result); 110 | $item->add_hint("snmp_in_raw",$in_result); 111 | } 112 | else 113 | { 114 | $this->down_cache{$host}++; 115 | } 116 | } 117 | if($out_oid != '-') 118 | { 119 | $out_result = snmpget($host,$community,$out_oid,$timeout,$retries); 120 | if($out_result !== FALSE) 121 | { 122 | // use floatval() here to force the output to be *some* kind of number 123 | // just in case the stupid formatting stuff doesn't stop net-snmp returning 'down' instead of 2 124 | $data[OUT] = floatval($out_result); 125 | $item->add_hint("snmp_out_raw",$out_result); 126 | } 127 | else 128 | { 129 | $this->down_cache{$host}++; 130 | } 131 | } 132 | 133 | wm_debug ("SNMP ReadData: Got $in_result and $out_result\n"); 134 | 135 | $data_time = time(); 136 | 137 | if(function_exists("snmp_set_quick_print")) 138 | { 139 | snmp_set_quick_print($was); 140 | } 141 | } 142 | else 143 | { 144 | wm_warn("SNMP for $host has reached $abort_count failures. Skipping. [WMSNMP01]"); 145 | } 146 | } 147 | 148 | wm_debug ("SNMP ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 149 | 150 | return( array($data[IN], $data[OUT], $data_time) ); 151 | } 152 | } 153 | 154 | // vim:ts=4:sw=4: 155 | ?> 156 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_static.php: -------------------------------------------------------------------------------- 1 | kilo); 32 | $outbw = unformat_number($matches[2], $map->kilo); 33 | $data_time = time(); 34 | } 35 | 36 | if(preg_match("/^static:(\-?\d+\.?\d*[KMGT]*)$/",$targetstring,$matches)) 37 | { 38 | $inbw = unformat_number($matches[1], $map->kilo); 39 | $outbw = $inbw; 40 | $data_time = time(); 41 | } 42 | wm_debug ("Static ReadData: Returning ($inbw,$outbw,$data_time)\n"); 43 | 44 | return ( array($inbw,$outbw,$data_time) ); 45 | } 46 | } 47 | 48 | // vim:ts=4:sw=4: 49 | ?> 50 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_tabfile.php: -------------------------------------------------------------------------------- 1 | name; 28 | 29 | $matches=0; 30 | 31 | $fd=fopen($targetstring, "r"); 32 | 33 | if ($fd) 34 | { 35 | while (!feof($fd)) 36 | { 37 | $buffer=fgets($fd, 4096); 38 | # strip out any Windows line-endings that have gotten in here 39 | $buffer=str_replace("\r", "", $buffer); 40 | 41 | if (preg_match("/^$itemname\t(\d+\.?\d*[KMGT]*)\t(\d+\.?\d*[KMGT]*)/", $buffer, $matches)) 42 | { 43 | $data[IN]=unformat_number($matches[1]); 44 | $data[OUT]=unformat_number($matches[2]); 45 | } 46 | } 47 | $stats = stat($targetstring); 48 | $data_time = $stats['mtime']; 49 | } 50 | else { 51 | // some error code to go in here 52 | wm_debug ("TabText ReadData: Couldn't open ($targetstring). \n"); } 53 | 54 | wm_debug ("TabText ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 55 | 56 | return( array($data[IN], $data[OUT], $data_time) ); 57 | } 58 | } 59 | 60 | // vim:ts=4:sw=4: 61 | ?> 62 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_time.php: -------------------------------------------------------------------------------- 1 | name; 29 | 30 | $matches=0; 31 | 32 | if(preg_match("/^time:(.*)$/",$targetstring,$matches)) 33 | { 34 | $timezone = $matches[1]; 35 | $timezone_l = strtolower($timezone); 36 | 37 | $timezone_identifiers = DateTimeZone::listIdentifiers(); 38 | 39 | foreach ($timezone_identifiers as $tz) 40 | { 41 | if(strtolower($tz) == $timezone_l) 42 | { 43 | wm_debug ("Time ReadData: Timezone exists: $tz\n"); 44 | $dateTime = new DateTime("now", new DateTimeZone($tz)); 45 | 46 | $item->add_note("time_time12",$dateTime->format("h:i")); 47 | $item->add_note("time_time12ap",$dateTime->format("h:i A")); 48 | $item->add_note("time_time24",$dateTime->format("H:i")); 49 | $item->add_note("time_timezone",$tz); 50 | $data[IN] = $dateTime->format("H"); 51 | $data_time = time(); 52 | $data[OUT] = $dateTime->format("i"); 53 | $matches++; 54 | } 55 | } 56 | if($matches==0) 57 | { 58 | wm_warn ("Time ReadData: Couldn't recognize $timezone as a valid timezone name [WMTIME02]\n"); 59 | } 60 | } 61 | else { 62 | // some error code to go in here 63 | wm_warn ("Time ReadData: Couldn't recognize $targetstring \n"); 64 | } 65 | 66 | wm_debug ("Time ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)\n"); 67 | 68 | return( array($data[IN], $data[OUT], $data_time) ); 69 | } 70 | } 71 | 72 | // vim:ts=4:sw=4: 73 | ?> 74 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_wmdata.php: -------------------------------------------------------------------------------- 1 | name; 21 | 22 | $matches = 0; 23 | 24 | if( preg_match("/^wmdata:([^:]*):(.*)", $targetstring, $matches)) { 25 | $datafile = $matches[1]; 26 | $dataname = $matches[2]; 27 | } 28 | 29 | if( file_exists($datafile)) { 30 | $fd = fopen($targetstring, "r"); 31 | if ($fd) { 32 | $found = false; 33 | while (!feof($fd)) { 34 | $buffer = fgets($fd, 4096); 35 | # strip out any Windows line-endings that have gotten in here 36 | $buffer = str_replace("\r", "", $buffer); 37 | 38 | $fields = explode("\t",$buffer); 39 | if($fields[0] == $dataname) { 40 | $data[IN] = $fields[1]; 41 | $data[OUT] = $fields[2]; 42 | $found = true; 43 | } 44 | } 45 | 46 | if($found===true) { 47 | $stats = stat($datafile); 48 | $data_time = $stats['mtime']; 49 | } else { 50 | wm_warn("WMData ReadData: Data name ($dataname) didn't exist in ($datafile). [WMWMDATA03]\n"); 51 | } 52 | 53 | } else { 54 | wm_warn("WMData ReadData: Couldn't open ($datafile). [WMWMDATA02]\n"); 55 | } 56 | 57 | } else { 58 | wm_warn("WMData ReadData: $datafile doesn't exist [WMWMDATA01]"); 59 | } 60 | 61 | 62 | wm_debug( sprintf("WMData ReadData: Returning (%s, %s, %s)\n", 63 | string_or_null($data[IN]), 64 | string_or_null($data[OUT]), 65 | $data_time 66 | )); 67 | 68 | return (array ( 69 | $data[IN], 70 | $data[OUT], 71 | $data_time 72 | )); 73 | } 74 | } 75 | 76 | // vim:ts=4:sw=4: 77 | ?> -------------------------------------------------------------------------------- /lib/ds-common.php: -------------------------------------------------------------------------------- 1 | owner; 7 | 8 | wm_debug("fetching for $local_data_id\n"); 9 | 10 | if( isset($map->dsinfocache[$local_data_id])) { 11 | $to_set = $map->dsinfocache[$local_data_id]; 12 | } 13 | else 14 | { 15 | $to_set = array(); 16 | 17 | $set_speed = intval($item->get_hint("cacti_use_ifspeed")); 18 | 19 | $r3 = 20 | db_fetch_assoc( 21 | sprintf( 22 | "select data_local.host_id, field_name,field_value from data_local,host_snmp_cache USE INDEX (host_id) where data_local.id=%d and data_local.host_id=host_snmp_cache.host_id and data_local.snmp_index=host_snmp_cache.snmp_index and data_local.snmp_query_id=host_snmp_cache.snmp_query_id", 23 | $local_data_id)); 24 | 25 | foreach ($r3 as $vv) { 26 | $vname = "cacti_" . $vv['field_name']; 27 | $to_set[$vname] = $vv['field_value']; 28 | } 29 | 30 | if ($set_speed != 0) { 31 | 32 | $ifSpeed = intval($to_set['cacti_ifSpeed']); 33 | $ifHighSpeed = intval($to_set['cacti_ifHighSpeed']); 34 | $speed = 0; 35 | 36 | if ($ifSpeed > 0) { 37 | $speed = $ifSpeed; 38 | } 39 | 40 | # see https://lists.oetiker.ch/pipermail/mrtg/2004-November/029312.html 41 | if ($ifHighSpeed > 20) { 42 | $speed = $ifHighSpeed . "M"; 43 | } 44 | 45 | if ($speed > 0) { 46 | // might need to dust these off for php4... 47 | if ($item->my_type() == 'NODE') { 48 | $map->nodes[$item->name]->max_bandwidth_in = $speed; 49 | $map->nodes[$item->name]->max_bandwidth_out = $speed; 50 | } 51 | 52 | if ($item->my_type() == 'LINK') { 53 | $map->links[$item->name]->max_bandwidth_in = $speed; 54 | $map->links[$item->name]->max_bandwidth_out = $speed; 55 | } 56 | } 57 | } 58 | 59 | if (isset($vv['host_id'])) { 60 | $to_set['cacti_host_id'] = intval($vv['host_id']); 61 | } 62 | 63 | $r4 = 64 | db_fetch_row( 65 | sprintf( 66 | "SELECT DISTINCT graph_templates_item.local_graph_id,title_cache FROM graph_templates_item,graph_templates_graph,data_template_rrd WHERE data_template_rrd.id=task_item_id and graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id and local_data_id=%d LIMIT 1", 67 | $local_data_id)); 68 | 69 | if (isset($r4['local_graph_id'])) { 70 | $to_set["cacti_graph_id"] = intval($r4['local_graph_id']); 71 | } 72 | 73 | $map->dsinfocache[$local_data_id] = $to_set; 74 | 75 | } 76 | 77 | # By now, we have the values, one way or another. 78 | 79 | foreach ($to_set as $k=>$v) 80 | { 81 | $item->add_note($k, $v); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /lib/index.php: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /lib/poller-common.php: -------------------------------------------------------------------------------- 1 | = POLLER_VERBOSITY_DEBUG) 72 | { 73 | $weathermap_debugging = TRUE; 74 | $mode_message = "DEBUG mode is on"; 75 | } 76 | else 77 | { 78 | $mode_message = "Normal logging mode. Turn on DEBUG in Cacti for more information"; 79 | } 80 | $quietlogging = read_config_option("weathermap_quiet_logging"); 81 | // moved this outside the module_checks, so there should always be something in the logs! 82 | if($quietlogging==0) cacti_log("Weathermap $WEATHERMAP_VERSION starting - $mode_message\n",true,"WEATHERMAP"); 83 | 84 | if(wm_module_checks()) 85 | { 86 | weathermap_memory_check("MEM Initial"); 87 | // move to the weathermap folder so all those relatives paths don't *have* to be absolute 88 | $orig_cwd = getcwd(); 89 | chdir($mydir); 90 | 91 | db_execute("replace into settings values('weathermap_last_start_time','".mysql_escape_string(time())."')"); 92 | 93 | // first, see if the output directory even exists 94 | if(is_dir($outdir)) 95 | { 96 | // next, make sure that we stand a chance of writing files 97 | //// $testfile = realpath($outdir."weathermap.permissions.test"); 98 | $testfile = $outdir.DIRECTORY_SEPARATOR."weathermap.permissions.test"; 99 | $testfd = fopen($testfile, 'w'); 100 | if($testfd) 101 | { 102 | fclose($testfd); 103 | unlink($testfile); 104 | 105 | $queryrows = db_fetch_assoc("select m.*, g.name as groupname from weathermap_maps m,weathermap_groups g where m.group_id=g.id and active='on' order by sortorder,id"); 106 | 107 | if( is_array($queryrows) ) 108 | { 109 | wm_debug("Iterating all maps."); 110 | 111 | $imageformat = strtolower(read_config_option("weathermap_output_format")); 112 | $rrdtool_path = read_config_option("path_rrdtool"); 113 | 114 | foreach ($queryrows as $map) { 115 | // reset the warning counter 116 | $weathermap_warncount=0; 117 | // this is what will prefix log entries for this map 118 | $weathermap_map = "[Map ".$map['id']."] ".$map['configfile']; 119 | 120 | wm_debug("FIRST TOUCH\n"); 121 | 122 | if(weathermap_check_cron($weathermap_poller_start_time,$map['schedule'])) 123 | { 124 | $mapfile = $confdir.DIRECTORY_SEPARATOR.$map['configfile']; 125 | $htmlfile = $outdir.DIRECTORY_SEPARATOR.$map['filehash'].".html"; 126 | $imagefile = $outdir.DIRECTORY_SEPARATOR.$map['filehash'].".".$imageformat; 127 | $thumbimagefile = $outdir.DIRECTORY_SEPARATOR.$map['filehash'].".thumb.".$imageformat; 128 | 129 | if(file_exists($mapfile)) 130 | { 131 | if($quietlogging==0) wm_warn("Map: $mapfile -> $htmlfile & $imagefile\n",TRUE); 132 | db_execute("replace into settings values('weathermap_last_started_file','".mysql_escape_string($weathermap_map)."')"); 133 | $map_start = time(); 134 | weathermap_memory_check("MEM starting $mapcount"); 135 | $wmap = new Weathermap; 136 | $wmap->context = "cacti"; 137 | 138 | // we can grab the rrdtool path from Cacti's config, in this case 139 | $wmap->rrdtool = $rrdtool_path; 140 | 141 | $wmap->ReadConfig($mapfile); 142 | 143 | $wmap->add_hint("mapgroup",$map['groupname']); 144 | $wmap->add_hint("mapgroupextra",($map['group_id'] ==1 ? "" : $map['groupname'] )); 145 | 146 | # in the order of precedence - global extras, group extras, and finally map extras 147 | $queries = array(); 148 | $queries[] = "select * from weathermap_settings where mapid=0 and groupid=0"; 149 | $queries[] = "select * from weathermap_settings where mapid=0 and groupid=".intval($map['group_id']); 150 | $queries[] = "select * from weathermap_settings where mapid=".intval($map['id']); 151 | 152 | foreach ($queries as $sql) 153 | { 154 | $settingrows = db_fetch_assoc($sql); 155 | if( is_array($settingrows) && count($settingrows) > 0 ) 156 | { 157 | 158 | foreach ($settingrows as $setting) 159 | { 160 | if($setting['mapid']==0 && $setting['groupid']==0) 161 | { 162 | wm_debug("Setting additional (all maps) option: ".$setting['optname']." to '".$setting['optvalue']."'\n"); 163 | $wmap->add_hint($setting['optname'],$setting['optvalue']); 164 | } 165 | elseif($setting['groupid']!=0) 166 | { 167 | wm_debug("Setting additional (all maps in group) option: ".$setting['optname']." to '".$setting['optvalue']."'\n"); 168 | $wmap->add_hint($setting['optname'],$setting['optvalue']); 169 | } 170 | else 171 | { wm_debug("Setting additional map-global option: ".$setting['optname']." to '".$setting['optvalue']."'\n"); 172 | $wmap->add_hint($setting['optname'],$setting['optvalue']); 173 | } 174 | } 175 | } 176 | } 177 | 178 | weathermap_memory_check("MEM postread $mapcount"); 179 | $wmap->ReadData(); 180 | weathermap_memory_check("MEM postdata $mapcount"); 181 | 182 | // why did I change this before? It's useful... 183 | // $wmap->imageuri = $config['url_path'].'/plugins/weathermap/output/weathermap_'.$map['id'].".".$imageformat; 184 | $wmap->imageuri = 'weathermap-cacti-plugin.php?action=viewimage&id='.$map['filehash']."&time=".time(); 185 | 186 | if($quietlogging==0) wm_warn("About to write image file. If this is the last message in your log, increase memory_limit in php.ini [WMPOLL01]\n",TRUE); 187 | weathermap_memory_check("MEM pre-render $mapcount"); 188 | 189 | $wmap->DrawMap($imagefile,$thumbimagefile,read_config_option("weathermap_thumbsize")); 190 | 191 | if($quietlogging==0) wm_warn("Wrote map to $imagefile and $thumbimagefile\n",TRUE); 192 | $fd = @fopen($htmlfile, 'w'); 193 | if($fd != FALSE) 194 | { 195 | fwrite($fd, $wmap->MakeHTML('weathermap_'.$map['filehash'].'_imap')); 196 | fclose($fd); 197 | wm_debug("Wrote HTML to $htmlfile"); 198 | } 199 | else 200 | { 201 | if(file_exists($htmlfile)) 202 | { 203 | wm_warn("Failed to overwrite $htmlfile - permissions of existing file are wrong? [WMPOLL02]\n"); 204 | } 205 | else 206 | { 207 | wm_warn("Failed to create $htmlfile - permissions of output directory are wrong? [WMPOLL03]\n"); 208 | } 209 | } 210 | 211 | $processed_title = $wmap->ProcessString($wmap->title,$wmap); 212 | 213 | db_execute("update weathermap_maps set titlecache='".mysql_real_escape_string($processed_title)."' where id=".intval($map['id'])); 214 | if(intval($wmap->thumb_width) > 0) 215 | { 216 | db_execute("update weathermap_maps set thumb_width=".intval($wmap->thumb_width).", thumb_height=".intval($wmap->thumb_height)." where id=".intval($map['id'])); 217 | } 218 | 219 | $wmap->CleanUp(); 220 | unset($wmap); 221 | 222 | $map_duration = time() - $map_start; 223 | wm_debug("TIME: $mapfile took $map_duration seconds.\n"); 224 | weathermap_memory_check("MEM after $mapcount"); 225 | $mapcount++; 226 | db_execute("replace into settings values('weathermap_last_finished_file','".mysql_escape_string($weathermap_map)."')"); 227 | } 228 | else 229 | { 230 | wm_warn("Mapfile $mapfile is not readable or doesn't exist [WMPOLL04]\n"); 231 | } 232 | db_execute("update weathermap_maps set warncount=".intval($weathermap_warncount)." where id=".intval($map['id'])); 233 | $total_warnings += $weathermap_warncount; 234 | $weathermap_warncount = 0; 235 | $weathermap_map=""; 236 | } 237 | else 238 | { 239 | wm_debug("Skipping ".$map['id']." (".$map['configfile'].") due to schedule.\n"); 240 | } 241 | } 242 | wm_debug("Iterated all $mapcount maps.\n"); 243 | } 244 | else 245 | { 246 | if($quietlogging==0) wm_warn("No activated maps found. [WMPOLL05]\n"); 247 | } 248 | } 249 | else 250 | { 251 | wm_warn("Output directory ($outdir) isn't writable (tried to create '$testfile'). No maps created. You probably need to make it writable by the poller process (like you did with the RRA directory) [WMPOLL06]\n"); 252 | $total_warnings++; 253 | $warning_notes .= " (Permissions problem prevents any maps running WMPOLL06)"; 254 | } 255 | } 256 | else 257 | { 258 | wm_warn("Output directory ($outdir) doesn't exist!. No maps created. You probably need to create that directory, and make it writable by the poller process (like you did with the RRA directory) [WMPOLL07]\n"); 259 | $total_warnings++; 260 | $warning_notes .= " (Output directory problem prevents any maps running WMPOLL07)"; 261 | } 262 | weathermap_memory_check("MEM Final"); 263 | chdir($orig_cwd); 264 | $duration = time() - $start_time; 265 | 266 | $stats_string = date(DATE_RFC822) . ": $mapcount maps were run in $duration seconds with $total_warnings warnings." . $warning_notes; 267 | if($quietlogging==0) wm_warn("STATS: Weathermap $WEATHERMAP_VERSION run complete - $stats_string\n", TRUE); 268 | db_execute("replace into settings values('weathermap_last_stats','".mysql_escape_string($stats_string)."')"); 269 | db_execute("replace into settings values('weathermap_last_finish_time','".mysql_escape_string(time())."')"); 270 | } 271 | else 272 | { 273 | wm_warn("Required modules for PHP Weathermap $WEATHERMAP_VERSION were not present. Not running. [WMPOLL08]\n"); 274 | } 275 | } 276 | 277 | // vim:ts=4:sw=4: 278 | ?> 279 | -------------------------------------------------------------------------------- /lib/post/WeatherMapPostProcessorExample.php: -------------------------------------------------------------------------------- 1 | get_hint("post_test_enable"); 13 | 14 | if ($enable) { 15 | wm_debug(__CLASS__ . " is here\n"); 16 | 17 | // do your work in here... 18 | 19 | $orig = $map->get_note("test"); 20 | $map->add_note("test", $orig . " TESTYTEST"); 21 | // ------------------------- 22 | } else { 23 | wm_debug(__CLASS__ . " Not Enabled\n"); 24 | } 25 | } 26 | } 27 | 28 | // vim:ts=4:sw=4: 29 | ?> -------------------------------------------------------------------------------- /lib/pre/WeatherMapPreProcessorExample.php: -------------------------------------------------------------------------------- 1 | add_note('test','TEST!'); 10 | wm_debug("Example Preprocessor in the hizouse\n"); 11 | } 12 | 13 | } 14 | 15 | // vim:ts=4:sw=4: 16 | ?> 17 | -------------------------------------------------------------------------------- /map-poller.php: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | . 19 | 20 | **/ 21 | 22 | // Set variables for map-poller.php 23 | $weathermap_url = '/weathermap/'; 24 | 25 | // Change to directory that map-poller was run from. 26 | // Thank you to Supun Rathnayake (https://twitter.com/supunr) for the bug report 27 | // and fix for includes being set incorrectly and changing map-poller to chdir from 28 | // where it's run. 29 | 30 | chdir(dirname($argv[0])); 31 | 32 | if (php_sapi_name() == 'cli') { 33 | 34 | $options = getopt("d"); 35 | 36 | if (isset($options['d'])) 37 | { 38 | echo("DEBUG!\n"); 39 | $debug = TRUE; 40 | ini_set('display_errors', 1); 41 | ini_set('display_startup_errors', 1); 42 | ini_set('log_errors', 1); 43 | ini_set('error_reporting', E_ALL ^ E_NOTICE); 44 | } else { 45 | $debug = FALSE; 46 | # ini_set('display_errors', 0); 47 | ini_set('display_startup_errors', 0); 48 | ini_set('log_errors', 0); 49 | # ini_set('error_reporting', 0); 50 | } 51 | 52 | 53 | if (is_file("../../includes/sql-config.inc.php")) { 54 | // For new versions 55 | include("../../includes/sql-config.inc.php"); 56 | } else { 57 | include("../../includes/defaults.inc.php"); 58 | include("../../config.php"); 59 | include("../../includes/functions.inc.php"); 60 | include("../../includes/definitions.inc.php"); 61 | } 62 | include("../../includes/polling/functions.inc.php"); 63 | 64 | $cli = TRUE; 65 | 66 | $conf_dir = 'configs/'; 67 | 68 | if ($debug) { echo "Conf dir: $conf_dir\n"; } 69 | if(is_dir($conf_dir)) { 70 | if($dh = opendir($conf_dir)) { 71 | if ($debug) { echo "Opened directory $conf_dir\n"; } 72 | while (($file = readdir($dh)) !== false) { 73 | if( "." != $file && ".." != $file && ".htaccess" != $file && "index.php" != $file){ 74 | if ($debug) { echo "File to be run is $file\n"; } 75 | if ($config['rrdcached']) { 76 | $cmd = "php ./weathermap --config $conf_dir/$file --base-href $weathermap_url --daemon ".$config['rrdcached']; 77 | if ($debug) { echo "Running with rrdcached $cmd\n"; } 78 | } else { 79 | $cmd = "php ./weathermap --config $conf_dir/$file --base-href $weathermap_url"; 80 | if ($debug) { echo "Running $cmd\n"; } 81 | } 82 | $fp = popen($cmd, 'r'); 83 | $read = fread($fp, 1024); 84 | echo $read; 85 | pclose($fp); 86 | } 87 | } 88 | } 89 | } 90 | } else { 91 | exit; 92 | } 93 | ?> 94 | -------------------------------------------------------------------------------- /navbar-custom-old.inc.php: -------------------------------------------------------------------------------- 1 | 8 | 9 |
  • 10 | 34 | -------------------------------------------------------------------------------- /navbar-custom.inc.php: -------------------------------------------------------------------------------- 1 | TRUE); 19 | 20 | foreach ($rendered_maps as $map_page => $map_name) 21 | { 22 | $weathermap_menu[] = array('title' => $map_name, 'url' => 'weathermap/maps/' . $map_page, 'icon' => 'sprite-map'); 23 | } 24 | 25 | $navbar['observium']['entries'][] = array('title' => 'Weathermaps', 'url' => generate_url(array('page' => 'weathermap')), 'icon' => 'sprite-map', 'entries' => $weathermap_menu); 26 | 27 | if ($_SESSION['userlevel'] >= '10') 28 | { 29 | $navbar['observium']['entries'][] = array('title' => 'Weathermap Editor', 'url' => 'weathermap/editor.php', 'icon' => 'sprite-map-2'); 30 | } 31 | 32 | ?> 33 | -------------------------------------------------------------------------------- /weathermap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/php 2 | readPHPArgv(); 60 | 61 | $ret=$cg->getopt($args, $short_opts, $long_opts); 62 | 63 | if (PEAR::isError($ret)) { die ("Error in command line: " . $ret->getMessage() . "\n (try --help)\n"); } 64 | 65 | $gopts=$ret[0]; 66 | 67 | $options_output = array(); 68 | 69 | if (sizeof($gopts) > 0) 70 | { 71 | foreach ($gopts as $o) 72 | { 73 | switch ($o[0]) 74 | { 75 | case '--config': 76 | $configfile=$o[1]; 77 | break; 78 | 79 | case '--htmloutput': 80 | $htmlfile=$o[1]; 81 | break; 82 | 83 | case '--dumpafter': 84 | $dumpafter=1; 85 | break; 86 | 87 | case '--image-uri': 88 | // $map->imageuri=$o[1]; 89 | $options_output['imageuri'] = $o[1]; 90 | break; 91 | 92 | case '--base-href': 93 | // $map->basehref=$o[1]; 94 | $options_output['basehref'] = $o[1]; 95 | break; 96 | case '--dumpconfig': 97 | //$map->dumpconfig=$o[1]; 98 | // $options_output['dumpconfig'] = $o[1]; 99 | $dumpconfig=$o[1]; 100 | break; 101 | 102 | case '--randomdata': 103 | $randomdata=1; 104 | break; 105 | 106 | case '--stats': 107 | $dumpstats=1; 108 | break; 109 | 110 | case '--uberdebug': 111 | // allow ALL trace messages (normally we block some of the chatty ones) 112 | $weathermap_debug_suppress=array(); 113 | // FALL THROUGH 114 | case '--debug': 115 | $options_output['debugging'] = TRUE; 116 | $weathermap_debugging=TRUE; 117 | 118 | // enable assertion handling 119 | assert_options(ASSERT_ACTIVE, 1); 120 | assert_options(ASSERT_WARNING, 0); 121 | assert_options(ASSERT_QUIET_EVAL, 1); 122 | 123 | // Set up the callback 124 | assert_options(ASSERT_CALLBACK, 'my_assert_handler'); 125 | 126 | break; 127 | 128 | case '--sizedebug': 129 | case '--no-data': 130 | //$map->sizedebug=TRUE; 131 | $options_output['sizedebug'] = TRUE; 132 | break; 133 | 134 | case '--bulge': 135 | //$map->widthmod=TRUE; 136 | $options_output['widthmod'] = TRUE; 137 | break; 138 | 139 | case '--output': 140 | $imagefile=$o[1]; 141 | break; 142 | 143 | case '--daemon': 144 | $daemon=1; 145 | $daemon_args=$o[1]; 146 | #$rrdtool = $rrdtool . " --daemon ".$o[1]; 147 | break; 148 | 149 | 150 | case '--define': 151 | preg_match("/^([^=]+)=(.*)\s*$/",$o[1],$matches); 152 | if(isset($matches[2])) 153 | { 154 | $varname = $matches[1]; 155 | $value = $matches[2]; 156 | wm_debug(">> $varname = '$value'\n"); 157 | // save this for later, so that when the map object exists, it can be defined 158 | $defines[$varname]=$value; 159 | } 160 | else 161 | { 162 | print "WARNING: --define format is: --define name=value\n"; 163 | } 164 | break; 165 | 166 | case '--version': 167 | print 'PHP Network Weathermap v' . $WEATHERMAP_VERSION."\n"; 168 | exit(); 169 | break; 170 | 171 | case '--help': 172 | print 'PHP Network Weathermap v' . $WEATHERMAP_VERSION."\n"; 173 | print "Copyright Howard Jones, 2005-2007 howie@thingy.com\nReleased under the GNU Public License\nhttp://www.network-weathermap.com/\n\n"; 174 | 175 | print "Usage: php weathermap [options]\n\n"; 176 | 177 | print " --config {filename} - filename to read from. Default weathermap.conf\n"; 178 | print " --output {filename} - filename to write image. Default weathermap.png\n"; 179 | print " --htmloutput {filename} - filename to write HTML. Default weathermap.html\n\n"; 180 | 181 | print " --base-href {uri} - URI for Weathermap, i.e /weathermap/\n"; 182 | print " --image-uri {uri} - URI to prefix tags in HTML.\n"; 183 | print " --bulge - Enable link-bulging mode. See manual.\n\n"; 184 | 185 | print " --define name=value - Define internal variables\n"; 186 | print " (equivalent to global SET in config file)\n\n"; 187 | 188 | print " --no-data - skip the data-reading process (just a 'grey' map)\n"; 189 | print " --randomdata - as above, but use random data\n"; 190 | print " --debug - produce (LOTS) of debugging information during run\n"; 191 | print " --dump-after - dump all internal PHP structures (HUGE)\n"; 192 | print " --dumpconfig {filename} - filename to write a new config to (for testing)\n\n"; 193 | 194 | print " --help - show this help\n"; 195 | print " --version - show version number\n\n"; 196 | print " --daemon {path} - path to rrdcached sock\n\n"; 197 | print "More info at http://www.network-weathermap.com/\n"; 198 | exit(); 199 | break; 200 | } 201 | } 202 | } 203 | 204 | // set this BEFORE we create the map object, so we get the debug output from Reset(), as well 205 | if(isset($options_output['debugging']) && $options_output['debugging']) 206 | { 207 | $weathermap_debugging=TRUE; 208 | wm_debug("------------------------------------\n"); 209 | wm_debug("Starting PHP-Weathermap run, with config: $configfile\n"); 210 | wm_debug("------------------------------------\n"); 211 | } 212 | 213 | $map=new Weathermap; 214 | $map->rrdtool = $rrdtool; 215 | $map->context="cli"; 216 | $map->daemon=$daemon; 217 | $map->daemon_args=$daemon_args; 218 | 219 | // now stuff in all the others, that we got from getopts 220 | foreach ($options_output as $key=>$value) 221 | { 222 | $map->$key = $value; 223 | // $map->add_hint($key,$value); 224 | } 225 | 226 | $weathermap_map = $configfile; 227 | 228 | if ($map->ReadConfig($configfile)) 229 | { 230 | // allow command-lines to override the config file, but provide a default if neither are present 231 | if ($imagefile == '') 232 | { 233 | if ($map->imageoutputfile == '') { $imagefile="weathermap.png"; } 234 | else { $imagefile=$map->imageoutputfile; } 235 | } 236 | 237 | if ($htmlfile == '') 238 | { 239 | if ($map->htmloutputfile != '') { $htmlfile = $map->htmloutputfile; } 240 | } 241 | 242 | // feed in any command-line defaults, so that they appear as if SET lines in the config 243 | 244 | // XXX FIXME 245 | foreach ($defines as $hintname=>$hint) 246 | { 247 | $map->add_hint($hintname,$hint); 248 | } 249 | 250 | // now stuff in all the others, that we got from getopts 251 | foreach ($options_output as $key=>$value) 252 | { 253 | // $map->$key = $value; 254 | $map->add_hint($key,$value); 255 | } 256 | 257 | if ( (isset($options_output['sizedebug']) && ! $options_output['sizedebug']) || (!isset($options_output['sizedebug'])) ) 258 | { 259 | if ($randomdata == 1) { $map->RandomData(); } 260 | else { $map->ReadData(); } 261 | } 262 | 263 | # exit(); 264 | 265 | if ($imagefile != '') 266 | { 267 | $map->DrawMap($imagefile); 268 | $map->imagefile=$imagefile; 269 | } 270 | 271 | if ($htmlfile != '') 272 | { 273 | wm_debug("Writing HTML to $htmlfile\n"); 274 | 275 | $fd=fopen($htmlfile, 'w'); 276 | fwrite($fd, 277 | ''); 278 | fwrite($fd,"basehref\">"); 279 | if($map->htmlstylesheet != '') fwrite($fd,''); 280 | fwrite($fd,'' . $map->ProcessString($map->title, $map) . ''); 281 | 282 | if ($map->htmlstyle == "overlib") 283 | { 284 | fwrite($fd, 285 | "
    \n"); 286 | fwrite($fd, 287 | " \n"); 288 | } 289 | 290 | fwrite($fd, $map->MakeHTML()); 291 | fwrite($fd, 292 | '
    Network Map created with PHP Network Weathermap v' . $WEATHERMAP_VERSION 294 | . ''); 295 | fclose ($fd); 296 | } 297 | 298 | if ($dumpconfig != '') 299 | $map->WriteConfig($dumpconfig); 300 | 301 | if ($dumpstats != '') 302 | $map->DumpStats(); 303 | 304 | if ($dumpafter == 1) 305 | print_r ($map); 306 | 307 | # print_r ($map->node_template_tree); 308 | # print_r ($map->link_template_tree); 309 | 310 | # $map->cachefolder="editcache"; 311 | # $map->CacheUpdate(1); 312 | 313 | 314 | } 315 | else { die ("\n\nCould not read Weathermap config file. No output produced. Maybe try --help?\n"); } 316 | 317 | 318 | 319 | function my_assert_handler($file, $line, $code) 320 | { 321 | echo "Assertion Failed: 322 | File $file 323 | Line $line 324 | Code $code"; 325 | debug_print_backtrace(); 326 | exit(); 327 | } 328 | 329 | // vim:ts=4:sw=4: 330 | ?> 331 | --------------------------------------------------------------------------------