The following was the steps required to have opConfig collect data from a MikroTik CHR device.
Before you Begin
Ensure you have access to a device and are able to manually SSH or telnet to it and that you are authorised to do so.
You need to know something about the device you want to add support for, ideally it should already be in NMIS and then you will know a great deal about the device.
We will need to know:
- who the vendor is
- what the operating system is commonly called
Looking at the node in NMIS will help you here, e.g.
Access the devices
So access the device and see what happens. We are wanting to learn how the device works, so we can teach opConfig how to handle it.
Access using SSH
Access using Telnet
Create a Credential Set based on how you logged in
Now you know how you logged in, create a credential set to match this. To do this navigate to menu -> System -> Edit Credential Sets. What is important to note here is that this device only required a single password and does not use a privileged mode (root in Linux, enable in Cisco). So the new setting (introduced in opConfig 3.0.2), is "Automatically Privileged" for this node this should be set to "Yes".
Create an OS Rule
So that opConfig knows what the OS and other things, you will need to decide a few things, and then create an OS rule which will set these. OS rules enable opConfig to automatically discover what to do with a device.
The file to edit is /usr/local/omk/conf/OS_Rules.nmis, at the end of the base configuration is some documentation, included in the appendix below.
A quick look at the MikroTik device in NMIS showed that the Description field which is the SNMP variable sysDescr was "RouterOS CHR", this will be the basis for our OS Rule for MikroTik devices.
So we will be adding two properties, the OS and the phrasebook, the OS tells opConfig which Command Set to use and the phrasebook tells opConfig how to talk to the router.
This rule is saying, if I see the regular expression /RouterOS/ match in the field sysDescr, then set the following properties of the node.
Import the node into opConfig
Access the menu in opConfig and import the node, you can do this from the menu "System -> Edit Nodes", then look for the blue button "Import new Nodes from NMIS".
Find the node and edit it in opConfig, you should see a screen like below, this indicates that the OS and personality have been set, you can see them by selecting "Connection" and "OS Info" on the left. If they are not set, you can edit the OS rule and press the "Refresh Node from NMIS" until they are set.
Create a Phrasebook
More information about phrase books: opConfig custom phrasebook and personality
To tell opConfig how to talk to a device, you need a a phrasebook, this is helping the system to know what to do.
Most of the time, devices behave just like Cisco devices, so you can always try the ios phrasebook, but it isn't too hard to create, we learnt by accessing the device that the there could be a "Login:" and "Password:" prompts, depending on how the system is accessed.
The base phrasebook was created in /usr/local/omk/conf/phrasebooks/, a new folder was created mikrotik with a sub directory of routeros, under this a file pb was created, the complete path of the file was /usr/local/omk/conf/phrasebooks/mikrotik/routeros/pb.
More information on creating a Phrasebook can be found HERE: opConfig custom phrasebook and personality
Test the Work So Far
The best way to test everything is to run a discovery on the node, this will match credential set and test the phrasebook, to run that we would run the command:
/usr/local/omk/bin/opconfig-cli.pl act=discover node=mik debug=1
Creating a Command Set
Now you need to create a command set to tell opConfig what to collect from opConfig, this is documented in Managing Command Sets
Appendix A: OS Rules Help Text