Cacti / plugin_mikrotik

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

No Graph Generated with good install #58

Open fredouil66 opened 2 years ago

fredouil66 commented 2 years ago

Describe the bug A clear and concise description of what the bug is. Hello, I'm opening the ticket for you because I have a problem with the Mikrotik plugin.

I did the 'import_package.php but the system does not create a graph although it retrieves the data well. I checked the rights of the files and folders they are all good (it seems to me) I do not see what to look for. There were no errors during installation.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'cli' via putty
  2. php /opt/cacti/cli/import_package.php --filename=/opt/cacti/plugins/mikrotik/templates/MikroTik_Device.xml.gz
  3. add graph with device
  4. Graph is empty

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Plugin (please complete the following information):

Desktop (please complete the following information):

Additional context Add any other context about the problem here. root@cacti:~# php /opt/cacti/cli/import_package.php --filename=/opt/cacti/plugin s/mikrotik/templates/MikroTik_Device.xml.gz Read 131417 bytes of Package data Résultat de l'importation Cacti has imported the following items for the Package : Package Files /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_snmpget.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_count_oids.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_cpu.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_procs.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_mem.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_disk.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_users.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_uptime.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_health.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_wapcount.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_wrcount.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_trees.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_qcount.php [written] /opt/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_wireless_r eg.xml [written] /opt/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_queues.xml [written] /opt/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_trees.xml [written] /opt/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_qusers.xml [written] /opt/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_interfaces .xml [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_wireless_reg.php [writ ten] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_queues.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_qtrees.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_qusers.php [written] /opt/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_interfaces.php [writte n] CDEF [succès] Turn Bytes into Bits [unchanged] [succès] Turn Seconds into Hours [nouveau] [succès] Make Per 5 Minutes [unchanged] GPRINT Preset [succès] Normal [unchanged] [succès] Exact Numbers [unchanged] [succès] Percentage as Decimal [nouveau] Méthode d'acquisition des données [succès] MikroTik - Device - SNMP Get [nouveau] [succès] MikroTik - Device - Count Oids [nouveau] [succès] MikroTik - Device - CPU Utilization [nouveau] [succès] MikroTik - Device - Processes [nouveau] [succès] MikroTik - Device - Memory Utilization [nouveau] [succès] MikroTik - Device - Disk Utilization [nouveau] [succès] MikroTik - Device - Users [nouveau] [succès] MikroTik - Device - Uptime [nouveau] [succès] MikroTik - Device - Health [nouveau] [succès] MikroTik - Device - Wireless APs [nouveau] [succès] MikroTik - Device - Wireless Reg [nouveau] [succès] MikroTik - Device - Trees [nouveau] [succès] MikroTik - Device - Queues [nouveau] Modèle de données [succès] MikroTik - Device - PPP Active [nouveau] [succès] MikroTik - Device - IP Routes [nouveau] [succès] MikroTik - Device - Wireless Connections [nouveau] [succès] MikroTik - Device - IP/ARP Entries [nouveau] [succès] MikroTik - Device - CPU Utilization [nouveau] [succès] MikroTik - Device - Processes [nouveau] [succès] MikroTik - Device - Memory Utilization [nouveau] [succès] MikroTik - Device - Disk Utilization [nouveau] [succès] MikroTik - Device - Users [nouveau] [succès] MikroTik - Device - Uptime [nouveau] [succès] MikroTik - Device - Health - 12.0 Voltage [nouveau] [succès] MikroTik - Device - Health - 5.0 Voltage [nouveau] [succès] MikroTik - Device - Health - 3.3 Voltage [nouveau] [succès] MikroTik - Device - Health - Core Voltage [nouveau] [succès] MikroTik - Device - Health - Voltage [nouveau] [succès] MikroTik - Device - Health - CPU Temperature [nouveau] [succès] MikroTik - Device - Health - Processor Temperature [nouveau] [succès] MikroTik - Device - Health - Sensor Temperature [nouveau] [succès] MikroTik - Device - Health - Temperature [nouveau] [succès] MikroTik - Device - Health - Power [nouveau] [succès] MikroTik - Device - Health - Current [nouveau] [succès] MikroTik - Device - Wireless APs [nouveau] [succès] MikroTik - Device - Wireless Reg [nouveau] [succès] MikroTik - Device - Trees [nouveau] [succès] MikroTik - Device - Queues [nouveau] [succès] MikroTik - DHCP - Leases [nouveau] [succès] MikroTik - Wireless Reg - Data Rates [nouveau] [succès] MikroTik - Wireless Reg - Packets [nouveau] [succès] MikroTik - Wireless Reg - Traffic [nouveau] [succès] MikroTik - Wireless Reg - Uptime [nouveau] [succès] MikroTik - Queue - Packets [nouveau] [succès] MikroTik - Queue - Traffic [nouveau] [succès] MikroTik - Queue - Queues/Drops [nouveau] [succès] MikroTik - Trees - Packets [nouveau] [succès] MikroTik - Trees - Bytes [nouveau] [succès] MikroTik - Users - Total Packets In/Out [nouveau] [succès] MikroTik - Users - Current Packets In/Out [nouveau] [succès] MikroTik - Users - Total Bytes In/Out [nouveau] [succès] MikroTik - Users - Current Bytes In/Out [nouveau] [succès] MikroTik - Users - Connect Time [nouveau] [succès] MikroTik - Interfaces - Bytes Tx/Rx [nouveau] [succès] MikroTik - Interfaces - Packets Tx/Rx [nouveau] [succès] MikroTik - Interfaces - Rx Distribution [nouveau] [succès] MikroTik - Interfaces - Special Tx/Rx [nouveau] [succès] MikroTik - Interfaces - Tx Distribution [nouveau] [succès] MikroTik - Interfaces - Tx Errors [nouveau] [succès] MikroTik - Interfaces - Rx Errors [nouveau] Modèle de graphique [succès] MikroTik - Device - PPP Active [nouveau] [succès] MikroTik - Device - IP Routes [nouveau] [succès] MikroTik - Device - Wireless Connections [nouveau] [succès] MikroTik - Device - IP/ARP Entries [nouveau] [succès] MikroTik - Device - CPU Utilization [nouveau] [succès] MikroTik - Device - Processes [nouveau] [succès] MikroTik - Device - Memory Utilization [nouveau] [succès] MikroTik - Device - Disk Utilization [nouveau] [succès] MikroTik - Device - Users [nouveau] [succès] MikroTik - Device - Uptime [nouveau] [succès] MikroTik - Device - Health - 12.0 Voltage [nouveau] [succès] MikroTik - Device - Health - 5.0 Voltage [nouveau] [succès] MikroTik - Device - Health - 3.3 Voltage [nouveau] [succès] MikroTik - Device - Health - Core Voltage [nouveau] [succès] MikroTik - Device - Health - Voltage [nouveau] [succès] MikroTik - Device - Health - CPU Temperature [nouveau] [succès] MikroTik - Device - Health - Processor Temperature [nouveau] [succès] MikroTik - Device - Health - Sensor Temperature [nouveau] [succès] MikroTik - Device - Health - Temperature [nouveau] [succès] MikroTik - Device - Health - Power [nouveau] [succès] MikroTik - Device - Health - Current [nouveau] [succès] MikroTik - Device - Wireless APs [nouveau] [succès] MikroTik - Device - Wireless Regs [nouveau] [succès] MikroTik - Device - Trees [nouveau] [succès] MikroTik - Device - Queues [nouveau] [succès] MikroTik - DHCP - Leases [nouveau] [succès] MikroTik - Wireless Reg - Data Rates [nouveau] [succès] MikroTik - Wireless Reg - Packets [nouveau] [succès] MikroTik - Wireless Reg - Traffic (bytes/sec) [nouveau] [succès] MikroTik - Wireless Reg - Traffic (bits/sec) [nouveau] [succès] MikroTik - Wireless Reg - Uptime [nouveau] [succès] MikroTik - Queues - Packets In/Out [nouveau] [succès] MikroTik - Queues - Traffic (bytes/sec) [nouveau] [succès] MikroTik - Queues - Traffic (bits/sec) [nouveau] [succès] MikroTik - Queues - Drops [nouveau] [succès] MikroTik - Queues - Queues In/Out [nouveau] [succès] MikroTik - Trees - Packets Total [nouveau] [succès] MikroTik - Trees - Traffic (bits/sec) [nouveau] [succès] MikroTik - Users - Total Packets In/Out [nouveau] [succès] MikroTik - Users - Current Packets In/Out [nouveau] [succès] MikroTik - Users - Total Bytes In/Out [nouveau] [succès] MikroTik - Users - Current Bytes In/Out [nouveau] [succès] MikroTik - Users - Connect Time [nouveau] [succès] MikroTik - Interfaces - Bytes Tx/Rx [nouveau] [succès] MikroTik - Interfaces - Packets Tx/Rx [nouveau] [succès] MikroTik - Interfaces - Rx Distribution [nouveau] [succès] MikroTik - Interfaces - Special Tx/Rx [nouveau] [succès] MikroTik - Interfaces - Tx Distribution [nouveau] [succès] MikroTik - Interfaces - Tx Errors [nouveau] [succès] MikroTik - Interfaces - Rx Errors [nouveau] Interrogation avancée [succès] MikroTik - Wireless Reg [nouveau] [succès] MikroTik - Queues [nouveau] [succès] MikroTik - Trees [nouveau] [succès] MikroTik - Users [nouveau] [succès] MikroTik - Interfaces [nouveau] Modèle d'équipement [succès] MikroTik Device [nouveau]

fredouil66 commented 2 years ago

Data ok image image image

But the graph is empty or not generated (only cpu usage is generated): image

fredouil66 commented 2 years ago
07/04/2022 13:55:08 - CMDPHP PHP ERROR WARNING Backtrace: (/plugins/mikrotik/poller_mikrotik.php[136]:getLatestVersion(), /plugins/mikrotik/poller_mikrotik.php[146]:file_get_contents(), CactiErrorHandler()) -- 07/04/2022 13:55:08 - ERROR PHP WARNING in Plugin 'mikrotik': file_get_contents(http://upgrade.mikrotik.com/routeros/LATEST.6): failed to open stream: Connection timed out in file: /opt/cacti/plugins/mikrotik/poller_mikrotik.php on line: 146
TheWitness commented 2 years ago

You likely don't have access to the internet, or they changed the link. Let me check.

TheWitness commented 2 years ago

That's the issue. I guess that we may need to add an option to suppress the message, or add a proxy. We added proxy support in Cacti 1.3, but that project is still stalled.

fredouil66 commented 2 years ago

I think the problem is that the code must access the Mikrotik site (http://upgrade.mikrotik.com/routeros/LATEST.6).

Do you think this is the problem why mikrotik plugins dont generate the graph ?

I can check the cacti can join the mikrotik site now.

fredouil66 commented 2 years ago

I just did a test with wget to check if cacti can access the link and it works. I erased the faulty graphs and I regenerated them but the problem persists. I look at the logs in debug I do not see anything in error..

image

TheWitness commented 2 years ago

Under your user profile, you should select to show graph names, then we can see what Graphs are broken.

fredouil66 commented 2 years ago

all these graphs don't work: image

fredouil66 commented 2 years ago

image

fredouil66 commented 2 years ago

The others work well like the queue and SNMP - Interface Statistics for example

fredouil66 commented 2 years ago

For information : image

loloski commented 2 years ago

mine on the interface always 0 rows even though i can see that it was able to pull data from snmp

fredouil66 commented 2 years ago

i just found that in /cacti/data_input.php the mikrotik scripts have not input or output field. Do think this is the problem ? if yes how do repair this ? image

fredouil66 commented 2 years ago

image

fredouil66 commented 2 years ago

image

fredouil66 commented 2 years ago

I used this command for install the template :

php /opt/cacti/cli/import_package.php --filename=/opt/cacti/plugins/mikrotik/templates/MikroTik_Device.xml.gz

fredouil66 commented 2 years ago

image

loloski commented 2 years ago

I think the basic howto should be updated and mentioned that the plugin after installed should be activated and last but not the least after adding device make sure that you have read only users via mikrotik api and this plugins will start to work beautifully

fredouil66 commented 2 years ago

API is OK : image

Install plugins is OK : image

Install template with cli is OK

But the data input method is incomplete and the cacti not create graph ...

I tried to reinstall, nothing ..

fredouil66 commented 2 years ago

image

for information

fredouil66 commented 2 years ago

I don't know what else to add in this ticket in order to be able to give you information to be able to help me or to be able to solve this bug. What additional information would be needed?

TheWitness commented 2 years ago

Graph Title Shown Below:

image

Edit your User Profile and Toggle the Show Graph Title

image

TheWitness commented 2 years ago

Sorry busy you know.

fredouil66 commented 2 years ago

image image image image image

fredouil66 commented 2 years ago

Didn't work : image

And didn't work MikroTik - Interfaces, MikroTik - Users

But work well the MikroTik - Trees : image

fredouil66 commented 2 years ago

ok I understand let me know when you have time to test the plugin ;)

fredouil66 commented 2 years ago

hello I come to the news for that. Did you work on it?

insane91 commented 2 years ago

Hi, Also having the same issue of graphs not showing when using Mikrotik template, the interface gives error, and for some reason the Mikrotik plugging drop the mysql server and regain access to cacti after disabling the mikrotik pluging

Edit:

This is error i get when activating the Mikrotik Plugin 2022-06-06 10:12:01 - PLUGIN WARNING: Function does not exist config_form with function mikrotik_config_form

fredouil66 commented 2 years ago

hello do you recommend deactivating the plugin for it to work or do you think an update is necessary?

insane91 commented 2 years ago

image

Bellow is debug log for the Mikrotik Interface as not of them are able to retrieve data, But when using the Cisco ROuter template i can see interface information

{

Total: 0.000000, Delta: 0.000000, Found data query XML file at '/usr/share/cacti/plugins/mikrotik/templates/resource/script_server/mikrotik_interfaces.xml' -- Total: 0.010000, Delta: 0.010000, Running Data Query [26]. Total: 0.010000, Delta: 0.000000, Found Type = '6' [Script Server Query]. Total: 0.010000, Delta: 0.000000, XML file parsed ok. Total: 0.080000, Delta: 0.070000, Data Query returned no indexes. Total: 0.080000, Delta: 0.000000, exists in XML file but no data returned., 'Index Count Changed' not supported Total: 0.080000, Delta: 0.000000, Executing script for num of indexes '"/usr/bin/php" -q /usr/share/cacti/plugins/mikrotik/templates/scripts/ss_mikrotik_interfaces.php '124' 'num_indexes'' Total: 0.140000, Delta: 0.060000, ERROR: Data Query returned no indexes.

}

insane91 commented 2 years ago

hello do you recommend deactivating the plugin for it to work or do you think an update is necessary?

The best is to use the cicso device template for this mikrotik devices as i can get interface information and more, compared to the mikrotik template, i dont know if there needs to be more done on the setup or not

TheWitness commented 2 years ago

Okay, I did re-package the MikroTik Device Package to move the locations for some of the critical components to standard locations. I think this plugin will work best with the 1.2.21+ releases of cacti as post release 1.2.15 we made some Re-index and template changes that did not fare too well. So, if you are between those two releases, upgrade Cacti ASAP.

fredouil66 commented 1 year ago

hello, I plan to test the changes you made to test the resolution of the problem. I'm currently on 1.2.14 and I plan to upgrade to 1.2.22, can someone test if it works correctly?

TheWitness commented 1 year ago

Well, you can certainly test it. With Cacti 1.2.23, we will allow very selective package import and comparison. We are about a month away right now.

fredouil66 commented 1 year ago

Hello, I see that there are many things that have been corrected following the update to 1.2.22, however I have detected that the system does not create the resources folder in the Mikrotik template, which prevents it from running correctly import via cli, after I corrected this the import is done correctly, the installation and the rights are well applied. The interface graphics (mikrotik_interface) are created correctly but are hopelessly empty... There are no errors and I don't understand what could be bugging here are the screenshots below. On the other hand, the CPU information (MikroTik - Device - CPU Utilization) works correctly, the graph is created and is not empty. I think we are close to having everything working properly, not much should be missing. Thanks for your help.

I think our problem is between mikrotik_interface and MikroTik chart model - Interfaces - Bytes Tx/Rx

image

image

fredouil66 commented 1 year ago

image

fredouil66 commented 1 year ago

image I don't see the interface data acquisition script in the list is this normal?

On the other hand, I can see it in my folder /opt/cacti/scripts/ image

here I put you the info tell me if I can try something, thank you for your help

fredouil66 commented 1 year ago

image

I have the impression that there is a track to dig in this capture

TheWitness commented 1 year ago

Well that's interesting. I'm pretty sure it should not be service impacting. It's old style vs. new style.

I'll be re-releasing the MikroTik Device Package after the next Cacti release.

BTW, thanks for pointing this issue out in the package. I'll fix our packaging plugin, which will also be released post 1.2.23.

TheWitness commented 1 year ago

Can you see if the interface data is actually being updated in the table? The graphs pull from the database tables.

fredouil66 commented 1 year ago

image image image image image image image

fredouil66 commented 1 year ago

I don't know what information could help you.

Can I check some point to make the plugin work?

fredouil66 commented 1 year ago

image I see that even the graphs that work have holes, can the time: polling interval play a role? I'm set to one minute and my crontab too, do I have to change the template time to one minute collection?

fredouil66 commented 1 year ago

image image

TheWitness commented 1 year ago

What does you Cacti.log have in it?

fredouil66 commented 1 year ago

image image

TheWitness commented 1 year ago

Well, it looks to me as if you have lost snmp access to your device, or you need to increase the timeout as I'm seeing recache failures with the value of 'U' or bad data. Also, no-such-object means that the OID that you are polling does not exist.

TheWitness commented 1 year ago

Also, weather map is barking that you need to increase your PHP memory limit.

fredouil66 commented 1 year ago

image What I'm sure of is that the snmp link has not been cut because the device is in the datacenter and the cacti can also see 100% availability. On the other hand my collection time and maybe important and I set 500ms how much should I set? image (I set the php.ini now thank you)

TheWitness commented 1 year ago

Well, you can increase it, then run a verbose query on the Data Query until you get better results. If you have Max OID's set too high, that can also generate timeouts. Cacti, in the latest version attempts to optimize that setting automatically. But you can override it.