javascriptnode.jsmikrotikrouter-os

How connect to multiple mikrotik at the same time?


I can't figure out how to create more than one api connection to microtics (I have more than 20 of them) using routeros-client at the same time. Is it possible to somehow connect a config with parameters and credentials? I will be glad to any advice and tips

const RouterOSClient = require('routeros-client').RouterOSClient;

const api = new RouterOSClient({
host: '',
user: '',
password: '',
})

Solution

  • Problem solved in such way: Firstly there was created config.yml, then defined variables and use forEach() method.

    const yaml_config = require('node-yaml-config');
    const config = yaml_config.load(__dirname + '/config/host.yml');