├── CHANGELOG.md ├── COPYING ├── INFO ├── LICENSE ├── README.md ├── check.php ├── cli ├── .htaccess ├── README ├── auto-overlib.pl ├── bristle.php ├── cacti-integrate.php ├── cacti-mapper.php ├── convert-to-dsstats.php ├── index.php ├── map-tidyup.php └── upgrade_configs.php ├── configs ├── .htaccess ├── index.php └── simple.conf ├── css ├── editor.css └── weathermap.css ├── 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 │ ├── suite-1.conf │ ├── suite-1.png │ ├── suite-2.conf │ ├── suite-2.png │ └── weathermap.conf ├── 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 ├── index.php ├── 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 │ └── weathermap.css ├── images ├── backgrounds │ ├── Gradient_BK_800.png │ ├── background1_950x625_197.jpg │ ├── blueboard1024.png │ ├── bw_gradient_1024.png │ ├── index.php │ ├── uk1024.png │ └── uk1280_720.png ├── icons │ ├── application.png │ ├── application_side_list.png │ ├── application_xp_terminal.png │ ├── bug.png │ ├── comment.png │ ├── control_fastforward_blue.png │ ├── control_pause_blue.png │ ├── control_play_blue.png │ ├── control_rewind_blue.png │ ├── control_stop_blue.png │ ├── cross.png │ ├── emoticon_smile.png │ ├── emoticon_unhappy.png │ ├── error.png │ ├── exclamation.png │ ├── flag_blue.png │ ├── flag_green.png │ ├── flag_orange.png │ ├── flag_pink.png │ ├── flag_purple.png │ ├── flag_yellow.png │ ├── index.php │ ├── monitor.png │ ├── page_white.png │ ├── pencil.png │ ├── tick.png │ ├── world.png │ ├── world_link.png │ ├── wrench.png │ └── wrench_orange.png ├── index.php ├── objects │ ├── Cloud-Filled.png │ ├── Cloud-line.png │ ├── Firewall.png │ ├── HPMini.png │ ├── Host.png │ ├── PAD.png │ ├── Router.png │ ├── WorkgroupSwitch.png │ ├── arista-switch.png │ ├── blue-ball-64.png │ ├── cisco-asa.png │ ├── cisco-nexus.png │ ├── cisco-router-firewall.png │ ├── cisco-router.png │ ├── cisco-switch-l2.png │ ├── cisco-switch-l3-with-rp.png │ ├── cisco-switch-l3.png │ ├── cisco-switch-vss.png │ ├── cloud-v1.png │ ├── cloud-v2.png │ ├── cumulus-router-v2.png │ ├── cumulus-router-v3.png │ ├── cumulus-switch-v2.png │ ├── f5-gtm.png │ ├── f5-ltm.png │ ├── filecabinet.png │ ├── generic-adc-colour-3d.png │ ├── generic-adc-colour.png │ ├── generic-adc-mono.png │ ├── generic-firewall-flat-colour-label-v1-colour.png │ ├── generic-firewall-flat-colour-label-v1-mono.png │ ├── generic-firewall-flat-colour-label-v2-colour.png │ ├── generic-firewall-flat-colour-label-v2-mono.png │ ├── generic-firewall-v1-colour-3d.png │ ├── generic-firewall-v1-colour.png │ ├── generic-firewall-v1-mono.png │ ├── generic-firewall-v2-colour-3d.png │ ├── generic-firewall-v2-colour.png │ ├── generic-gtm-colour-3d.png │ ├── generic-gtm-colour.png │ ├── generic-gtm-mono.png │ ├── generic-router-colour.png │ ├── generic-router-flat-label-colour.png │ ├── generic-router-flat-label-mono.png │ ├── generic-router-mono.png │ ├── generic-router-square-colour-3d.png │ ├── generic-router-square-colour.png │ ├── generic-router-square-mono.png │ ├── generic-server-1.png │ ├── generic-server-2.png │ ├── generic-server-3.png │ ├── generic-switch-flat-l2-label-v1-colour.png │ ├── generic-switch-flat-l2-label-v1-mono.png │ ├── generic-switch-flat-l2-label-v2-colour.png │ ├── generic-switch-flat-l2-label-v2-mono.png │ ├── generic-switch-flat-l3-label-colour.png │ ├── generic-switch-flat-l3-label-mono.png │ ├── generic-switch-l2-v1-colour-3d.png │ ├── generic-switch-l2-v1-colour.png │ ├── generic-switch-l2-v1-mono.png │ ├── generic-switch-l2-v2-colour-3d.png │ ├── generic-switch-l2-v2-colour.png │ ├── generic-switch-l2-v2-mono.png │ ├── generic-switch-l3-colour-3d.png │ ├── generic-switch-l3-colour.png │ ├── generic-switch-l3-mono.png │ ├── green-ball-64.png │ ├── grey-ball-64.png │ ├── hollow32.png │ ├── index.php │ ├── juniper-firewall-router.png │ ├── juniper-router.png │ ├── juniper-switch-l2.png │ ├── juniper-switch-l3.png │ ├── red-ball-64.png │ ├── updown_0.png │ ├── updown_1.png │ ├── updown_2.png │ ├── viptela-vbond.png │ ├── viptela-vedge-square.png │ ├── viptela-vedge.png │ ├── viptela-vmanage.png │ ├── viptela-vsmart.png │ ├── vmware-compute.png │ └── yellow-ball-64.png ├── s_tab_weathermap.gif ├── s_tab_weathermap_red.gif ├── tab_weathermap.gif └── tab_weathermap_red.gif ├── index.php ├── js ├── editor.js ├── idle-timer.min.js ├── jquery.ddslick.js ├── jquery.ui-contextmenu.js ├── map-cycle.js └── weathermap.js ├── lib ├── .htaccess ├── HTML_ImageMap.class.php ├── WMLine.class.php ├── WMPoint.class.php ├── WMVector.class.php ├── WeatherMap.class.php ├── WeatherMap.functions.php ├── WeatherMap.keywords.inc.php ├── WeatherMapLink.class.php ├── WeatherMapNode.class.php ├── datasources │ ├── README.txt │ ├── WeatherMapDataSource_cactihost.php │ ├── WeatherMapDataSource_cactithold.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 │ └── index.php ├── ds-common.php ├── editor.actions.php ├── editor.inc.php ├── geometry.php ├── index.php ├── poller-common.php ├── post │ ├── WeatherMapPostProcessorExample.php │ └── index.php └── pre │ ├── WeatherMapPreProcessorExample.php │ └── index.php ├── locales ├── LC_MESSAGES │ ├── ar-SA.mo │ ├── bg-BG.mo │ ├── de-DE.mo │ ├── el-GR.mo │ ├── es-ES.mo │ ├── fr-FR.mo │ ├── he-IL.mo │ ├── hi-IN.mo │ ├── index.php │ ├── it-IT.mo │ ├── ja-JP.mo │ ├── ko-KR.mo │ ├── lv-LV.mo │ ├── nl-NL.mo │ ├── pl-PL.mo │ ├── pt-BR.mo │ ├── pt-PT.mo │ ├── ru-RU.mo │ ├── sv-SE.mo │ ├── tr-TR.mo │ ├── vi-VN.mo │ ├── zh-CN.mo │ └── zh-TW.mo ├── build_gettext.sh ├── index.php └── po │ ├── ar-SA.po │ ├── bg-BG.po │ ├── cacti.pot │ ├── de-DE.po │ ├── el-GR.po │ ├── es-ES.po │ ├── fr-FR.po │ ├── he-IL.po │ ├── hi-IN.po │ ├── index.php │ ├── it-IT.po │ ├── ja-JP.po │ ├── ko-KR.po │ ├── lv-LV.po │ ├── nl-NL.po │ ├── pl-PL.po │ ├── pt-BR.po │ ├── pt-PT.po │ ├── ru-RU.po │ ├── sv-SE.po │ ├── tr-TR.po │ ├── vi-VN.po │ ├── zh-CN.po │ └── zh-TW.po ├── output ├── .htaccess └── index.php ├── setup.php ├── weathermap ├── weathermap-cacti-plugin-editor.php ├── weathermap-cacti-plugin-mgmt.php ├── weathermap-cacti-plugin.php └── weathermap-cacti-rebuild.php /INFO: -------------------------------------------------------------------------------- 1 | [info] 2 | name = weathermap 3 | version = 1.3.1 4 | longname = Weathermap Plugin 5 | author = The Cacti Group, Howard Jones 6 | email = developers@cacti.net 7 | homepage = https://cacti.net 8 | compat = 1.2.24 9 | nosync = true 10 | capabilities = online_view:1, online_mgmt:1, offline_view:0, offline_mgmt:0, remote_collect:0 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 thurban 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP Network Weathermap 1.0 2 | 3 | This is PHP Network Weathermap fork, version 1.0. The PHP Weathermap was 4 | originally by Howard Jones (howie@thingy.com). As Howie has scaled back his 5 | Cacti plugin development work, we will release this version that incorporates 6 | his core framework from the 0.98 version. In future releases, we will look 7 | to incorporate subequent releases of the WeatherMap core. 8 | 9 | See the docs sub-directory for full HTML documentation, FAQ and example config. 10 | 11 | See CHANGELOG.md for the most recent updates, listed by version. 12 | 13 | See COPYING for the license under which php-weathermap is released. 14 | 15 | ## Compatibility 16 | 17 | This version only works with Cacti 1.2.x onwards. A re-write of the user interface 18 | is being made to make it more compatible with 1.2.x and 1.3.x releases. 19 | 20 | ## Contribute 21 | 22 | Check out the main [Cacti](http://www.cacti.net) web site for downloads, change 23 | logs, release notes and more! 24 | 25 | ## Community forums 26 | 27 | Given the large scope of Cacti, the forums tend to generate a respectable amount 28 | of traffic. Doing your part in answering basic questions goes a long way since 29 | we cannot be everywhere at once. Contribute to the Cacti community by 30 | participating on the [Cacti Community Forums](http://forums.cacti.net). 31 | 32 | For Network Weathermap's core support, there is much more information along with 33 | tutorials and updates available at Howard Jone's site: 34 | 35 | http://www.network-weathermap.com/ 36 | 37 | ## Important Notes 38 | 39 | This version of Weathermap only works with Cacti 1.2.x and above only. 40 | beta, yet non-production use at this time. 41 | 42 | The location of backgrounds and object images has changed! The upgrade script 43 | will attempt to move these backgrounds and images to the new locations, 44 | but you may have some cleanup to do especially if you customized the locations. 45 | 46 | WARNING: Before upgrading make ensure the poller account can move config file 47 | images into into the plugins various images directories. Fail to do so 48 | may result in corrupted config files. 49 | 50 | NOTE: The directories: `cacti-resources` and `editor-resources` have been removed 51 | in favor of the standard `js` and `css` folders. You should remove these 52 | folders after installation. 53 | 54 | WARNING: Since previously the WeatherMap Editor had essentially no security, 55 | this version will be 100% dependent on the Cacti Security model to authorize users. 56 | 57 | NOTE: The Overlib library dependency has been removed in this release. 58 | 59 | When reviewing the plugin in detail, there were so many possible enhancements 60 | that could be incorporated into the tool, but for now, it's really just to 61 | bring the Weathermap plugin fully into the Cacti 1.x and beyond. 62 | 63 | ## GitHub Documentation 64 | 65 | Get involved in creating and editing Cacti Documentation! Fork, change and 66 | submit a pull request to help improve the documentation on 67 | [GitHub](https://github.com/cacti/documentation). 68 | 69 | ## GitHub Development 70 | 71 | Get involved in development of Cacti! Join the developers and community on 72 | [GitHub](https://github.com/cacti)! 73 | 74 | ## Original Weathermap Plugin 75 | 76 | Howard Jones original work can still be found on GitHub at the following location. 77 | 78 | https://github.com/howardjones/network-weathermap 79 | 80 | Howie has done extensive rework of his Weathermap API that we will look to incorporate 81 | in future releases of the Cacti version of the plugin. 82 | 83 | ## Included 3rd Party Component Software 84 | 85 | * ddSlick - A forked and jQueryUI compatible version of the jquery images dropdown 86 | plugin. 87 | 88 | See: https://jquery-plugins.net/ddslick-dropdown-with-images 89 | 90 | * Network-Icons-SVG - A collection of network icons in SVG format converted 91 | to work with Weathermaps PNG format. 92 | 93 | See: https://github.com/aci686/Network-Icons-SVG 94 | 95 | * The Bitstream Vera Open Source fonts (Vera\*.ttf) are copyright Bitstream, Inc. 96 | 97 | See: http://www.bitstream.com/font_rendering/products/dev_fonts/vera.html 98 | 99 | * The manual uses the Kube CSS Framework and ParaType's PT Sans font. 100 | 101 | See: http://imperavi.com/kube/ 102 | See: http://www.fontsquirrel.com/fonts/PT-Sans 103 | 104 | * Some of the icons used in the editor, and also supplied in the images/ folder are 105 | from the excellent Fam Fam Fam Silk Icon collection by Mark James released under 106 | a Creative Commons license. 107 | 108 | See: http://www.famfamfam.com/lab/icons/silk/. 109 | See: http://creativecommons.org/licenses/by/2.5/ 110 | 111 | ----------------------------------------------------------------------------- 112 | Copyright (c) 2004-2024 - The Cacti Group, Inc. 113 | -------------------------------------------------------------------------------- /cli/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Order deny,allow 3 | Deny from all 4 | 5 | -------------------------------------------------------------------------------- /cli/README: -------------------------------------------------------------------------------- 1 | suite-1.conf 2 | suite-2.conf 3 | ============ 4 | These are my test map config files that exercise a fair bit of the 5 | functionality of Weathermap, in a couple of files. The first one 6 | is mostly NODE stuff, and the second is mostly LINK stuff. As such, 7 | they make quite useful demo maps, I guess. suite-1.png and suite-2.png 8 | show what these maps *should* look like. They use quite a few fonts 9 | that I can't supply, but mostly they use Bitstream Vera, which is in 10 | the docs/example directory. 11 | 12 | map-split.php 13 | ============= 14 | 15 | Reads in a map, then writes out 'submaps' of a certain size. Edit the 16 | top of the script to specify the source map, and the required size of 17 | the new maps, and it will chop up your map for you. It doesn't do 18 | anything clever with things like KEYPOS or TITLEPOS, but it will do 19 | NODEs OK. It'll delete any links where only one end is in the final 20 | map, so cross-sheet links will need to be put back in. It also removes 21 | the BACKGROUND image if there is one, since it will (by definition) be 22 | the wrong size for the new maps. 23 | 24 | auto-overlib.pl 25 | =============== 26 | 27 | A small but useful script that takes a weathermap config file with 28 | references to Cacti RRD targets and automatically adds in all the 29 | INFOURL and OVERLIBGRAPH lines it can, where they don't exist. 30 | 31 | You'll need to edit the script to allow it to log in to your Cacti 32 | database. Requires the Perl DBI and DBD::mysql modules. 33 | 34 | Should work with both PHP and perl versions, but not tested with PHP 35 | one. 36 | 37 | cacti-integrate.php 38 | =================== 39 | 40 | A script that reads in a weathermap config file, looks for special SET 41 | variables and uses them to populate as much as it can of TARGET, INFOURL, 42 | OVERLIBGRAPH, and BANDWIDTH. Requires a correct editor-config.php to access 43 | the Cacti database. 44 | 45 | You need SET one of 'cacti_id', 'hostname' or 'address' in each NODE so that 46 | it can find the Cacti Host ID for each node. 47 | 48 | You need to SET one of 'in_interface' or 'out_interface' to the interface name 49 | so that it can figure out which data sources are relevant. The interface name should 50 | match one of ifAlias, ifName or ifDescr from your router. 51 | 52 | More info here: http://forums.cacti.net/about26544.html 53 | 54 | cacti-mapper.php 55 | ================ 56 | 57 | A script that reads interface IPs from Cacti, and then uses Cacti's SNMP data 58 | to fetch a netmask for each interface. It then uses all this info to work out 59 | which interfaces are in the same address range as each other, and produces a 60 | map. The map positions are random, but the connections should be right. You need 61 | to run the results through cacti-integrate.php, to fill in the TARGET lines. 62 | Requires a correct editor-config.php to access the Cacti database. 63 | 64 | bristle.php 65 | ============ 66 | 67 | Generates a section of Weathermap config useful for showing traffic for all switch 68 | ports in a small space. Intended to work with cacti-integrate.php 69 | 70 | More info here: http://forums.cacti.net/post-152500.html#152500 -------------------------------------------------------------------------------- /cli/auto-overlib.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | 3 | use DBI; 4 | 5 | # This should be the URL for the base of your cacti install (no trailing slash) 6 | $cacti_base = "http://www.mynet.net/cacti"; 7 | 8 | # How we should access your Cacti database.... 9 | $db_name = "cacti"; 10 | $db_username = "cactiuser"; 11 | $db_password = "somepassword"; 12 | $db_host = "localhost"; 13 | 14 | # 15 | # You shouldn't need to change anything below here 16 | # 17 | 18 | $cacti_graph = "$cacti_base/graph_image.php?local_graph_id=%d&rra_id=0&graph_nolegend=true&graph_height=100&graph_width=300"; 19 | $cacti_graphpage = "$cacti_base/graph.php?rra_id=all&local_graph_id=%d"; 20 | 21 | $DSN = "DBI:mysql:database=$db_name:host=$db_host"; 22 | 23 | $dbh = DBI->connect( $DSN, $db_username, $db_password ); 24 | 25 | $inputfile = $ARGV[0]; 26 | $outputfile = $inputfile . ".new"; 27 | 28 | open( INPUT, $inputfile ) || die($!); 29 | open( OUTPUT, ">$outputfile" ); 30 | 31 | while () { 32 | if (m/^\s*LINK\s+(\S+)/i) { 33 | if ( $overlibcount == 0 && $target ne "" ) { 34 | find_graph_urls($target); 35 | } 36 | 37 | $overlibcount = 0; 38 | $target = ""; 39 | } 40 | if (m/^\s*TARGET\s+(\S+\.rrd)/i) { 41 | $target = $1; 42 | } 43 | if (m/^\s*OVERLIBGRAPH\s+(\S+)/i) { 44 | $overlibcount++; 45 | } 46 | 47 | print OUTPUT $_; 48 | } 49 | 50 | # for the last LINK 51 | if ( $overlibcount == 0 && $target ne "" ) { 52 | find_graph_urls($target); 53 | } 54 | 55 | close(OUTPUT); 56 | close(INPUT); 57 | 58 | print "\nNew config file is saved in $outputfile\n"; 59 | 60 | sub find_graph_urls { 61 | my ($target) = shift; 62 | 63 | # $dbh is global 64 | my ( @bits, $SQL, $sth, $data ); 65 | my ( $data_template_id, $local_data_id, $count, $output ); 66 | my ( $local_graph_id, $title, $graph_url, $graphpage_url ); 67 | 68 | # we've reached the next link entry, and there's work to be done 69 | @bits = split( /\//, $target ); 70 | $target = $bits[-1]; 71 | print "Find a graph for $target\n"; 72 | 73 | $SQL = "select local_data_id from data_template_data where data_source_path like '%".$target."' LIMIT 1"; 74 | $sth = $dbh->prepare($SQL); 75 | $sth->execute(); 76 | $data = $sth->fetchrow_hashref(); 77 | $local_data_id = $$data{local_data_id}; 78 | $sth->finish(); 79 | 80 | $SQL = 81 | "SELECT id FROM data_template_rrd WHERE local_data_id=$local_data_id LIMIT 1"; 82 | $sth = $dbh->prepare($SQL); 83 | $sth->execute(); 84 | $data = $sth->fetchrow_hashref(); 85 | $data_template_rrd_id = $$data{id}; 86 | $sth->finish(); 87 | 88 | $SQL = 89 | "SELECT DISTINCT graph_templates_item.local_graph_id,title_cache FROM graph_templates_item,graph_templates_graph WHERE task_item_id=$data_template_rrd_id and graph_templates_graph.local_graph_id = graph_templates_item.local_graph_id"; 90 | $sth = $dbh->prepare($SQL); 91 | $sth->execute(); 92 | $count = 0; 93 | $output = ""; 94 | while ( $data = $sth->fetchrow_hashref() ) { 95 | $local_graph_id = $$data{local_graph_id}; 96 | $title = $$data{title_cache}; 97 | $graph_url = sprintf( $cacti_graph, $local_graph_id ); 98 | $graphpage_url = sprintf( $cacti_graphpage, $local_graph_id ); 99 | $output .= "\t# POSSIBLE OVERLIBGRAPH ($title) \n"; 100 | $output .= "\t# OVERLIBGRAPH $graph_url\n"; 101 | $output .= "\t# INFOURL $graphpage_url\n"; 102 | $count++; 103 | } 104 | $sth->finish(); 105 | if ( $count == 1 ) { 106 | print " Single option. Adding it.\n"; 107 | print OUTPUT 108 | "\t#Automatically made. Graph is ID $local_graph_id: $title\n"; 109 | print OUTPUT "\tOVERLIBGRAPH $graph_url\n"; 110 | print OUTPUT "\tINFOURL $graphpage_url\n"; 111 | } 112 | else { 113 | print " Multiple options. Adding them as comments.\n"; 114 | print OUTPUT $output; 115 | } 116 | 117 | print OUTPUT "\n\n"; 118 | 119 | } 120 | -------------------------------------------------------------------------------- /cli/bristle.php: -------------------------------------------------------------------------------- 1 | $halfway) { 72 | $offset = ($n - 24 - 1 - $quarter)*8; 73 | } else { 74 | // The first 24 ports grow up instead of down 75 | $offset = ($n - 1 - $quarter)*8; 76 | $voffset = -$voffset; 77 | $voffset2 = -$voffset2; 78 | } 79 | 80 | $target = 'tgt?'; 81 | $infourl = 'info?'; 82 | $overliburl = 'over?'; 83 | 84 | printf("NODE %s\n\tPOSITION %s %d %d\n\tSET cacti_id %d\n\n", $nodename,$switchname,$offset,$voffset, $cacti_host_id); 85 | 86 | printf("LINK %s\n\tNODES %s:%d:%d %s\n\tBWLABEL none\n\tWIDTH 2\n\tARROWSTYLE compact\n\tOUTLINECOLOR none\n", $linkname, $switchname, $offset, $voffset2, $nodename); 87 | 88 | $interfacename = sprintf($interfacepattern,$n); 89 | 90 | print "\tSET out_interface $interfacename"; 91 | 92 | # printf("\tINFOURL %s\n\tOVERLIBGRAPH %s\n\tTARGET %s\n", $infourl, $overliburl, $target ); 93 | print "\n\n"; 94 | } 95 | 96 | print "# Now run this output through cacti-integrate.php to add all the INFOURL and TARGET lines"; 97 | 98 | -------------------------------------------------------------------------------- /cli/index.php: -------------------------------------------------------------------------------- 1 | 0) { 66 | foreach ($options as $arg => $value) { 67 | switch ($arg) { 68 | case 'debug': 69 | $weathermap_debugging = true; 70 | 71 | break; 72 | case 'help': 73 | case 'H': 74 | case 'h': 75 | display_help(); 76 | 77 | exit(); 78 | 79 | break; 80 | case 'version': 81 | case 'V': 82 | case 'v': 83 | display_version(); 84 | 85 | exit(); 86 | 87 | break; 88 | default: 89 | print 'ERROR: Invalid Parameter ' . $arg . PHP_EOL . PHP_EOL; 90 | 91 | display_help(); 92 | 93 | exit(1); 94 | } 95 | } 96 | } 97 | 98 | print 'About to repair maps' . PHP_EOL; 99 | weathermap_repair_maps(); 100 | print 'Done repairing maps' . PHP_EOL; 101 | 102 | function display_help() { 103 | display_version(); 104 | 105 | print 'upgrade_configs.php: [ --debug ] ' . PHP_EOL . PHP_EOL; 106 | print ' --debug - Enable debugging output' . PHP_EOL; 107 | } 108 | 109 | function display_version() { 110 | global $config; 111 | 112 | if (!function_exists('plugin_weathermap_version')) { 113 | include_once($config['base_path'] . '/plugins/weathermap/setup.php'); 114 | } 115 | 116 | $info = plugin_weathermap_version(); 117 | 118 | print 'Weathermap Config Upgrade Utility, The Cacti Group, Inc., Version ' . $info['version'] . ', ' . WM_COPYRIGHT_YEARS . PHP_EOL; 119 | } 120 | 121 | -------------------------------------------------------------------------------- /configs/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Order deny,allow 3 | Deny from all 4 | 5 | -------------------------------------------------------------------------------- /configs/index.php: -------------------------------------------------------------------------------- 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/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/example/my_router.png -------------------------------------------------------------------------------- /docs/example/suite-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/example/suite-1.png -------------------------------------------------------------------------------- /docs/example/suite-2.conf: -------------------------------------------------------------------------------- 1 | # Automatically generated by php-weathermap v0.91 2 | 3 | BACKGROUND images/uk1024.png 4 | 5 | FONTDEFINE 92 VeraIt 7 6 | FONTDEFINE 102 Vera 8 7 | 8 | TITLE Test Suite 2 - Nodes 9 | HTMLOUTPUTFILE suite-2.html 10 | IMAGEOUTPUTFILE suite-2.png 11 | TIMEPOS 5 15 Created: %b %d %Y %H:%M:%S 12 | 13 | KEYPOS DEFAULT -1 -1 Traffic Load 14 | KEYTEXTCOLOR 0 0 0 15 | KEYBGCOLOR 255 255 255 16 | BGCOLOR 192 192 192 17 | TITLECOLOR 0 0 0 18 | TIMECOLOR 255 255 255 19 | SCALE DEFAULT 1 10 140 0 255 20 | SCALE DEFAULT 10 25 32 32 255 21 | SCALE DEFAULT 25 40 0 192 255 22 | SCALE DEFAULT 40 55 0 240 0 23 | SCALE DEFAULT 55 70 240 240 0 24 | SCALE DEFAULT 70 85 255 192 0 25 | SCALE DEFAULT 85 100 255 0 0 26 | 27 | 28 | # End of global section 29 | 30 | # DEFAULT definitions: 31 | NODE DEFAULT 32 | LABEL {node:this:name} 33 | ICON 64 64 images/hollow32.png 34 | LABELOFFSET S 35 | OVERLIBWIDTH 400 36 | OVERLIBHEIGHT 200 37 | LABELBGCOLOR none 38 | LABELFONTCOLOR 255 255 255 39 | LABELOUTLINECOLOR none 40 | LABELFONTSHADOWCOLOR 0 0 0 41 | MAXVALUE 100 42 | SET sigdigits 1 43 | 44 | LINK DEFAULT 45 | OVERLIBWIDTH 400 46 | OVERLIBHEIGHT 200 47 | BWLABEL bits 48 | BWFONT 102 49 | COMMENTFONT 92 50 | WIDTH 5 51 | BANDWIDTH 100M 52 | 53 | 54 | # End of DEFAULTS section 55 | 56 | # Node definitions: 57 | NODE Centre 58 | POSITION 500 400 59 | 60 | NODE NorthEast 61 | POSITION 700 200 62 | 63 | NODE NorthEast_telnet 64 | LABEL 65 | INFOURL telnet://northeast/ 66 | ICON 16 16 images/application_xp_terminal.png 67 | POSITION NorthEast 44 -25 68 | 69 | NODE NorthEast_www 70 | LABEL 71 | INFOURL http://northeast/ 72 | ICON 16 16 images/application_side_list.png 73 | POSITION NorthEast 44 -5 74 | 75 | NODE North 76 | LABEL {node:this:sigdigits} 77 | POSITION 500 200 78 | 79 | NODE South 80 | POSITION 500 600 81 | 82 | NODE West 83 | POSITION 300 400 84 | 85 | NODE East 86 | POSITION 700 400 87 | 88 | NODE SouthEast 89 | POSITION 749 720 90 | 91 | NODE SouthWest 92 | POSITION 300 600 93 | 94 | NODE NorthWest 95 | POSITION 300 200 96 | 97 | NODE node20 98 | POSITION 100 200 99 | MAXVALUE 50 100 | 101 | NODE node30 102 | POSITION 100 400 103 | MAXVALUE 30 60 104 | 105 | NODE node100 106 | LABELOFFSET C 107 | POSITION 900 200 108 | 109 | NODE node101 110 | LABELOFFSET C 111 | POSITION 695 305 112 | 113 | NODE node102 114 | LABELBGCOLOR 32 32 32 115 | LABELOUTLINECOLOR 255 255 255 116 | POSITION 900 600 117 | 118 | 119 | # End of NODE section 120 | 121 | # Link definitions: 122 | LINK Link1 123 | ARROWSTYLE compact 124 | NODES Centre:N North:S 125 | 126 | LINK Link2 127 | ARROWSTYLE compact 128 | NODES Centre:E East:W 129 | 130 | LINK Link3 131 | ARROWSTYLE 2 1 132 | NODES Centre:S South:N 133 | 134 | LINK Link4 135 | ARROWSTYLE 3 2 136 | NODES Centre:W West:E 137 | 138 | LINK Link5 139 | ARROWSTYLE 6 2 140 | NODES Centre:NW NorthWest:SE 141 | 142 | LINK Link6 143 | ARROWSTYLE compact 144 | BWOUTLINECOLOR none 145 | BWBOXCOLOR none 146 | NODES Centre:NE NorthEast:SW 147 | 148 | LINK Link7 149 | NODES Centre:SE SouthEast:NW 150 | 151 | LINK Link8 152 | NODES Centre:SW SouthWest:NE 153 | 154 | LINK Link9 155 | NODES NorthWest:N NorthEast:N 156 | VIA 500 100 157 | 158 | LINK Link9a 159 | NODES NorthWest:NE NorthEast:NW 160 | VIA 500 130 161 | 162 | LINK middles 163 | NODES NorthWest node20 164 | 165 | LINK numeric 166 | NODES node20:10:10 node30:-10:-10 167 | 168 | LINK loop1 169 | NODES East:N East:S 170 | VIA 750 300 171 | VIA 800 400 172 | VIA 750 500 173 | 174 | LINK parallel_1 175 | NODES SouthWest:32:-12 South:-32:-12 176 | 177 | LINK parallel_2 178 | BWLABELPOS 20 80 179 | NODES SouthWest:32:12 South:-32:12 180 | 181 | LINK longloop 182 | INCOMMENT This is a comment for the in-side of the link. 183 | OUTCOMMENT MXUK1122 184 | NODES South:SW West:SW 185 | VIA 300 740 186 | VIA 200 740 187 | VIA 200 600 188 | 189 | LINK nooutline 190 | OUTLINECOLOR none 191 | NODES node100:W node101:W 192 | VIA 840 300 193 | 194 | LINK withoutline 195 | OUTLINECOLOR 255 0 0 196 | NODES node100:E node101:E 197 | VIA 960 300 198 | 199 | LINK uni 200 | NODES node100:S node101:N 201 | SET bwlabel_padding 5 202 | 203 | 204 | # End of LINK section 205 | 206 | # That's All Folks! 207 | -------------------------------------------------------------------------------- /docs/example/suite-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/example/suite-2.png -------------------------------------------------------------------------------- /docs/example/weathermap.conf: -------------------------------------------------------------------------------- 1 | # 2 | # A minimal config file to get you started. 3 | # - see also the docs/example folder. 4 | # - and configs/simple.conf 5 | 6 | HTMLSTYLE overlib 7 | WIDTH 800 8 | HEIGHT 600 9 | 10 | HTMLOUTPUTFILE weathermap.html 11 | IMAGEOUTPUTFILE weathermap.png 12 | 13 | NODE node1 14 | POSITION 200 200 15 | LABEL node1 16 | 17 | NODE node2 18 | POSITION 500 200 19 | LABEL node2 20 | 21 | LINK firstlink 22 | NODES node1 node2 23 | BANDWIDTH 30M 24 | -------------------------------------------------------------------------------- /docs/fonts/PTC55F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/fonts/PTC55F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTC75F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/fonts/PTC75F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTN57F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/fonts/PTN57F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTN77F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/fonts/PTN77F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTS55F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/fonts/PTS55F-webfont.ttf -------------------------------------------------------------------------------- /docs/fonts/PTS75F-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/fonts/PTS75F-webfont.ttf -------------------------------------------------------------------------------- /docs/howto.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/howto.pdf -------------------------------------------------------------------------------- /docs/howto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/howto.png -------------------------------------------------------------------------------- /docs/images/arrowstyle-classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/arrowstyle-classic.png -------------------------------------------------------------------------------- /docs/images/arrowstyle-compact.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/arrowstyle-compact.png -------------------------------------------------------------------------------- /docs/images/bwstyle-angled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/bwstyle-angled.png -------------------------------------------------------------------------------- /docs/images/bwstyle-classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/bwstyle-classic.png -------------------------------------------------------------------------------- /docs/images/cacti_mainscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/cacti_mainscreen.png -------------------------------------------------------------------------------- /docs/images/cacti_maps_manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/cacti_maps_manage.png -------------------------------------------------------------------------------- /docs/images/cacti_step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/cacti_step1.png -------------------------------------------------------------------------------- /docs/images/cacti_step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/cacti_step2.png -------------------------------------------------------------------------------- /docs/images/cacti_user_manage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/cacti_user_manage.png -------------------------------------------------------------------------------- /docs/images/cacti_wmap_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/cacti_wmap_settings.png -------------------------------------------------------------------------------- /docs/images/commentstyle-center.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/commentstyle-center.png -------------------------------------------------------------------------------- /docs/images/commentstyle-edge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/commentstyle-edge.png -------------------------------------------------------------------------------- /docs/images/compass-points.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/compass-points.png -------------------------------------------------------------------------------- /docs/images/contrast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/contrast.png -------------------------------------------------------------------------------- /docs/images/font-sizes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/font-sizes.png -------------------------------------------------------------------------------- /docs/images/howto-thumb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/howto-thumb.jpg -------------------------------------------------------------------------------- /docs/images/keystyle-classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/keystyle-classic.png -------------------------------------------------------------------------------- /docs/images/keystyle-horizontal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/keystyle-horizontal.png -------------------------------------------------------------------------------- /docs/images/keystyle-inverted.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/keystyle-inverted.png -------------------------------------------------------------------------------- /docs/images/keystyle-tags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/keystyle-tags.png -------------------------------------------------------------------------------- /docs/images/keystyle-vertical.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/keystyle-vertical.png -------------------------------------------------------------------------------- /docs/images/labelangle+labeloffset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/labelangle+labeloffset.png -------------------------------------------------------------------------------- /docs/images/link-comments.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/link-comments.png -------------------------------------------------------------------------------- /docs/images/linkoffset-defaults.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/linkoffset-defaults.png -------------------------------------------------------------------------------- /docs/images/linkoffset-east50west50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/linkoffset-east50west50.png -------------------------------------------------------------------------------- /docs/images/linkoffset-eastwest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/linkoffset-eastwest.png -------------------------------------------------------------------------------- /docs/images/linkoffset-parallel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/linkoffset-parallel.png -------------------------------------------------------------------------------- /docs/images/linkoffset-radial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/linkoffset-radial.png -------------------------------------------------------------------------------- /docs/images/viastyle-angled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/viastyle-angled.png -------------------------------------------------------------------------------- /docs/images/viastyle-curved.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/viastyle-curved.png -------------------------------------------------------------------------------- /docs/images/weathermap-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/weathermap-example.png -------------------------------------------------------------------------------- /docs/images/weathermap-mini.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/docs/images/weathermap-mini.png -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.98a - Start Here 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 23 | 24 |

New 25 | Users should start here.

26 | 27 |

Documentation Guide

28 |

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

29 | 30 |

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

45 | 46 |

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

49 | 50 |

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

54 | 55 |

What I'm trying to say is 56 | RTFM, 57 | but in a more polite way! 58 | :-) I put a fair amount of my own time and effort into writing the 59 | program, and then a whole bunch 60 | more into writing the manual and other documentation - more than a thousand hours by now. I also spend my 61 | 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 62 | answered in the manual, or worse still, in the FAQ section. 63 | Please take a look.

64 | 65 |

Visual Guides

66 | 67 |

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

68 | 69 |
70 |
71 |

72 | 73 |

74 | 75 |

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

82 |
83 | 84 |
85 |

86 | 87 |

88 | 89 |

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

93 |

This is from the Example Map section of the manual.

94 |
95 |
96 | 97 |
98 | 99 |
100 |
101 | 102 | 103 | -------------------------------------------------------------------------------- /docs/index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | PHP Weathermap v0.98a - Upgrading 7 | 8 | 9 | 10 | 33 | 34 | 35 | 36 |
37 | 38 | 45 | 46 |

Upgrading From Previous Versions

47 | 48 |

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

50 | 51 |

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

    56 |
  • If you use the editor, then copy your editor-config.php out of the 57 | way, copy the new editor-config.php-dist over the top of the in-place 58 | editor-config.php and then make the same changes you made in your 59 | original install (cacti path and URI). 60 | This is especially important when upgrading to 0.92
  • 61 | 62 |
  • If you use the command-line tool, you will need to put the path to 63 | rrdtool back in, around line 30 of the 'weathermap' file.
  • 64 |

65 | 66 |

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

68 | 69 |
70 |
71 | 72 | 73 | -------------------------------------------------------------------------------- /docs/pages/weathermap.css: -------------------------------------------------------------------------------- 1 | body { font-family: 'Lucida Grande', 'Trebuchet MS', 2 | Verdana, Lucida, Geneva, Helvetica, 3 | Arial, sans-serif; 4 | padding:0; margin: 0; 5 | } 6 | 7 | #frame { margin-left: 10px; font-size: 9pt; line-height: 150%; padding: 10pt;} 8 | 9 | .card-left, .card-right { 10 | float: left; 11 | clear: left; 12 | width: 170px; 13 | margin: 0 15px 15px 0; 14 | padding: 10px 0; 15 | text-align: center; 16 | background: white; 17 | border-right: 1px solid #ccc; 18 | border-bottom: 1px solid #ccc; 19 | font-size: 75%; 20 | } 21 | 22 | .card-right { 23 | clear: right; 24 | float: right; 25 | margin: 0 0 15px 15px; 26 | } 27 | 28 | .topnav { 29 | border-top: 1px solid #999; 30 | border-bottom: 1px solid #999; 31 | margin-bottom: 10px; 32 | background: #ddd; 33 | } 34 | 35 | 36 | .license { 37 | margin-left: 20pt; 38 | margin-right: 20pt; 39 | font-size: 8pt; 40 | padding: 4pt; 41 | border: black dashed 1px; 42 | background-color: #eee; 43 | } 44 | 45 | .notebox { 46 | margin-left: 20pt; 47 | margin-right: 20pt; 48 | padding: 4pt; 49 | border: black dashed 1px; 50 | background-color: #eee; 51 | } 52 | 53 | .shell { 54 | background-color: #eef; 55 | margin-left: 20pt; 56 | padding: 4pt; 57 | font-size: small; 58 | } 59 | 60 | .sidenote { 61 | float: right; 62 | width: 250px; 63 | border: 1px dashed #aaa; 64 | padding: 4pt; 65 | margin: 4pt; 66 | background-color: #eee; 67 | } 68 | 69 | h2.card-title { border:0; font-size: 160%; } 70 | 71 | h2 { 72 | margin-top: 10pt; 73 | padding-top: 10pt; 74 | } 75 | 76 | h1 {font-size: 24pt;} 77 | h2 {font-size: 18pt;} 78 | h3 {font-size: 14pt;} 79 | h4 { font-size: 11pt} 80 | 81 | .faq dt { padding-top: 5pt; font-weight: bold; font-style: italic; font-size: 110% } 82 | .faq dd { } 83 | 84 | 85 | h1.configsection { padding-top: 1em;} 86 | .referenceentry { clear: both; } 87 | .referenceentry h2 { margin-left: 0; width: 100%; border-top: 1px solid; } 88 | .description { font-size: 0.9em; } 89 | .definition { background: #ddd; margin-left: 2em; margin-right:5em; padding: 10px; border-bottom: #aaa solid 1px;;} 90 | .meta { padding-left: 1em; } 91 | 92 | .example { background: #dde; margin-left: 2em; margin-right: 5em; } 93 | .changes { font-size: 90%; margin-left: 2em;} 94 | .changes h3 { font-size: 90%; } 95 | 96 | .changes dl {width: 80%; 97 | margin: 0 0; 98 | padding: 0; 99 | font-size: 90%; } 100 | 101 | .changes dt { width: 5%; 102 | float: left; 103 | clear: both; 104 | margin: 0 0 0 0; 105 | padding: .5em; 106 | font-weight: bold; } 107 | 108 | .changes dd { width: 75%; 109 | margin: 0 0 0 0; 110 | padding: .5em;} 111 | 112 | /*****/ 113 | 114 | 115 | 116 | .navcontainer { border-top: solid 1px #eee; border-bottom: solid 1px #ccc; background: #ddd; } 117 | 118 | #navlist 119 | { 120 | margin: 0; 121 | padding: 0 0 20px 10px; 122 | border-bottom: 1px solid #000; 123 | } 124 | 125 | #navlist ul, #navlist li 126 | { 127 | margin: 0; 128 | padding: 0; 129 | display: inline; 130 | list-style-type: none; 131 | } 132 | 133 | #navlist a:link, #navlist a:visited 134 | { 135 | float: left; 136 | line-height: 14px; 137 | font-weight: bold; 138 | font-size: 90%; 139 | margin: 0 0px 4px 0px; 140 | border-right: 1px solid #666; 141 | padding-right: 4px; 142 | padding-left: 4px; 143 | text-decoration: none; 144 | color: #999; 145 | } 146 | 147 | #navlist a:link#current, #navlist a:visited#current, #navlist a:hover 148 | { 149 | border-bottom: 4px solid #000; 150 | padding-bottom: 2px; 151 | background: transparent; 152 | color: #000; 153 | } 154 | 155 | #navlist a:hover { color: #000; } 156 | 157 | table.biglist { width: 70%; margin-left: auto; margin-right: auto;} 158 | table.biglist th { text-align: left; padding-right: 10px;} 159 | table.biglist tbody tr td { border-top: solid 1px #ddd; } 160 | 161 | 162 | img.figure { padding: 1em; } 163 | img.figright { float: right; } 164 | img.figleft { float: left; } 165 | 166 | .important { padding-left: 1em; padding-right: 1em; padding-top: 1em; padding-bottom: 1em; margin-top: 1em; margin-bottom: 1em; font-weight: bold; border-top: 1px solid gray; border-bottom: 1px solid gray; background: #eee; } 167 | 168 | .card-desc { font-size: 75%; } 169 | -------------------------------------------------------------------------------- /images/backgrounds/Gradient_BK_800.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/images/backgrounds/Gradient_BK_800.png -------------------------------------------------------------------------------- /images/backgrounds/background1_950x625_197.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/images/backgrounds/background1_950x625_197.jpg -------------------------------------------------------------------------------- /images/backgrounds/blueboard1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/images/backgrounds/blueboard1024.png -------------------------------------------------------------------------------- /images/backgrounds/bw_gradient_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cacti/plugin_weathermap/103fd534aea3e7adf2e65a53f022296bec5e3023/images/backgrounds/bw_gradient_1024.png -------------------------------------------------------------------------------- /images/backgrounds/index.php: -------------------------------------------------------------------------------- 1 | e)return}clearTimeout(d.tId),d.idle&&g(b),d.lastActive=+new Date,d.pageX=b.pageX,d.pageY=b.pageY,"storage"!==b.type&&d.timerSyncId&&"undefined"!=typeof localStorage&&localStorage.setItem(d.timerSyncId,d.lastActive),d.tId=setTimeout(g,d.timeout)}},i=function(){var b=a.data(c,"idleTimerObj")||{};b.idle=b.idleBackup,b.olddate=+new Date,b.lastActive=b.olddate,b.remaining=null,clearTimeout(b.tId),b.idle||(b.tId=setTimeout(g,b.timeout))},j=function(){var b=a.data(c,"idleTimerObj")||{};null==b.remaining&&(b.remaining=b.timeout-(+new Date-b.olddate),clearTimeout(b.tId))},k=function(){var b=a.data(c,"idleTimerObj")||{};null!=b.remaining&&(b.idle||(b.tId=setTimeout(g,b.remaining)),b.remaining=null)},l=function(){var b=a.data(c,"idleTimerObj")||{};clearTimeout(b.tId),e.removeData("idleTimerObj"),e.off("._idleTimer")},m=function(){var b=a.data(c,"idleTimerObj")||{};if(b.idle)return 0;if(null!=b.remaining)return b.remaining;var d=b.timeout-(+new Date-b.lastActive);return 0>d&&(d=0),d};if(null===b&&"undefined"!=typeof f.idle)return i(),e;if(null===b);else{if(null!==b&&"undefined"==typeof f.idle)return!1;if("destroy"===b)return l(),e;if("pause"===b)return j(),e;if("resume"===b)return k(),e;if("reset"===b)return i(),e;if("getRemainingTime"===b)return m();if("getElapsedTime"===b)return+new Date-f.olddate;if("getLastActiveTime"===b)return f.lastActive;if("isIdle"===b)return f.idle}return e.on(a.trim((d.events+" ").split(" ").join("._idleTimer ")),function(a){h(a)}),d.timerSyncId&&a(window).bind("storage",h),f=a.extend({},{olddate:+new Date,lastActive:+new Date,idle:d.idle,idleBackup:d.idle,timeout:d.timeout,remaining:null,timerSyncId:d.timerSyncId,tId:null,pageX:null,pageY:null}),f.idle||(f.tId=setTimeout(g,f.timeout)),a.data(c,"idleTimerObj",f),e},a.fn.idleTimer=function(b){return this[0]?a.idleTimer(b,this[0]):this}}(jQuery); -------------------------------------------------------------------------------- /js/weathermap.js: -------------------------------------------------------------------------------- 1 | var tooltipObject = null; 2 | var wmHoverTimeout = null; 3 | 4 | $(function() { 5 | $('map').tooltip({ 6 | items: 'area', 7 | open: function(event, ui) { 8 | if (typeof(event.originalEvent) == 'undefined') { 9 | return false; 10 | } 11 | 12 | var id = $(ui.tooltip).attr('id'); 13 | 14 | $('div.ui-tooltip').not('#'+ id).remove(); 15 | 16 | ui.tooltip.css('min-width', '200px'); 17 | ui.tooltip.css('max-width', '1800px'); 18 | ui.tooltip.css('overflow-y', 'visible'); 19 | 20 | ui.tooltip.position({ 21 | my: 'left top', 22 | at: 'right+15 center', 23 | of: event 24 | }); 25 | 26 | tooltipObject = ui.tooltip; 27 | wmHoverTimeout = setTimeout(adjustTooltipWindow, 200); 28 | }, 29 | close: function(event, ui) { 30 | ui.tooltip.hover( 31 | function () { 32 | $(this).stop(true).fadeTo(1000, 1); 33 | }, 34 | function() { 35 | $(this).fadeOut(1000, function() { 36 | $(this).remove(); 37 | }); 38 | }); 39 | }, 40 | content: function(callback) { 41 | var data = $('
'); 42 | 43 | data.find('#wm_hover_child.cactiTableTitleRow').html($(this).attr('data-caption')); 44 | data.find('.wmcontent').html($(this).attr('data-hover')); 45 | 46 | callback(data); 47 | } 48 | }); 49 | 50 | waitForFinalEvent(function() { 51 | $('.cactiGraphContentArea').removeClass('cactiGraphContentArea').addClass('wm_scroll'); 52 | }); 53 | }); 54 | 55 | function adjustTooltipWindow() { 56 | var maxWidth = $(tooltipObject).find('img').width(); 57 | //console.log(maxWidth); 58 | tooltipObject.css('max-width', maxWidth+'px'); 59 | tooltipObject.css('max-height', '800px'); 60 | tooltipObject.css('overflow-y', 'visible'); 61 | } 62 | -------------------------------------------------------------------------------- /lib/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | Order deny,allow 3 | Deny from all 4 | 5 | -------------------------------------------------------------------------------- /lib/WMLine.class.php: -------------------------------------------------------------------------------- 1 | point = $p; 52 | $this->vector = $v; 53 | } 54 | 55 | public function getSlope() { 56 | return $this->vector->getSlope(); 57 | } 58 | 59 | public function getYIntercept() { 60 | $slope = $this->getSlope(); 61 | $intercept = $this->point->y - $this->point->x * $slope; 62 | 63 | return $intercept; 64 | } 65 | 66 | public function __toString() { 67 | return sprintf("/%s-%s/", $this->point, $this->vector); 68 | } 69 | 70 | /** 71 | * Find the point where this line and another one cross 72 | * 73 | * @param $line2 the other line 74 | * @return WMPoint the crossing point 75 | * @throws WeathermapInternalFail 76 | */ 77 | public function findCrossingPoint($line2) { 78 | $slope1 = $this->vector->getSlope(); 79 | $slope2 = $line2->vector->getSlope(); 80 | 81 | if ($slope1 == $slope2) { 82 | // for a general case, this should probably be handled better 83 | // but for our use, there should never be parallel lines 84 | throw new WeathermapInternalFail("ParallelLinesNeverCross"); 85 | } 86 | 87 | $intercept1 = $this->getYIntercept(); 88 | $intercept2 = $line2->getYIntercept(); 89 | 90 | $xCrossing = ($intercept2 - $intercept1) / ($slope1 - $slope2); 91 | $yCrossing = $intercept1 + $slope1*$xCrossing; 92 | 93 | return new WMPoint($xCrossing, $yCrossing); 94 | } 95 | } 96 | 97 | -------------------------------------------------------------------------------- /lib/WMVector.class.php: -------------------------------------------------------------------------------- 1 | dx = $dx; 53 | $this->dy = $dy; 54 | } 55 | 56 | public function flip() { 57 | $this->dx = - $this->dx; 58 | $this->dy = - $this->dy; 59 | } 60 | 61 | public function getAngle() { 62 | return rad2deg(atan2((-$this->dy), ($this->dx))); 63 | } 64 | 65 | public function getSlope() { 66 | if ($this->dx == 0) { 67 | // special case - if slope is infinite, fudge it to be REALLY BIG instead. Close enough for TV. 68 | wm_debug("Slope is infinite.\n"); 69 | 70 | return 1e10; 71 | } 72 | 73 | return ($this->dy / $this->dx); 74 | } 75 | 76 | /** 77 | * @param float $angle 78 | */ 79 | public function rotate($angle) { 80 | $points = array(); 81 | $points[0] = $this->dx; 82 | $points[1] = $this->dy; 83 | 84 | rotateAboutPoint($points, 0, 0, $angle); 85 | 86 | $this->dx = $points[0]; 87 | $this->dy = $points[1]; 88 | } 89 | 90 | /** 91 | * @return WMVector 92 | */ 93 | public function getNormal() { 94 | $len = $this->length(); 95 | 96 | if ($len==0) { 97 | return new WMVector(0, 0); 98 | } 99 | 100 | return new WMVector($this->dy / $len, -$this->dx / $len); 101 | } 102 | 103 | /** 104 | * Turn vector into unit-vector 105 | */ 106 | public function normalise() { 107 | $len = $this->length(); 108 | 109 | if ($len > 0 && $len != 1) { 110 | $this->dx = $this->dx / $len; 111 | $this->dy = $this->dy / $len; 112 | } 113 | } 114 | 115 | /** 116 | * Calculate the square of the vector length. 117 | * Save calculating a square-root if all you need to do is compare lengths 118 | * 119 | * @return float 120 | */ 121 | public function squaredLength() { 122 | if (($this->dx == 0) && ($this->dy == 0)) { 123 | return 0; 124 | } 125 | 126 | $squaredLength = ($this->dx) * ($this->dx) + ($this->dy) * ($this->dy); 127 | 128 | return $squaredLength; 129 | } 130 | 131 | /** 132 | * @return float 133 | */ 134 | public function length() { 135 | if ($this->dx==0 && $this->dy==0) { 136 | return 0; 137 | } 138 | 139 | return (sqrt($this->squaredLength())); 140 | } 141 | 142 | public function asString() { 143 | return $this->__toString(); 144 | } 145 | 146 | /** 147 | * @return string 148 | */ 149 | public function __toString() { 150 | return sprintf("[%f,%f]", $this->dx, $this->dy); 151 | } 152 | } 153 | 154 | -------------------------------------------------------------------------------- /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') { 46 | if (function_exists('db_fetch_row')) { 47 | return(true); 48 | } else { 49 | wm_debug('ReadData CactiHost: Cacti database library not found.'); 50 | } 51 | } else { 52 | wm_debug("ReadData CactiHost: Can only run from Cacti environment."); 53 | } 54 | 55 | return(false); 56 | } 57 | 58 | function Recognise($targetstring) { 59 | if (preg_match("/^cactihost:(\d+)$/",$targetstring,$matches)) { 60 | return true; 61 | } else { 62 | return false; 63 | } 64 | } 65 | 66 | function ReadData($targetstring, &$map, &$item) { 67 | $data[IN] = NULL; 68 | $data[OUT] = NULL; 69 | $data_time = 0; 70 | 71 | if (preg_match("/^cactihost:(\d+)$/",$targetstring,$matches)) { 72 | $cacti_id = intval($matches[1]); 73 | $state = -1; 74 | 75 | // 0=disabled 76 | // 1=down 77 | // 2=recovering 78 | // 3=up 79 | 80 | $result = db_fetch_row_prepared("SELECT * 81 | FROM host 82 | WHERE id = ?", 83 | array($cacti_id)); 84 | 85 | if (cacti_sizeof($result)) { 86 | // create a note, which can be used in icon filenames or labels more nicely 87 | if ($result['status'] == 1) { 88 | $state = 1; 89 | $statename = 'down'; 90 | } 91 | 92 | if ($result['status'] == 2) { 93 | $state = 2; 94 | $statename = 'recovering'; 95 | } 96 | 97 | if ($result['status'] == 3) { 98 | $state = 3; 99 | $statename = 'up'; 100 | } 101 | 102 | if ($result['disabled']) { 103 | $state = 0; 104 | $statename = 'disabled'; 105 | } 106 | 107 | $data[IN] = $state; 108 | $data[OUT] = $state; 109 | 110 | $item->add_note("state",$statename); 111 | $item->add_note("cacti_description",$result['description']); 112 | 113 | $item->add_note("cacti_hostname",$result['hostname']); 114 | $item->add_note("cacti_curtime",$result['cur_time']); 115 | $item->add_note("cacti_avgtime",$result['avg_time']); 116 | $item->add_note("cacti_mintime",$result['min_time']); 117 | $item->add_note("cacti_maxtime",$result['max_time']); 118 | $item->add_note("cacti_availability",$result['availability']); 119 | 120 | $item->add_note("cacti_faildate",$result['status_fail_date']); 121 | $item->add_note("cacti_recdate",$result['status_rec_date']); 122 | } 123 | } 124 | 125 | wm_debug ("CactiHost ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)"); 126 | 127 | return(array($data[IN], $data[OUT], $data_time)); 128 | } 129 | } 130 | 131 | -------------------------------------------------------------------------------- /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_mrtg.php: -------------------------------------------------------------------------------- 1 | get_hint('mrtg_value'); 64 | $matchperiod = $item->get_hint('mrtg_period'); 65 | 66 | $swap = intval($item->get_hint('mrtg_swap')); 67 | $negate = intval($item->get_hint('mrtg_negate')); 68 | 69 | if ($matchvalue =='') { 70 | $matchvalue = "cu"; 71 | } 72 | 73 | if ($matchperiod =='') { 74 | $matchperiod = "d"; 75 | } 76 | 77 | $fd = fopen($targetstring, "r"); 78 | 79 | if ($fd) { 80 | while (!feof($fd)) { 81 | $buffer=fgets($fd, 4096); 82 | wm_debug("MRTG ReadData: Matching on '{$matchvalue}in $matchperiod' and '{$matchvalue}out $matchperiod'"); 83 | 84 | if (preg_match("/<\!-- {$matchvalue}in $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[IN] = $matches[1] * 8; } 85 | if (preg_match("/<\!-- {$matchvalue}out $matchperiod ([-+]?\d+\.?\d*) -->/", $buffer, $matches)) { $data[OUT] = $matches[1] * 8; } 86 | } 87 | 88 | fclose($fd); 89 | 90 | # don't bother with the modified time if the target is a URL 91 | if (! preg_match('/^[a-z]+:\/\//',$targetstring) ) { 92 | $data_time = filemtime($targetstring); 93 | } 94 | } else { 95 | // some error code to go in here 96 | wm_debug ("MRTG ReadData: Couldn't open ($targetstring)"); 97 | } 98 | 99 | if ($swap==1) { 100 | wm_debug("MRTG ReadData: Swapping IN and OUT"); 101 | 102 | $t = $data[OUT]; 103 | 104 | $data[OUT] = $data[IN]; 105 | $data[IN] = $t; 106 | } 107 | 108 | if ($negate) { 109 | wm_debug("MRTG ReadData: Negating values"); 110 | 111 | $data[OUT] = -$data[OUT]; 112 | $data[IN] = -$data[IN]; 113 | } 114 | 115 | wm_debug ("MRTG ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)"); 116 | 117 | return( array($data[IN], $data[OUT], $data_time) ); 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_skeleton.php.txt: -------------------------------------------------------------------------------- 1 | 50 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_static.php: -------------------------------------------------------------------------------- 1 | kilo); 67 | $outbw = unformat_number($matches[2], $map->kilo); 68 | $data_time = time(); 69 | } 70 | 71 | if (preg_match("/^static:(\-?\d+\.?\d*[KMGT]*)$/", $targetstring, $matches)) { 72 | $inbw = unformat_number($matches[1], $map->kilo); 73 | $outbw = $inbw; 74 | $data_time = time(); 75 | } 76 | 77 | wm_debug("Static ReadData: Returning ($inbw, $outbw, $data_time)"); 78 | 79 | return (array($inbw, $outbw, $data_time)); 80 | } 81 | } 82 | 83 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_tabfile.php: -------------------------------------------------------------------------------- 1 | name; 63 | 64 | $matches = 0; 65 | 66 | $fd = fopen($targetstring, "r"); 67 | 68 | if ($fd) { 69 | while (!feof($fd)) { 70 | $buffer=fgets($fd, 4096); 71 | 72 | # strip out any Windows line-endings that have gotten in here 73 | $buffer=str_replace("\r", "", $buffer); 74 | 75 | if (preg_match("/^$itemname\t(\d+\.?\d*[KMGT]*)\t(\d+\.?\d*[KMGT]*)/", $buffer, $matches)) { 76 | $data[IN]=unformat_number($matches[1]); 77 | $data[OUT]=unformat_number($matches[2]); 78 | } 79 | } 80 | 81 | $stats = stat($targetstring); 82 | $data_time = $stats['mtime']; 83 | } else { 84 | // some error code to go in here 85 | wm_debug ("TabText ReadData: Couldn't open ($targetstring)"); 86 | } 87 | 88 | wm_debug ("TabText ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)"); 89 | 90 | return(array($data[IN], $data[OUT], $data_time)); 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_time.php: -------------------------------------------------------------------------------- 1 | name; 64 | 65 | $matches = 0; 66 | 67 | if (preg_match("/^time:(.*)$/",$targetstring,$matches)) { 68 | $timezone = $matches[1]; 69 | $timezone_l = strtolower($timezone); 70 | 71 | $timezone_identifiers = DateTimeZone::listIdentifiers(); 72 | 73 | foreach ($timezone_identifiers as $tz) { 74 | if (strtolower($tz) == $timezone_l) { 75 | wm_debug ("Time ReadData: Timezone exists: $tz"); 76 | 77 | $dateTime = new DateTime("now", new DateTimeZone($tz)); 78 | 79 | $item->add_note("time_time12", $dateTime->format("h:i")); 80 | $item->add_note("time_time12ap", $dateTime->format("h:i A")); 81 | $item->add_note("time_time24", $dateTime->format("H:i")); 82 | $item->add_note("time_timezone", $tz); 83 | 84 | $data[IN] = $dateTime->format("H"); 85 | $data_time = time(); 86 | $data[OUT] = $dateTime->format("i"); 87 | 88 | $matches++; 89 | } 90 | } 91 | 92 | if ($matches == 0) { 93 | wm_warn ("Time ReadData: Couldn't recognize $timezone as a valid timezone name [WMTIME02]\n"); 94 | } 95 | } else { 96 | // some error code to go in here 97 | wm_warn ("Time ReadData: Couldn't recognize $targetstring \n"); 98 | } 99 | 100 | wm_debug ("Time ReadData: Returning (".($data[IN]===NULL?'NULL':$data[IN]).",".($data[OUT]===NULL?'NULL':$data[OUT]).",$data_time)"); 101 | 102 | return(array($data[IN], $data[OUT], $data_time) ); 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /lib/datasources/WeatherMapDataSource_wmdata.php: -------------------------------------------------------------------------------- 1 | name; 58 | 59 | $matches = 0; 60 | 61 | if (preg_match('/^wmdata:([^:]*):(.*)', trim($targetstring), $matches)) { 62 | $datafile = trim($matches[1]); 63 | $dataname = trim($matches[2]); 64 | } 65 | 66 | if (file_exists($datafile)) { 67 | $fd = fopen($targetstring, 'r'); 68 | 69 | if ($fd) { 70 | $found = false; 71 | 72 | while (!feof($fd)) { 73 | $buffer = fgets($fd, 4096); 74 | # strip out any Windows line-endings that have gotten in here 75 | $buffer = str_replace("\r", '', $buffer); 76 | 77 | $fields = explode("\t",$buffer); 78 | 79 | if ($fields[0] == $dataname) { 80 | $data[IN] = $fields[1]; 81 | $data[OUT] = $fields[2]; 82 | 83 | $found = true; 84 | } 85 | } 86 | 87 | if ($found===true) { 88 | $stats = stat($datafile); 89 | $data_time = $stats['mtime']; 90 | } else { 91 | wm_warn("WMData ReadData: Data name ($dataname) didn't exist in ($datafile). [WMWMDATA03]"); 92 | } 93 | } else { 94 | wm_warn("WMData ReadData: Couldn't open ($datafile). [WMWMDATA02]"); 95 | } 96 | } else { 97 | wm_warn("WMData ReadData: $datafile doesn't exist [WMWMDATA01]"); 98 | } 99 | 100 | wm_debug( 101 | sprintf("WMData ReadData: Returning (%s, %s, %s)", 102 | string_or_null($data[IN]), 103 | string_or_null($data[OUT]), 104 | $data_time 105 | ) 106 | ); 107 | 108 | return ( 109 | array ( 110 | $data[IN], 111 | $data[OUT], 112 | $data_time 113 | ) 114 | ); 115 | } 116 | } 117 | 118 | -------------------------------------------------------------------------------- /lib/datasources/index.php: -------------------------------------------------------------------------------- 1 | x * ($point2->y - $point3->y) 45 | + $point2->x * ($point3->y - $point1->y) 46 | + $point3->x * ($point1->y - $point2->y)) / 2.0; 47 | 48 | return $area; 49 | } 50 | 51 | class WMLineSegment { 52 | public $point1; 53 | public $point2; 54 | public $vector; 55 | 56 | public function __construct($p1, $p2) { 57 | $this->point1 = $p1; 58 | $this->point2 = $p2; 59 | 60 | $this->vector = $p1->vectorToPoint($p2); 61 | } 62 | 63 | public function __toString() { 64 | return sprintf("{%s--%s}", $this->point1, $this->point2); 65 | } 66 | } 67 | 68 | /** 69 | * rotate a list of points around cx,cy by an angle in radians, IN PLACE 70 | * 71 | * TODO: This should be using WMPoints! (And should be a method of WMPoint) 72 | * 73 | * @param $points array of ordinates (x,y,x,y,x,y...) 74 | * @param $centre_x centre of rotation, X coordinate 75 | * @param $centre_y centre of rotation, Y coordinate 76 | * @param int $angle angle in radians 77 | */ 78 | function rotateAboutPoint(&$points, $centre_x, $centre_y, $angle = 0) { 79 | $nPoints = count($points) / 2; 80 | 81 | for ($i = 0; $i < $nPoints; $i ++) { 82 | $delta_x = $points[$i * 2] - $centre_x; 83 | $delta_y = $points[$i * 2 + 1] - $centre_y; 84 | $rotated_x = $delta_x * cos($angle) - $delta_y * sin($angle); 85 | $rotated_y = $delta_y * cos($angle) + $delta_x * sin($angle); 86 | 87 | $points[$i * 2] = $rotated_x + $centre_x; 88 | $points[$i * 2 + 1] = $rotated_y + $centre_y; 89 | } 90 | } 91 | 92 | -------------------------------------------------------------------------------- /lib/index.php: -------------------------------------------------------------------------------- 1 | get_hint('post_test_enable'); 53 | 54 | if ($enable) { 55 | wm_debug(__CLASS__ . ' is here'); 56 | 57 | /** 58 | * do your work in here... 59 | */ 60 | 61 | $orig = $map->get_note('test'); 62 | $map->add_note('test', $orig . ' TESTYTEST'); 63 | } else { 64 | wm_debug(__CLASS__ . ' Not Enabled'); 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /lib/post/index.php: -------------------------------------------------------------------------------- 1 | add_note('test','TEST!'); 51 | 52 | wm_debug("Example Preprocessor in the hizouse"); 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /lib/pre/index.php: -------------------------------------------------------------------------------- 1 | /dev/null` 28 | if [ $? -gt 0 ] 29 | then 30 | echo "ERROR: unable to locate realpath" 31 | echo 32 | echo "Linux: Confirm coreutils installed" 33 | echo "Mac: Brew install coreutils" 34 | echo 35 | exit 1 36 | fi 37 | BASE_PATH=`${REALPATH_BIN} ${0} | sed s#/locales/${SCRIPT_NAME}##` 38 | 39 | # locate xgettext for processing 40 | XGETTEXT_BIN=`which xgettext 2>/dev/null` 41 | if [ $? -gt 0 ] 42 | then 43 | echo "ERROR: Unable to locate xgettext" 44 | echo 45 | echo "Linux: Install GNU gettext" 46 | echo "Mac: Brew install GNU gettext" 47 | echo 48 | exit 1 49 | fi 50 | 51 | # Update main gettext POT file with application strings 52 | echo "Updating Cacti language gettext language file..." 53 | cd ${BASE_PATH} 54 | 55 | ${XGETTEXT_BIN} --no-wrap --copyright-holder="The Cacti Group" --package-name="Cacti" --package-version=`cat include/cacti_version` --msgid-bugs-address="developers@cacti.net" -F -k__gettext -k__ -k__n:1,2 -k__x:1c,2 -k__xn:1c,2,3 -k__esc -k__esc_n:1,2 -k__esc_x:1c,2 -k__esc_xn:1c,2,3 -k__date -o locales/po/cacti.pot `find . -maxdepth 2 -name \*.php` 56 | 57 | sed -i 's/FULL NAME /Cacti Developers /g' locales/po/cacti.pot 58 | sed -i 's/LANGUAGE /Cacti Developers /g' locales/po/cacti.pot 59 | sed -i 's/CHARSET/UTF-8/g' locales/po/cacti.pot 60 | 61 | # Merge any changes to POT file into language files 62 | echo "Merging updates to language files..." 63 | 64 | for file in `ls -1 locales/po/*.po`;do 65 | echo "Updating $file from cacti.pot" 66 | msgmerge --backup off --no-wrap --update -F $file locales/po/cacti.pot 67 | done 68 | 69 | for file in `ls -1 locales/po/*.po`;do 70 | ofile=$(basename --suffix=.po ${file}) 71 | echo "Converting $file to LC_MESSAGES/${ofile}.mo" 72 | msgfmt ${file} -o locales/LC_MESSAGES/${ofile}.mo 73 | done 74 | 75 | exit 0 76 | -------------------------------------------------------------------------------- /locales/index.php: -------------------------------------------------------------------------------- 1 |