Cacti / cacti

Cacti ™
http://www.cacti.net
GNU General Public License v2.0
1.65k stars 406 forks source link

Rebuilding the poller cache does not always work as expected #5279

Closed xmacan closed 1 year ago

xmacan commented 1 year ago

I found that multiCPU_avg data source was updated during the update. Old code has a lot of parameters: function ss_multicpu_avg($hostname,$snmp_community,$snmp_version, $snmp_port,$snmp_timeout) new code has only host_id.

My poller cache looked like this: cache1

So I haven't new data data ater update.

I tried system utilities -> rebuild poller cache. Unfortunately I'm not sure if I didn't run cli rebuild_poller_cache.php :-( Result was: cache2 Instead of host_id is here hostname. It seems that other parameters have been cut off.

Next run rebuild poller cache from web or cli = the same result.

management -> devices -> choose one -> repopulate poller cache = work well Cli push_out_hosts.php = works well too.

cache3

For me it is very confusing. Why host repopulating cache is doing anything different than other repopulate action?

1.2.23 (and older version too, I think that I reported it before

TheWitness commented 1 year ago

Is this the latest 1.2.x branch or what?

xmacan commented 1 year ago

Last line of issue description - it is on 1.2.23 version. I've seen it on older versions. I can update to actual 1.2.24 branch and test it again if you want.

TheWitness commented 1 year ago

Please.

xmacan commented 1 year ago

The first problem. Old ss script has more parameters: function ss_esxi_vhosts($hostname,$snmp_community,$snmp_port,$snmp_timeout) { new has only one: function ss_esxi_vhosts($device_id) {

So after update from (1.2.23 -> 1.2.24) data input method has few obsolete parameters: poller2

xmacan commented 1 year ago

the rest. In poller cache I have: poller_1

After utilities->rebuild_poller_cache (gui) I got poller3

That is wrong. Rebuild poller cache from cli - the same result.

Save device -> still wrong php rebuild_poller_cache.php --host-id=611 --debug -> still wrong

php push_out_hosts.php --host-id=611 --debug -> OK Device -> repopulate pller cache -> OK

TheWitness commented 1 year ago

Just looking at the rebuild script. Damn, it's wrong in a number of places. That script is not multiple-poller aware as of right now. Big oversight.

xmacan commented 1 year ago

Tested, works fine now. Thank you

xmacan commented 1 year ago

Maybe one thing, DEBUG is little bit confusing. I ran rebuild_poller_cache for one host, but scripts says there are '2' devices. Is it normal?

[root@kaktus /usr/local/share/cacti/cli]# php rebuild_poller_cache.php --host-id=649 --debug NOTE: Do not interrupt this script. Rebuilding the Poller Cache can take quite some time DEBUG: There are '2' Devices to rebuild poller items for on poller 1.

TheWitness commented 1 year ago

Yea, whoops. Good catch. Let me fix that.

TheWitness commented 1 year ago

This additional fix will report properly when there is either a host_id or host_template_id specified. It's that stupid host zero case.

TheWitness commented 1 year ago

Just close when you are satisfied.

xmacan commented 1 year ago

It is reporting now correctly: There are '1' Devices to rebuild poller items for on poller 1.