Automatically generate weathermaps from a LibreNMS database
- A working LibreNMS installation
- A working LibreNMS-Weathermap Plugin
- PHP 5.4+
- Clone to a directory such as /opt/weathermapper:
cd /opt; git clone https://github.com/pblasquez/weathermapper.git
- Verify settings are correct in weathermapper.conf.php
- Create a map file in conf.d using the examples provided
- Run weathermapper.php:
$ php weathermapper.php
Examples can be found in the examples directory or viewed on the wiki.
- Play with the values in grid_opts to see the effects on the auto-layout.
- Target different hierarchy members using the search_opts and assign them to separate rows.
- Use the auto-layout as a fast-forward then manually edit the resulting map.
Examples are included in the conf.d directory. The comments may be a bit overwhelming, so here is what the configuration looks like when stripped of documentation:
$label = 'mylabel';
$weathermapper[$label] = [];
$weathermapper[$label]['title'] = "Network Map (".$label.")";
$weathermapper[$label]['grid_opts'] = $grid_opts;
$weathermapper[$label]['search_opts'] = [];
$weathermapper[$label]['search_opts']['types'] = ['hostname'];
$weathermapper[$label]['search_opts']['hostnames'] = [];
$weathermapper[$label]['search_opts']['hostnames'][] = [
'regex' => "myhost[0-9]+.*",
'row' => 10
];
$label = 'mylabel';
$weathermapper[$label] = [];
$weathermapper[$label]['title'] = "Network Map (".$label.")";
$weathermapper[$label]['grid_opts'] = $grid_opts;
$weathermapper[$label]['search_opts'] = [];
$weathermapper[$label]['search_opts']['types'] = ['group'];
$weathermapper[$label]['search_opts']['groups'] = [];
$weathermapper[$label]['search_opts']['groups'][] = [
'group' => 6,
'row' => 10
];
$label = 'mylabel';
$weathermapper[$label] = [];
$weathermapper[$label]['title'] = "Network Map (".$label.")";
$weathermapper[$label]['grid_opts'] = $grid_opts;
$weathermapper[$label]['search_opts'] = [];
$weathermapper[$label]['search_opts']['types'] = ['location'];
$weathermapper[$label]['search_opts']['locations'] = [];
$weathermapper[$label]['search_opts']['locations'][] = [
'regex' => "MYSITE[0-9}+",
'row' => 10
];