Cacti / plugin_mikrotik

Mikrotik Plugin for Cacti
GNU General Public License v2.0
60 stars 24 forks source link

RouterOS API Call Timed Out. Check for an invalid API password! #43

Closed mehransalehian closed 2 years ago

mehransalehian commented 4 years ago

Hi; I have a problem connecting Mikrotik through API ; on my mikrotik "IP->Services API is active on port 8728 " and I have a readonly user on my mikrotik. My mikrotik is CCR1036 and software version is 6.47 the last version my cacti find all my graphs and works well ,but cannot connect to mikrotik by "MikroTik Credentials"and it says : "Connection Failed" I think maybe this version of cacti template cannot connect to API with new versions in mikrotik.

erroe cacti log

API mikrotik

user pass

TheWitness commented 4 years ago

Okay, I see the version now.

TheWitness commented 4 years ago

I would try to access the router using ssh first. If you can get to it through ssh, then you should be able to access it through the API.

TheWitness commented 4 years ago

If you have setup the router for SSH access using a key, this might be problematic, I mean to login with a password.

TheWitness commented 2 years ago

No response.

coder-binary1 commented 1 year ago

@TheWitness I have the same issue, I put in the correct password and port. but the Connection Result is failed

CMDPHP ERROR: Device[Deveice name] for RouterOS API Call Timed Out. Check for an invalid API password!

TheWitness commented 1 year ago

Did you fill out as below?

image

What version of RouterOS?

TheWitness commented 1 year ago

Are you running through SSL or simply clear connection?

coder-binary1 commented 1 year ago

@TheWitness Now its working after changing default port

coder-binary1 commented 1 year ago

but templet is not working image

TheWitness commented 1 year ago

The question was are you running with ssl enabled?

coder-binary1 commented 1 year ago

No, I just port 8728

TheWitness commented 1 year ago

Why don't you do a TCP dump and send the output to thewitness at cacti.net

TheWitness commented 1 year ago

Just that port nothing else else.

TheWitness commented 1 year ago

Oh, I did not see that you got it working. What Cacti release?

coder-binary1 commented 1 year ago

Cacti Version 1.2.23

skywalker-znz commented 1 year ago

I have the same issue, Centos7, Cacti 1.2.21, plugin 2.6. and template error. Sorry for my ignorance, where do I put the API credentials, I could not find mikrotik login info. Thank you.

skywalker-znz commented 1 year ago

disabling and enabling the plugin fixed this, but the interface are still showing errors.

skywalker-znz commented 1 year ago

on dev, template/script and resources directory are empty, I tried to roll back to 2.4, the script runs but interface returns 0. Thank you.

TheWitness commented 1 year ago

There are two packages in the install/templates directory of the Cacti 1.2.x branch. You should install those and the reindex your devices followed by repopulating the poller cache.

TheWitness commented 1 year ago

All the resources and script files have been moved to the normal locations.

skywalker-znz commented 1 year ago

Thank you, I tried to install it from Cacti 1.2 template, but end up with this error, php -q /var/lib/cacti/cli/import_package.php --filename=/usr/share/cacti/plugins/mikrotik/templates/MikroTik_Device.xml.gz Read 176931 bytes of Package data ERROR: file /usr/share/cacti/plugins/mikrotik/templates/MikroTik_Device.xml.gz import process failed due to errors with the XML file

TheWitness commented 1 year ago

Okay, it's likely has the new key we are using in 1.2.23. I'll check that this morning. Do me a favor and don't install it. I've been waiting for the 1.2.23 release before doing a formal re-release.

skywalker-znz commented 1 year ago

I started from scratch, Ubuntu 22.04, Cacti 1.2.22, installed the plugin, and landed with the same error on interfaces. If I copy the files to /the resource directory, Cacti find the file but still complains on the interface returning empty. Install is pretty straight forward, not sure where I am going wrong. Thank you for your time.

Total: 0.000000, Delta: 0.000000, Found data query XML file at '/var/www/html/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_interfaces.xml'

Total: 0.000000, Delta: 0.000000, Running Data Query [27]. Total: 0.000000, Delta: 0.000000, Found Type = '6' [Script Server Query]. Total: 0.000000, Delta: 0.000000, XML file parsed ok. Total: 0.070000, Delta: 0.070000, Data Query returned no indexes. Total: 0.070000, Delta: 0.000000, exists in XML file but no data returned., 'Index Count Changed' not supported Total: 0.070000, Delta: 0.000000, Executing script for num of indexes '"/usr/bin/php" -q /var/www/html/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_interfaces.php '2' 'num_indexes'' Total: 0.150000, Delta: 0.070000, ERROR: Data Query returned no indexes.

coder-binary1 commented 1 year ago

@TheWitness I installed the packages from install/templates, and resources and script files have been moved to the correct location. but still, there is data queue error occurring.