librenms / docker

LibreNMS Docker image
MIT License
692 stars 280 forks source link

Custom Interface Description Parsing not work #412

Open CopyBook-Maxim opened 11 months ago

CopyBook-Maxim commented 11 months ago

Support guidelines

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

Description

Custom Interface Description Parsing not work. If you specify the path to the custom parser in the settings, it will not be used. At the same time the parser itself works, it was checked in the interpreter. Also, if you add port_descr_type and port_descr_descr directly to the database, the charts are displayed

Expected behaviour

Must be used Custom Interface Description Parser

Actual behaviour

Custom Interface Description Parsing not used

Steps to reproduce

1 Create a custom parser 2 Specify it in the settings 3 Graphics with description from the example (Transit: Example Provider (AS65000)) get into ports

Docker info

@librenms:/var/librenms$ sudo docker info

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

Server:
 Containers: 7
  Running: 7
  Paused: 0
  Stopped: 0
 Images: 5
 Server Version: 23.0.3
 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: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc version: v1.1.5-0-gf19387a
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-73-generic
 Operating System: Ubuntu 22.04.2 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 7.763GiB
 Name: librenms
 ID: 2436490e-5b8b-40d9-a3ed-437e9f7ee3ae
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

Docker Compose config

No response

Logs

-

Additional info

No response

CopyBook-Maxim commented 9 months ago

Any update?

murrant commented 9 months ago

Custom Interface Description parsing is easy to break. You didn't say:

  1. what you are trying to do (including any configurations set and any custom parsing files)
  2. your expected outcome
  3. the actual outcome
CopyBook-Maxim commented 9 months ago

Custom Interface Description parsing is easy to break. You didn't say:

  1. what you are trying to do (including any configurations set and any custom parsing files)
  2. your expected outcome
  3. the actual outcome

1. I am trying to do parsing of the UI description. I created the file /opt/librenms/includes/custom/my-port-descr-parser.inc.php

librenms:/opt/librenms/includes/custom# ls -la
total 12
drwxr-xr-x 2 nobody nogroup 4096 Dec 28 10:35 .
drwxr-xr-x 1 nobody nogroup 4096 Dec 28 10:08 ..
-rw-r--r-- 1 nobody nogroup  653 Dec 28 10:35 my-port-descr-parser.inc.php

File Configuration:

<?php

// Parser should populate $port_ifAlias array with type, descr, circuit, speed and notes
unset($port_ifAlias);

echo $this_port['ifAlias'];

$split = preg_split('/#/', $this_port['ifAlias']);
$type = trim($split[1]);
$descr = trim($split[0]);

$circuit = null;
$notes = null;
$speed = null;

if ($type && $descr) {
    $type = strtolower($type);
    $port_ifAlias['type'] = $type;
    $port_ifAlias['descr'] = $descr;
    $port_ifAlias['circuit'] = $circuit;
    $port_ifAlias['speed'] = $speed;
    $port_ifAlias['notes'] = $notes;

    d_echo($port_ifAlias);
}

unset($port_type, $port_descr, $port_circuit, $port_notes, $port_speed, $split);
vi config.php

# custom int_descr_parsing
$config['port_descr_parser'] = "includes/custom/my-port-descr-parser.inc.php";

image

2. Expected Outcome: There will be graphs in the Ports -> Transit menu.

3. Current result: No graphs.

brk1234 commented 9 months ago

Hello, I am having this same issue with my custom interface parsing script. It doesn't seem to be working!

CopyBook-Maxim commented 9 months ago

Up

CopyBook-Maxim commented 8 months ago

Up

CopyBook-Maxim commented 8 months ago

Any update pls