Error: We couldn't retrieve the device information from Oxidized

I have been struggling for some time to get my head around a problem I’m having getting oxidized to interface with Librenms.
Validate is good, curl to oxidized works. No firewall installed. Librenms works perfectly, oxidized gets the switch config and stores it in a git repository. I can read the repository and confirm that the switch configuration is correct. I haven’t tried versioning yet though.

The problem is, I open the switch device in Librenms, I now have a ‘Config’ tab but it comes back with an error:“We couldn’t retrieve the device information from Oxidized”. The only thing that looks wrong to me is I can’t get the Librenms YAML checker to work. My config is good on other YAML checkers. My config file always has the error: Tags support is not enabled. Enable the
“Yaml::PARSE_CUSTOM_TAGS” flag to use “!ruby/regexp” at line 13 (near “prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/”). I tried other configurations I found in searches and they also return the same error. I’m guessing it isn’t my oxidized config file that is the issue, but something else. My installation is based on the Ubuntu 18.04 OVA VM and updated to 1.67.

  1. librenms@librenms:~$ ./validate.php
  2. ====================================
  3. Component | Version
  4. --------- | -------
  5. LibreNMS | 1.67-8-g661a518de
  6. DB Schema | 2020_08_28_212054_drop_uptime_column_outages (173)
  7. PHP | 7.4.9
  8. Python | 3.6.9
  9. MySQL | 10.1.44-MariaDB-0ubuntu0.18.04.1
  10. RRDTool | 1.7.0
  11. SNMP | NET-SNMP 5.7.3
  12. ====================================
  • [OK] Composer Version: 1.10.10
  1. [OK] Dependencies up-to-date.
  2. [OK] Database connection successful
  3. [OK] Database schema correct

My configs


Thanks

Good morning and welcome to the community.

I’m reviewing your config and…maybe I missed it but in your config.php I do not see any settings to enable oxidized, yet if you’re getting an oxidized tab in the web interface, it’s obviously turned on. I would have expected to see something like:

#########oxidized###########
$config[‘oxidized’][‘enabled’] = TRUE;
$config[‘oxidized’][‘url’] = ‘http://127.0.0.1:8888’;
$config[‘oxidized’][‘features’][‘versioning’] = true;
$config[‘oxidized’][‘reload_nodes’] = true;
$config[‘oxidized’][‘group_support’] = true;
$config[‘oxidized’][‘default_group’] = ‘default’;

which I don’t see in the config…also, you may want to sanitize your posting of passwords etc. it’s just a good practice nowadays.

@wysedata

Wyse - it looks to me like your oxidized is setup to work independently of the librenms api. I see the following in your config:

source:
default: csv
csv:
file: “/home/oxidized/.config/oxidized/router.db”
delimiter: !ruby/regexp /:confused:
map:
name: 0
model: 1
gpg: false

this configuration is saying that it’s using /home/oxidized/.config/oxidized/router.db as the source file for a list of devices to back up.

Your configuration should look something like this:

source:
default: http
debug: false
http:
url: http://127.0.0.1/api/v0/oxidized #if oxidized is on another machine the url would reflect that
map:
name: hostname
model: os
group: group
username: default_username
password: default_password
headers:
X-Auth-Token: ‘your_api_token’

Hi Killo
Thanks for your responses.
I did have the source setup for Librenms via http, but after I couldn’t get it to work, I tried using the router.db, which did work, at least to the point that it would pull the switch configuration, but Librenms still couldn’t show the config in the tab. I’ll change the source back and post some outputs.

Re the security, this is a test vm, using my own switch, so any revealed passwords are only short lived.

OK, I setup source as http.
See below, curl works, though I am not sure about one thing. It only works with the librenms user token. I also have a user called oxidized, but using that token fails curl.
librenms@librenms:~$ curl -H ‘X-Auth-Token: My-librenms-user-Token’ http://127.0.0.1/api/v0/oxidized
[
{
“hostname”: “localhost”,
“os”: “linux”,
“ip”: “127.0.0.1”
},
{
“hostname”: “192.168.1.1”,
“os”: “draytek”,
“ip”: “”
},
{
“hostname”: “hp2920”,
“os”: “procurve”,
“ip”: “192.168.1.24”
}

using Chrome on my PC returns:
http://192.168.1.31/api/v0/oxidized
{“message”:“Unauthenticated.”}

What about the fact that my YAML doesn’t pass? Is that a known issue? Like I said in a previous post, I get the same error with any ‘known’ working config that I’ve dug up via searches, but using online YAML checkers, it passes.

lastly, re the hard oxidized configuration the in librenms.conf file, I don’t believe it is necessary because I have control over all of those settings from with the Librenms GUI. Am I right? If I set them in the config file, they are grayed out in the GUI.

I have never used the YAML checker. I cannot speak to how good or bad it is.

+I created an oxidized user in librenms with global read permissions and assigned an API key for this user.
+I run oxidized and librenms on the same machine, I think that you do also but if you do not please let me know.
+from the librenms server, run curl command using the oxidized user api key to ensure it’s functioning correctly. If not, we have to figure out why. If you are trying to curl from your PC, I would guess it’s not working due to security, possibly firewall or web server configuration. This should not be a problem as far as I know and can tell – in most configuration librenms and oxidized are on the same machine so they are talking to themselves via 127.0.0.1/api/v0/oxidized - there’s no reason for any external systems to use the librenms api unless you are doing some separate integration.

+once you verify that the librenms api key is working via shell on librenms server, put the key into your oxidized configuration file.

+I moved from observium to librenms, i mostly use the /opt/librenms/config.php file to make changes instead of the gui. Because I think that not all of the options are available in the GUI.

Do you have mostly procurve / hp / aruba switches? We do also. I have a working config that should work for you if we can get through a few things.

Here’s what I have in /opt/librenms/config.php

#########oxidized###########
$config[‘oxidized’][‘enabled’] = TRUE;
$config[‘oxidized’][‘url’] = ‘http://127.0.0.1:8888’;
$config[‘oxidized’][‘features’][‘versioning’] = true;
$config[‘oxidized’][‘reload_nodes’] = true;
$config[‘oxidized’][‘group_support’] = true;
$config[‘oxidized’][‘default_group’] = ‘default’;

here is what I have in my /etc/oxidized/config (I changed the location for this file)


username: my_username
password: my_password
model: procurve
resolve_dns: false
interval: 3600
use_syslog: false
debug: false
threads: 30
timeout: 20
retries: 3
prompt: !ruby/regexp /^([\w.@-]+[#>]\s?)$/
rest: 127.0.0.1:8888
next_adds_job: true
vars: {}
groups: {}
models: {}
pid: “/home/oxidized/pid”
crash:
directory: “/etc/oxidized/crashes”
hostnames: false
stats:
history_size: 10
input:
default: ssh, telnet
debug: false
ssh:
secure: false
ftp:
passive: true
utf8_encoded: true
source:
default: http
debug: false
http:
url: http://127.0.0.1/api/v0/oxidized
map:
name: hostname
model: os
group: group
username: my_username
password: my_password
headers:
X-Auth-Token: ‘oxidized_global_read_api_key’

output:
default: git
default: git
git:
user: oxidized
email: [email protected]
repo: “var/git/network-backups/.git”

model_map:
arubaos: hp

groups:
fortios:
username: my_username
password: my_password
model: fortios

default:
username: my_username
password: my_password
model: procurve

Problem solved. The oxidized config was encoded to ANSI, not UTF-8. I copied a config from a web page, and as a result, the YAML checker was objecting to everything. I still had a hell of a time changing it. I used notepad++ to change the encoding, but I still had issues. I ended up editing an original config file .

good thinking! Glad you got it sorted out.