Cacti / plugin_weathermap

Weathermap for Cacti 1.x
MIT License
81 stars 25 forks source link

Weatermap slow when some graphs are broken #124

Open LoremoCH opened 1 year ago

LoremoCH commented 1 year ago

I am not sure if this is really a bug.

We recently updated from Cacti 0.8.8 to 1.2.24 and also updated the Weatermap plugin. Unfortunately, the performance of the new Cacti on the same hardware was suddenly very poor. The poller was constantly killed after 59 seconds because of max execution time. As soon as the plugin was deactivated, the poller was finished after 7 seconds.

We looked at the plugin code afterwards and found that the foreach in 1 takes forever. If we understand it correctly, this part creates error logs for every broken graph. Unfortunately, we have a few of these. The foreach is executed no matter what the log level in the plugin configuration is (quiet/chatty).

As soon as we commented out these 4 lines, the poller was finished in 43 seconds and all our weathermaps worked again.

As mentioned above, I'm not sure if this is really a bug. After all, the broken graphs are the main cause. But since it took us some time to figure this out, it might be helpful for others. Also, whether this log foreach should be run or not when the weatermap log level is quiet (not cacti log level), I am a bit unsure.

TheWitness commented 1 year ago

That should only be at the debug level. Is that how you are running your Cacti? There will of course be issues running at Debug, especially if your storage is constrained and you have a lot of poller items.

TheWitness commented 1 year ago

Maybe the request is to have a separate logging function for WeatherMap like we have for boost so that you don't wreck your server if you are debugging other things. What do you think?