librenms / docker

LibreNMS Docker image
MIT License
691 stars 278 forks source link

Perl Monitoring Plugin #381

Open einardivision opened 1 year ago

einardivision commented 1 year ago

Support guidelines

I've found a bug and checked that ...

Description

Im trying to write a custom monitoring plugin but i am having trouble installing the Perl Monitoring::Plugin module.

Can't locate Monitoring/Plugin.pm in @INC (you may need to install the Monitoring::Plugin module) (@INC contains: /usr/local/lib/perl5/site_perl /usr/local/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/lib/monitoring-plugins/check_battery_new.pl line 11. BEGIN failed--compilation aborted at /usr/lib/monitoring-plugins/check_battery_new.pl line 11.

Im running LibreNMS using Docker compose

Expected behaviour

The script will use sockets to communicate via TCP->Serial and decode the received data. Then it will output the performance data for me to add into graphs.

Actual behaviour

The script should run

Steps to reproduce

Try to use the Monitoring Plugin module

https://metacpan.org/dist/Monitoring-Plugin

Docker info

Client:
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.10.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-buildx.exe
  compose: Docker Compose (Docker Inc.)
    Version:  v2.17.3
    Path:     C:\Program Files\Docker\cli-plugins\docker-compose.exe
  dev: Docker Dev Environments (Docker Inc.)
    Version:  v0.1.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-dev.exe
  extension: Manages Docker extensions (Docker Inc.)
    Version:  v0.2.19
    Path:     C:\Program Files\Docker\cli-plugins\docker-extension.exe
  init: Creates Docker-related starter files for your project (Docker Inc.)
    Version:  v0.1.0-beta.4
    Path:     C:\Program Files\Docker\cli-plugins\docker-init.exe
  sbom: View the packaged-based Software Bill Of Materials (SBOM) for an image (Anchore Inc.)
    Version:  0.6.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-sbom.exe
  scan: Docker Scan (Docker Inc.)
    Version:  v0.26.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scan.exe
  scout: Command line tool for Docker Scout (Docker Inc.)
    Version:  v0.10.0
    Path:     C:\Program Files\Docker\cli-plugins\docker-scout.exe

Server:
 Containers: 19
  Running: 15
  Paused: 0
  Stopped: 4
 Images: 59
 Server Version: 23.0.5
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: cgroupfs
 Cgroup Version: 1
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  seccomp
   Profile: builtin
 Kernel Version: 5.10.102.1-microsoft-standard-WSL2
 Operating System: Docker Desktop
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 15.59GiB
 Name: docker-desktop
 ID: b394a179-840a-4d9d-a748-225c64003c66
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 HTTP Proxy: http.docker.internal:3128
 HTTPS Proxy: http.docker.internal:3128
 No Proxy: hubproxy.docker.internal
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  hubproxy.docker.internal:5555
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: No blkio throttle.read_bps_device support
WARNING: No blkio throttle.write_bps_device support
WARNING: No blkio throttle.read_iops_device support
WARNING: No blkio throttle.write_iops_device support

Docker Compose config

No response

Logs

.

Additional info

No response

einardivision commented 1 year ago

I've figured out how to install the module by doing these steps:

First we exec into the librenms container: docker exec -it librenms bash

Then we install the following: apk add perl-dev apk add perl-app-cpanminus apk add alpine-sdk cpanm Monitoring::Plugin

Perhaps we could add to the documentation some examples. One thing i haven't figured out is how to persist these changes across docker restarts. I need to run these commands after every restart of container