PHP code example of drakelid / librenms-weather-risk-map-widget

1. Go to this page and download the library: Download drakelid/librenms-weather-risk-map-widget library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

drakelid / librenms-weather-risk-map-widget example snippets


$config['update'] = 0;

'sensitivity' => [
    'enabled' => true,
    'profiles' => [
        'tower' => [
            'label'   => 'Radio / tower sites',
            'groups'  => [3, 7],
            'hazards' => ['wind' => 1, 'lightning' => 1, 'icing' => 1],
        ],
        'cabinet' => [
            'label'   => 'Outdoor cabinets',
            'groups'  => [11],
            'hazards' => ['heat' => 1, 'cold' => 1, 'flood' => 1],
        ],
        'datacentre' => [
            'label'   => 'Core datacentres',
            'groups'  => [1],
            'hazards' => ['wind' => -1],
        ],
    ],
],
sh
php artisan optimize:clear
sh
php artisan optimize:clear
sh
  sudo systemctl reload php8.2-fpm    # match your PHP version
  
sh
# crontab, as the librenms user - match --radius to your widget setting
*/10 * * * * /usr/bin/php /opt/librenms/artisan weather-risk-map:warm --radius=10 --quiet-success
sh
php /opt/librenms/composer.phar install

PHPUnit 11.5.56    Runtime: PHP 8.4.24
OK (110 tests, 264 assertions)