Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

UCRM -> Mikrotik simple queue Sync PHP Script

Hi there, here a share a little script to sync UCRM and MIkrotik

 

Script to sync UCRM services with Mikrotik Queues. Searching in queues in Mikrotik by UCRM Ip Address Associated.
This Script is intended to replace de Mikrotik "queue type" values due i work with pcq queue types, but is easly to modify to just edit queue "max-limit" instead.
Actually V 1.0 designed by me, i'm php noob but this script works fine.
UCRM connect script copied from UBNT-Ondra on https://community.ubnt.com/t5/UCRM-Complete-WISP-Management/UCRM-API-example-script-to-reset-invoice...

Feel free to edit & improve this script, only one requirement, after improved upload and share it Man Wink

 

It's posted in GitHub

https://github.com/fgampel/Ucrm-Mkt-Queue-Sync

 

Hope it is usefull for you

New Member
Posts: 4
Registered: ‎01-09-2015
Kudos: 3

Re: UCRM -> Mikrotik simple queue Sync PHP Script

where should I load this script?

New Member
Posts: 11
Registered: ‎08-24-2014
Kudos: 2

Re: UCRM -> Mikrotik simple queue Sync PHP Script

where should I load this script?
Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Hi @estebanyunis826 & @eduardozabdiel ,

Script is a PHP based Script. you can load it in any Hosting with PHP support, or any own apache server.

For example i have a second docker on my same UCRM machine, where i have an apache server running.

 

You have to modify this script to addapt your system (IP - Credentials - ETC) and load it.

 

Any other cuestion let me know.

 

Man Wink

New Member
Posts: 11
Registered: ‎08-24-2014
Kudos: 2

Re: UCRM -> Mikrotik simple queue Sync PHP Script

THE SYSTEM WILL NOT HAVE NATIVE INTERFACE WITH MIKROTIK

New Member
Posts: 11
Registered: ‎08-24-2014
Kudos: 2

Re: UCRM -> Mikrotik simple queue Sync PHP Script


can you give me your email
Emerging Member
Posts: 60
Registered: ‎05-31-2011
Kudos: 21
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

ucrm_sync.png

Hi, I tried it. I can see the router shows the user logged in via api, but no queues are added. I also get the error above.

 

router : RB1110ahX2

routeros : 6.42.1

server : ubuntu 16.04 ( apache2, php 7.0)

Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Hi @mymanga, actually the Script is not verifing if the queue already exists, it search de queue by IP address and modify it.

While not verifing, it also us not adding new queues.

 

Fell free to modify and update te script for your convenience.

 

Actually i'm thinking to convert this script in a plugin so we can add it in new UCRM versions.

 

Kind regards

Emerging Member
Posts: 60
Registered: ‎05-31-2011
Kudos: 21
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Just started coding...in PHP. Don't know my way around. Been trying to debug. Any help appreciated. Was also thinking of using it as a plugin. Since just running a get on the file runs the configuration. Do you have a fix for this?
Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Sorry, but i can't fully understand you. what do you want to do?
Emerging Member
Posts: 60
Registered: ‎05-31-2011
Kudos: 21
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

I manually added a simple queue. The script just ignores it, it doesn't update it or anything..all it does is login and logout. Wondering if I'm missing something. Does this script actually do anything other than read UCRM data and echo it. I'm not seeing any functionality.

Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

The script reads the IP Address of the client device. You should charge the Device IP Address when you register the service in UCRM.
Then script reads such ip, compare it with all queues in mikrotik and updates the Simple Queue that match with such ip....
Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

it's working, i'm using it all days...
Emerging Member
Posts: 60
Registered: ‎05-31-2011
Kudos: 21
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

I noticed if there's a queue with the clients ip address , the script just says "client successfully updated" without throwing any errors. I manually added the simple queues with different upload and download speeds from those on UCRM.....the script ran without making any change. So I'm wondering what I'm I supposed to do get this running like you

Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Hi to all, sorry for the delay in the answer... 

i was not working until last week, today i finished the development of a ñew PLUGIN, so you can use it with the new UCRM 2.10+...

This plugin compares the Customer Service IP Address with the simple queue ip address in Mikrotik, and sync to it the UCRM Bandwith in Queue Simple Max-Limit.

Please find it here: https://github.com/fgampel/UCRM-plugins/tree/master/plugins/mkt-queue-sync 

test it, and tell me if it's working for you.

 

Please note, that this plugin is not completly mine, it's based on a ubiquiti FIO_CZ plugin and modified to work for Mikrotik Sync, so i'm not the fully developer of the plugin, i just made the arrangment for Mikrotik Conection and sync.

 

Please test it, and let me know if it works for you.... If you want to improve this php plugin, you're welcome.

 

Have a nice day.

New Member
Posts: 9
Registered: ‎08-08-2014

Re: UCRM -> Mikrotik simple queue Sync PHP Script

good day

its not working link of download, i tried with https://github.com/Ubiquiti-App/UCRM-plugins/tree/master/plugins/mkt-queue-sync but it doesnt do any change on mikrotik simple queue although it connects via api,

ucrm shows

[2018-10-19 21:58:01.911070] [notice] Successful connection
[2018-10-19 21:58:02.134166] [notice] Synchronization correctly ended / Sincronizado Correctamente

Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Hi @percanta, github version is outdated one.... i already ask UBNT people to commit mi fork with new updates.

 

But, please use this link to download the new version, it's working fine: https://drive.google.com/open?id=1rrKAodKft1S9DxZq-0gibPgoLSOMuPTM 

 

Let me know anything else.

Kind Regards

Ubiquiti Employee
Posts: 3,923
Registered: ‎12-10-2015
Kudos: 1380
Solutions: 299

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Hi @fgampel please take a look at the comment here https://github.com/Ubiquiti-App/UCRM-plugins/pull/36
as soon as the minor fix is done, the PR can be merged. Thanks.
Emerging Member
Posts: 122
Registered: ‎01-19-2015
Kudos: 97
Solutions: 1

Re: UCRM -> Mikrotik simple queue Sync PHP Script

Hi @UBNT-Petr sorry, as i don't understand completelly the GitHub platform i didn't see that comment, now i answered to keksa.

 

Kind Regards

SuperUser
Posts: 5,471
Registered: ‎04-17-2008
Kudos: 3155
Solutions: 126

Re: UCRM -> Mikrotik simple queue Sync PHP Script

@fgampel this plugin seems to heave evolved since it was first released. Does it still require a seperate host for the php script, or is it all done from within ucrm? 

 

Also, does the plugin read the speed package from in ucrm? Where is that set?