Cacti / cacti

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

Wrong data in poller_output #3909

Closed xmacan closed 4 years ago

xmacan commented 4 years ago

Maybe it isn't error but I spend with this more than 5 hours. I have few Data input methods like:

/scripts/ss_esxi_vhosts.php ss_esxi_vhosts ... Everything works well, but I made mistake in one ss php script. I forgot var_dump: ... **var_dump($array); return("vh:$vhosts vh_state:$vh_state tools_run:$vh_tools_run\n");** After one or two poller cycles I got dozens poller_outup items and few graphs started showing nonsenses (CPU usage 110%, disk size 10TB instead of 200MB, ...). I found wrong data in poller_output table: | 2776 | hdd_used | 2020-11-06 16:55:56 | string(22) "E: tools not installed | | 2733 | hdd_used | 2020-11-06 16:55:56 | string(20) "E: tools not running | | 2999 | hdd_total | 2020-11-06 16:55:55 | load:3.5 | | 2694 | hdd_used | 2020-11-06 16:55:55 | 299712512 | | 3196 | hdd_used | 2020-11-06 16:55:55 | 25759039488 | | 3195 | hdd_used | 2020-11-06 16:55:55 | vh:1 vh_state:1 tools_run:1 tools_nrun:0 tools_ninst:0 | | 358 | hdd_used | 2020-11-06 16:55:55 | named_req:-2 named_ans_succ:-2 named_ans_auth:-2 named_ans_nonauth:-2 another poller cycle: | 1715 | cpu_user | 2020-11-06 16:25:39 | 1334428 | | 1714 | cpu_system | 2020-11-06 16:25:39 | 3746910 | | 1713 | cpu_nice | 2020-11-06 16:25:39 | 110 A lot of outputs are from different script server scripts and hosts! In log isn't any error abnormal error. Only: 2020-11-06 15:10:37 - SPINE: Poller[1] PID[97778] Device[220] HT[1] DS[3213] SS[0] SERVER: /usr/local/share/cacti/scripts/ss_esxi_vhosts.php ss_esxi_vhosts '192.168.250.97' 'kaktus' '161' '1000', output: U If I fix my script, all will be fixed after few poller runs. it doesn't matter if it is spine or cmd. Is it normal behavior? I'm using cacti maybe 10 years and have created a lot of script server scripts but I have never met this. Cacti 1.2.14 Spint 1.2.14 FreeBSD 12.1 PHP 7.4.11
xmacan commented 4 years ago

I tried update php7.4.11 to 7.4.12 - still the same result

xmacan commented 4 years ago

Screenshot_2020-11-06 Tree Mode Default Tree (tse22 - win)

I cannot find what is wrong

TheWitness commented 4 years ago

ouch, var_dump() with standard error redirected to standard output in Script Server VERY BAD.

xmacan commented 4 years ago

It isn't var_dump problem. I did another mistake - division by 0. The result is the same - wrong data in poller_output.

TheWitness commented 4 years ago

Yea, you've got to be careful. The script server is not that forgiving.

xmacan commented 4 years ago

OK, it is my ignorance. I was surprised I hadn't encountered it before. Sorry