Community discussions

MikroTik App
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Topic Author
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Programmatically adjust devices?

Wed Apr 03, 2019 1:17 am

Dear all,

is there a way (through script, API or whatsoever) to bulk-update device custom fields?
We have a map with thousands of devices and need to fill custom fields based on either MAC address, device name or IP address.

Any hint is highly appreciated.
Thanks,
-Chris
 
sid5632
Long time Member
Long time Member
Posts: 554
Joined: Fri Feb 17, 2017 6:05 pm

Re: Programmatically adjust devices?

Wed Apr 03, 2019 1:45 am

No. The interface has never been finished. It's pretty poor really.
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Topic Author
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Programmatically adjust devices?

Wed Apr 03, 2019 1:46 am

What a bummer - thanks.
Time to get an apprentice working on updating ~2000 devices with three fields each...
-Chris
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Topic Author
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Programmatically adjust devices?

Wed Apr 03, 2019 2:02 am

Update:
A colleague of mine is currently writing a Python script that remote controls chrome that then cycles through WebFig where we have access to all relevant device fields in the dude.
Will share the outcome once we have what we need.

-Chris
 
User avatar
vecernik87
Forum Veteran
Forum Veteran
Posts: 882
Joined: Fri Nov 10, 2017 8:19 am

Re: Programmatically adjust devices?

Wed Apr 03, 2019 9:31 am

... writing a Python script that remote controls chrome that then cycles through WebFig ...
good thinking. It is sad that there is no developer assigned to focus on TheDude. The idea of this system is wonderful, but lack of development unfortunately creates significant obstacles for serious use.
 
User avatar
antispam
Frequent Visitor
Frequent Visitor
Posts: 63
Joined: Mon Apr 11, 2005 5:57 pm

Re: Programmatically adjust devices?

Thu Apr 04, 2019 8:47 am

All that concerns mass mailing, that you must use bulk mail software. This is a very promising software, aimed at the result. Just [removed link].
Last edited by krisjanisj on Thu Apr 04, 2019 9:39 am, edited 1 time in total.
Reason: Removed links
 
thabassplayer
just joined
Posts: 2
Joined: Fri Dec 01, 2017 9:59 am

Re: Programmatically adjust devices?

Thu Apr 04, 2019 9:15 am

I’m working on a little tool that can bulk execute any command that you would be able to execute in the CLI.

DM me if you are interested.

-Ruben
 
User avatar
cdiedrich
Forum Veteran
Forum Veteran
Topic Author
Posts: 997
Joined: Thu Feb 13, 2014 2:03 pm
Location: Basel, Switzerland // Bremen, Germany
Contact:

Re: Programmatically adjust devices?

Thu Apr 04, 2019 5:47 pm

Hey Ruben,

that would be great, thank you very much.
DM is not supported here in the forum - feel free to contact me on cdiedrich (at) clairglobal.com

Thanks again,
-Chris
 
User avatar
NathanA
Forum Veteran
Forum Veteran
Posts: 829
Joined: Tue Aug 03, 2004 9:01 am

Re: Programmatically adjust devices?

Fri Apr 05, 2019 12:17 am

I’m working on a little tool that can bulk execute any command that you would be able to execute in the CLI.
`
...but isn't the exact problem being talked about here that The Dude has virtually no CLI access whatsoever? So what good would this do?

For example, try "/dude device print detail" or "/dude device set 0 <tab>" from the CLI and see what that gets you. Literally the only information you can get or set about a device object in The Dude from the CLI is its name. Period. It's absolutely useless. (And because ROS API mirrors the CLI in functionality, you can't use the API to do anything practical with your Dude database, either.)

Or am I misunderstanding and you are working on a tool that would essentially implement what you should be able to do via CLI if MikroTik had actually implemented it, not what you currently can do with the CLI?

Anyway, all of this is why I started diving into the format of the Dude database itself, so that I can read stuff out of it directly. You can see the initial results of this here: viewtopic.php?f=8&t=145928

Based on a feature request from a co-worker, I have since enhanced it (though haven't yet shared a new version outside of our office) to give you the option to only generate a list of "up" devices (devices that have a monitor of type "ping" that has a status of "up" instead of "down" or "acknowledged"). This requires finding and parsing the device object, its associated service objects, and cross-referencing the deviceID and serviceID with the latest row in the 'outages' table for that monitor.

I am even now running these scripts directly on my main Dude server, so that I don't have to "/dude export-db" first and copy the exported database off of the Dude server...I had to "jailbreak" RouterOS to accomplish this, and then compile/build a statically-linked PHP binary which can run directly on RouterOS. So now when I run my scripts, they are reading data directly out of the live/production Dude database in real-time.

Adding things to The Dude or changing things in it will be significantly more complex than just pulling data out, of course. You'd have to generate map objects in addition to service objects and service-to-device bindings (which are yet separate objects). At the moment I don't have the need to do this, so I'm unlikely to pursue it. Honestly, I'd rather just see MikroTik finish building out CLI access to The Dude. It's ridiculous that you can get or change virtually all of the information about a Dude object (other than its position on a map) in Winbox, but can't do so from the CLI.

-- Nathan

Who is online

Users browsing this forum: No registered users and 40 guests