Getting groups configured with API

So I have Oxidized up and running, but trying to get my different devices in the specific groups because they have different logins per group.
Here is the lines I added to my config.php
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘ios’, ‘group’ => ‘cisco_routers_switches’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘routeros’, ‘group’ => ‘mikrotik’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘edgeos’, ‘group’ => ‘ubiquiti_routers’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘edgeswitch’, ‘group’ => ‘ubiquiti_switchess’);

And here is my oxidized config
#username: the_user
#password: the_password
interval: 3600
log: ~/.config/oxidized/log
use_syslog: false
debug: true
threads: 30
timeout: 20
retries: 1
prompt: !ruby/regexp /^([\[email protected]]+[#>]\s?)$/
rest: 0.0.0.0:8787
pid: /home/oxidized/.config/oxidized/pid
vars: {}
groups:
cisco_routers_switches:
username: nil
password: the_password
vars:
remove_secret: true
ssh_port: 22
ubiquiti_routers:
username: the_user
password: the_password
vars:
remove_secret: true
ssh_port: the_port#
ubiquiti_switches:
username: the_user
password: the_password
vars:
remove_secret: true
ssh_port: the_port#
mikrotik:
username: the_user
password: the_password
vars:
remove_secret: true
ssh_port: the_port#
input:
default: ssh
debug: false
ssh:
secure: false

output:
  default: file
  file:
    directory: /home/oxidized/deviceconfigs

source:
  default: http
  http:
    url: https://hostname/api/v0/oxidized
    map:
      name: hostname
      model: os
      ip: ip
      group: group
    vars_map:
      enable: enable
    headers:
      X-Auth-Token: '4<myauthtoken>'

models:
  mikrotik:
  cisco:
  ubiquiti_routers:
  ubiquiti_switches:

model_map:
  cisco: ios
  mikrotik: routeros
  ubiquiti_routers: edgeos
  ubiquiti_switches: edgeswitch

When watching logs I get the following for the devices.
raised Net::SSH::AuthenticationFailed with msg "Authentication failed for user [email protected]

If I uncomment the top username and password it will work for some of my devices but not all because we have different ports and users configured.

Main take out is my group section setup correctly?
Is there any syntax with number of spaces or tabs that will make a difference?

Thanks for feedback and help.

I have solved this by finding a syntax in my config.php
I was using the tick.
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘ios’, ‘group’ => ‘cisco_routers_switches’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘routeros’, ‘group’ => ‘mikrotik’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘edgeos’, ‘group’ => ‘ubiquiti_routers’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘edgeswitch’, ‘group’ => ‘ubiquiti_switchess’);

Instead I should have had.
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘ios’, ‘group’ => ‘cisco_routers_switches’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘routeros’, ‘group’ => ‘mikrotik’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘edgeos’, ‘group’ => ‘ubiquiti_routers’);
$config[‘oxidized’][‘maps’][‘group’][‘os’][] = array(‘match’ => ‘edgeswitch’, ‘group’ => ‘ubiquiti_switches’);

then I added
model: cisco
model: ubiquiti_routers
model: ubiquiti_switches
model: mikrotik
Under each group. I am now able to pull configs down.

1 Like