librenms / docker

LibreNMS Docker image
MIT License
684 stars 278 forks source link

InvalidRrdTypeException on sensors module #395

Closed radokristof closed 1 year ago

radokristof commented 1 year ago

Support guidelines

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

Description

Sensor module is not working on any device inside LibreNMS. On the GUI it is showing "No Data file xy.rrd"

In the event log, I can see the event on every poll: Error polling sensors module. Check log file for more details.

This is only the case for "sensor" graphs, other graphs are drawn correctly and even sensor current data is visible, but the graph is not working.

Expected behaviour

Sensor files should be created and graphs should be drawn as other modules do.

Actual behaviour

No graphs files, errors in log.

Steps to reproduce

For me it happens with every device which has some kind of additional sensor.

Docker info

Client: Docker Engine - Community
 Version:    24.0.6
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.11.2
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.21.0
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 28
  Running: 27
  Paused: 0
  Stopped: 1
 Images: 26
 Server Version: 24.0.6
 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: systemd
 Cgroup Version: 2
 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: 8165feabfdfe38c65b599c4993d227328c231fca
 runc version: v1.1.8-0-g82f18fe
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-1041-kvm
 Operating System: Ubuntu 22.04.3 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 6
 Total Memory: 13.67GiB
 Name: marinero-m02
 ID: KOYP:2W5C:NAC7:7CD3:SLFN:B7VM:6ITH:SKWT:2NDT:H2CW:VI6O:3R5A
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false
 Default Address Pools:
   Base: 192.168.0.0/16, Size: 24

Docker Compose config

librenms:
    image: librenms/librenms:latest
    container_name: librenms
    hostname: librenms
    cap_add:
      - NET_ADMIN
      - NET_RAW
    ports:
      - "8000:8000"
    depends_on:
      - db
      - redis
    volumes:
      - "./librenms:/data"
      - "./opt:/opt/librenms"
    env_file:
      - "./librenms.env"
    environment:
      - "TZ=${TZ}"
      - "PUID=${PUID}"
      - "PGID=${PGID}"
      - "DB_HOST=${MYSQL_HOST}"
      - "DB_NAME=${MYSQL_DATABASE}"
      - "DB_USER=${MYSQL_USER}"
      - "DB_PASSWORD=${MYSQL_PASSWORD}"
      - "DB_TIMEOUT=${MYSQL_TIMEOUT}"
      - "LISTEN_IPV6=false"
      - "LIBRENMS_BASE_URL=network.marinero.cloud"
      - "REAL_IP_FROM=192.168.0.0/16"
      - "LOG_IP_VAR=http_x_forwarded_for"
    restart: always

Logs

Validate:
====================================
Component | Version
--------- | -------
LibreNMS  | 22.7.0
DB Schema | 2022_07_19_081224_plugins_unique_index (243)
PHP       | 8.1.17
Python    | 3.10.10
MySQL     | 10.4.29-MariaDB-1:10.4.29+maria~ubu2004
RRDTool   | 1.7.2
SNMP      | 5.9.3
====================================

[OK]    Installed from the official Docker image; no Composer required
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]
[OK]    Database schema correct
[OK]    MySQl and PHP time match
[INFO]  fping FAILURES can be ignored if running LibreNMS in a jail without ::1. You may want to test it manually: fping ::1
[FAIL]  /usr/sbin/fping6 could not be executed. /usr/sbin/fping6 must have CAP_NET_RAW capability (getcap) or suid. Selinux exclusions may be required.
 (/usr/sbin/fping: can't create socket (must run as root?))
[FAIL]  /usr/sbin/fping6 should have CAP_NET_RAW!
        [FIX]:
        setcap cap_net_raw+ep /usr/sbin/fping6
[OK]    rrd_dir is writable
[OK]    rrdtool version ok
[WARN]  Updates are managed through the official Docker image

Error in log:
[2023-06-06T11:24:01.773560+02:00] production.ERROR: Error polling sensors module for 10.0.13.1. LibreNMS\Exceptions\InvalidRrdTypeException:  is not valid, must be: GAUGE | DERIVE | COUNTER | ABSOLUTE | DCOUNTER | DDERIVE in /opt/librenms/LibreNMS/RRD/RrdDefinition.php:122
Stack trace:
#0 /opt/librenms/LibreNMS/RRD/RrdDefinition.php(65): LibreNMS\RRD\RrdDefinition->checkType()
#1 /opt/librenms/includes/polling/functions.inc.php(189): LibreNMS\RRD\RrdDefinition->addDataset()
#2 /opt/librenms/includes/polling/functions.inc.php(135): record_sensor_data()
#3 /opt/librenms/includes/polling/sensors.inc.php(28): poll_sensor()
#4 /opt/librenms/includes/polling/functions.inc.php(340): include('...')
#5 /opt/librenms/poller.php(126): poll_device()
#6 {main}
[2023-06-06T11:24:01.782259+02:00] production.ERROR:  is not valid, must be: GAUGE | DERIVE | COUNTER | ABSOLUTE | DCOUNTER | DDERIVE {"exception":"[object] (LibreNMS\\Exceptions\\InvalidRrdTypeException(code: 0):  is not valid, must be: GAUGE | DERIVE | COUNTER | ABSOLUTE | DCOUNTER | DDERIVE at /opt/librenms/LibreNMS/RRD/RrdDefinition.php:122)"}

Additional info

No response

murrant commented 1 year ago

Which sensor is causing this?

radokristof commented 1 year ago

Well, "power" sensors, "voltage", "dBm" for optical modules, temperature. Basically anything under "Health" except processor, memory, disk usage

radokristof commented 1 year ago

Ok, it seems it was also related to https://github.com/librenms/docker/issues/394 After this change, graphs started to work...