MadaMzandu / uisp-ros-plugin

This is a follow up replacement for the previous Uisp api for mikrotik routers.
32 stars 9 forks source link

Not understanding how it works #49

Closed mat3ev closed 1 year ago

mat3ev commented 1 year ago

Hey. Propably I am unable to understand how it works but.. How the syncronization with the MikroTik works when I add a new device? Is there a button somewhere (which obviously I can't see if it is there) or it is happening automatically.

MadaMzandu commented 1 year ago

Hi, There is a video here https://youtu.be/0uJsgKWjsNw using dhcp. This should help with the basic setup and give some idea. Let me know if you still need help after watching.

mat3ev commented 1 year ago

Alright, thank you really much. Also I want to ask if there are any error logs (log file) that I can check

MadaMzandu commented 1 year ago

If the plugin fails a task, it will be listed in the plugins panel > settings > jobs. If its not here then, in might be logged in crm > settings > plugins > ros-plugin. If its still not here then let me know and we'll go through your setup

mat3ev commented 1 year ago

There are no errors on both pages and still it is not creating leases. Contact me on Discord - (v_mateev) if it is possible, so I can answer faster.

MadaMzandu commented 1 year ago

I think you might be missing the concept. The plugin works in real time, as you add/edit/suspend the clients services it updates the mikrotik/s accordingly.

  1. Define the attributes username/password/device for pppoe or mac address/device for dhcp.
  2. Add a device or devices and define ip address pools, make sure status goes green, if not check api service is enabled on mikrotik or firewall is blocking tcp 8728
  3. Add or edit a customer - fill the attributes customers mac and name of the device for dhcp or user/pass and device for pppoe
  4. When you save client's service the plugin should login to the mikrotik and create the service
MadaMzandu commented 1 year ago

The plugin normally logs to the plugin window in crm > settings > plugins. You can also check crm > settings > webhooks. To verify that the webhooks are hitting the plugin.

if you need more verbose logging you can edit /home/unms/data/ucrm/ucrm/data/plugins/ros-plugin/lib/api_logger.php and increase API_LOG_LEVEL to 7 this will give debug output in the plugin settings window

mat3ev commented 1 year ago

Still not sending any data to the mikrotik. I will record a video and send it to you.

MadaMzandu commented 1 year ago

Just to verify,

  1. is the plugins webhook endpoint added and
  2. Are the webhook logs crm > settings > webhook showing a response from the plugin?
MadaMzandu commented 1 year ago

Closing this issue, please re-open if still having problems

mat3ev commented 1 year ago

Hey, I have tried on a brand new UISP installation, still the same. No information is being added to the router. Tried different Mikrotik with older version, still the same.

MadaMzandu commented 1 year ago

Thanks for the update. Try this version https://github.com/MadaMzandu/uisp-ros-plugin/releases/tag/2.0.2.11-debug. Enable the debug button and its should log the problem.

mat3ev commented 1 year ago

2023-08-17 12:49:22.596: public: checking databases 2023-08-17 12:49:22.598: db setup: completed in 1.9609928131104 milliseconds 2023-08-17 12:49:22.600: cache setup: completed in 1.3120174407959 milliseconds 2023-08-17 12:49:22.600: public: checking cache sync 2023-08-17 12:49:22.601: public: setup completed 2023-08-17 12:49:22.602: public: begin api request: {"changeType":"admin","target":"devices","action":"get","data":{}} 2023-08-17 12:49:22.602: router: begin route selection 2023-08-17 12:49:22.634: router: selected admin api 2023-08-17 12:49:22.634: api: finished without error : {"status":"ok","error":false,"message":"devices retrieved","session":false}

For what exactly I should look? Looked up the whole log and did not find any errors.

MadaMzandu commented 1 year ago

If there is a problem you should normally get exception errors with a trace. Try to edit one of the clients services. Say change the mac address and check what the log says.