PHP code example of drakelid / librenms-dashboard-widgets

1. Go to this page and download the library: Download drakelid/librenms-dashboard-widgets 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-dashboard-widgets example snippets

sql
SELECT COUNT(*) FROM sensors WHERE sensor_class='dbm' AND sensor_deleted=0;   -- optical
SELECT COUNT(*) FROM bgpPeers;                                                -- BGP
SELECT sensor_class, COUNT(*) FROM sensors WHERE sensor_deleted=0 GROUP BY 1; -- power
bash
./lnms plugin:add drakelid/librenms-dashboard-widgets '^1.0'
php artisan route:clear
php artisan view:clear
./lnms plugin:enable nmsdashwidgets
php artisan route:cache
dockerfile
ARG VERSION=librenms:26.8.1
FROM librenms/$VERSION

RUN echo $'#!/usr/bin/with-contenv sh\n\
set -e\n\
if [ "$SIDECAR_DISPATCHER" = "1" ] || [ "$SIDECAR_SYSLOGNG" = "1" ] || [ "$SIDECAR_SNMPTRAPD" = "1" ]; then\n\
  exit 0\n\
fi\n\
lnms plugin:add drakelid/librenms-dashboard-widgets\n\
php artisan route:clear\n\
' > /etc/cont-init.d/99-nmsdashwidgets.sh