Unable to get oxidized working with librenms

Tags: #<Tag:0x00007f70700a6f80>

Hi Folks,

trying to get oxidized working with librenms as a source with the http-api.
Running oxidized with CVS source is working.

oxidized always fails with the following messages:

[email protected]:/usr/local/oxidized# su - oxidized -c 'OXIDIZED_HOME=/usr/local/oxidized oxidized -d'
cannot interpret as DNS name: nil
Traceback (most recent call last):
        26: from /usr/local/bin/oxidized:23:in `<main>'
        25: from /usr/local/bin/oxidized:23:in `load'
        24: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/bin/oxidized:8:in `<top (required)>'
        23: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/cli.rb:13:in `run'
        22: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in `new'
        21: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in `new'
        20: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in `initialize'
        19: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in `new'
        18: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:125:in `initialize'
        17: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:10:in `load'
        16: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in `with_lock'
        15: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in `synchronize'
        14: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in `block in load'
        13: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in `each'
        12: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in `block (2 levels) in load'
        11: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in `new'
        10: from /var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:19:in `initialize'
         9: from /usr/lib/ruby/2.7.0/resolv.rb:93:in `getaddress'
         8: from /usr/lib/ruby/2.7.0/resolv.rb:115:in `each_address'
         7: from /usr/lib/ruby/2.7.0/resolv.rb:115:in `each'
         6: from /usr/lib/ruby/2.7.0/resolv.rb:116:in `block in each_address'
         5: from /usr/lib/ruby/2.7.0/resolv.rb:402:in `each_address'
         4: from /usr/lib/ruby/2.7.0/resolv.rb:507:in `each_resource'
         3: from /usr/lib/ruby/2.7.0/resolv.rb:521:in `fetch_resource'
         2: from /usr/lib/ruby/2.7.0/resolv.rb:1116:in `resolv'
         1: from /usr/lib/ruby/2.7.0/resolv.rb:1087:in `generate_candidates'
/usr/lib/ruby/2.7.0/resolv.rb:1247:in `create': cannot interpret as DNS name: nil (ArgumentError)

[email protected]:/usr/local/oxidized# cat crash
--------------------------------------------------
2021-02-18 07:45:34 UTC
cannot interpret as DNS name: nil [ArgumentError]
--------------------------------------------------
/usr/lib/ruby/2.7.0/resolv.rb:1247:in `create'
/usr/lib/ruby/2.7.0/resolv.rb:1087:in `generate_candidates'
/usr/lib/ruby/2.7.0/resolv.rb:1116:in `resolv'
/usr/lib/ruby/2.7.0/resolv.rb:521:in `fetch_resource'
/usr/lib/ruby/2.7.0/resolv.rb:507:in `each_resource'
/usr/lib/ruby/2.7.0/resolv.rb:402:in `each_address'
/usr/lib/ruby/2.7.0/resolv.rb:116:in `block in each_address'
/usr/lib/ruby/2.7.0/resolv.rb:115:in `each'
/usr/lib/ruby/2.7.0/resolv.rb:115:in `each_address'
/usr/lib/ruby/2.7.0/resolv.rb:93:in `getaddress'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/node.rb:19:in `initialize'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in `new'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:21:in `block (2 levels) in load'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in `each'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:16:in `block in load'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in `synchronize'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:130:in `with_lock'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:10:in `load'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/nodes.rb:125:in `initialize'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in `new'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:14:in `initialize'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in `new'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/core.rb:4:in `new'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/lib/oxidized/cli.rb:13:in `run'
/var/lib/gems/2.7.0/gems/oxidized-0.28.0/bin/oxidized:8:in `<top (required)>'
/usr/local/bin/oxidized:23:in `load'
/usr/local/bin/oxidized:23:in `<main>'
--------------------------------------------------

[email protected]:/usr/local/oxidized# cat /var/log/oxidized/oxidized.log
# Logfile created on 2021-02-18 08:45:34 +0100 by logger.rb/v1.4.2
I, [2021-02-18T08:45:34.054720 #359864]  INFO -- : Oxidized starting, running as pid 359864
I, [2021-02-18T08:45:34.143540 #359864]  INFO -- : lib/oxidized/nodes.rb: Loading nodes
D, [2021-02-18T08:45:34.203970 #359864] DEBUG -- : resolving DNS for ...
D, [2021-02-18T08:45:34.204030 #359864] DEBUG -- : IPADDR
F, [2021-02-18T08:45:34.204310 #359864] FATAL -- : Oxidized crashed, crashfile written in /usr/local/oxidized/crash

Here is my oxidized config:
(as stated above, replacing the source http with source cvs and oxidized is working)

[email protected]:/usr/local/oxidized# cat config
---
username: USER
password: PASSWORD
model: IronWare
resolve_dns: true
interval: 3600
log: /var/log/oxidized/oxidized.log
use_syslog: false
debug: ture
threads: 30
timeout: 20
retries: 3
prompt: !ruby/regexp /^([\[email protected]]+[#>]\s?)$/
rest: 127.0.0.1:8888
next_adds_job: false
vars: {}
groups: {}
models: {}
pid: "/var/run/oxidized/pid"
crash:
  directory: "/usr/local/oxidized/crashes"
  hostnames: true
stats:
  history_size: 10
input:
  default: ssh, telnet
  debug: false
  ssh:
    secure: false
  ftp:
    passive: true
  utf8_encoded: true
output:
  default: git
  git:
      user: Oxidized
      email: [email protected]
      repo: "/usr/local/oxdized/oxidized.git"
source:
  default: http
  debug: true
  http:
    url: http://lnms-server/api/v0/oxidized
    scheme: http
    secure: false
  map:
    name: hostname
    model: os
    ip: ip
    group: group
  headers:
    X-Auth-Token: 'AUTHTOKENHERE'
model_map:
  IronWare: ironware
  NOS: nos

My LibreNMS config-part for oxidized:

[email protected]:/usr/local/oxidized# cat /opt/librenms/config.php
$config['oxidized']['enabled'] = TRUE;
$config['oxidized']['url'] = 'http://127.0.0.1:8888';
$config['oxidized']['features']['versioning'] = true;
$config['oxidized']['group_support'] = true;
$config['oxidized']['default_group'] = 'default';
$config['oxidized']['reload_nodes'] = true;

and this is the api output via curl:

[email protected]:/usr/local/oxidized# curl -H "X-Auth-Token: AUTHTOKENHERE" http://lnms-server/api/v0/oxidized
[
    {
        "hostname": "host1.domain.tld",
        "os": "ironware",
        "ip": "10.1.1.100",
        "group": "default"
    },
    {
        "hostname": "host2",
        "os": "asa",
        "ip": "10.10.1.10",
        "group": "default"
    },
<-- shortened -->
    {
        "hostname": "hostX",
        "os": "airos",
        "ip": "10.12.1.13",
        "group": "default"
    }
]

I have no idea whats going wrong here.

Running LibreNMS version 21.2.0-1-g01019cfc0 on Ubuntu 20.04 (was upgraded from 18.04 yesterday while trying to get oxidized running)

Thanks in advance for any helpfull comment :wink: