Cacti / cacti

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

Undefined index: color_id / task_item when viewing graphs #969

Closed janmaris closed 6 years ago

janmaris commented 6 years ago

issue initially reported on Forum (Help: Linux/Unix Specific)

cigamit commented 6 years ago

Can you please provide some details, screen shows, cacti.log samples. Thanks.

janmaris commented 6 years ago

Hello,

the details are in the posting in the forum. I've created this issue on GitHub after a request from user 'Osiris'.

I do not have this installation up and running anymore as it did not work at all.

I'm now doing a fresh new install to 1.1.23.

Jan


Van: Jimmy Conner notifications@github.com Verzonden: dinsdag 12 september 2017 13:04 Aan: Cacti/cacti CC: janmaris; Author Onderwerp: Re: [Cacti/cacti] PHP error msg: Undefined index: color_id / task_item - Cacti 1.1.19 (#969)

Can you please provide some details, screen shows, cacti.log samples. Thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/Cacti/cacti/issues/969#issuecomment-328819303, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AeZ1VCfX6LbjVOLM6GB7nkc_8zuMXQGRks5shmUwgaJpZM4PUOZr.

janmaris commented 6 years ago

I can also confirm that the problem still exists in version 1.1.23. Hence, graphs are not created at all... Could this be related to the use of PHP 7 (instead of PHP 5)?

-Jan

cigamit commented 6 years ago

Could possibly. Are you running the percona performance templates? If so, when you run the import scripts, it damages the Cacti database.

janmaris commented 6 years ago

No, I'm not using these templates. I start from a fresh install, then I slightly modify some templates to use a 10s polling interval.

cigamit commented 6 years ago

Please do. I think this is a duplicate of another issue that people have when they are not using templates. That issue was fixed in 1.1.23.

janmaris commented 6 years ago

Hi, I don't understand your comment. Do what? I am using templates, and the issue is still present in 1.1.23.

cigamit commented 6 years ago

Okay, can you please create an animation of how you create things. Also, right after you create the graph, upload the errors in the cacti.log.

Thanks!

cigamit commented 6 years ago

I need the full error message including what line in what file. Please provide those details we were asking for.

janmaris commented 6 years ago

Hi, I don't have the means to make an animation, but I think I can explain this good enough verbally: And I'm not doing anything special at all.

I have created a new Data Profile with 3 new RRAs for a polling interval of 10s. Then I duplicate existing templates to reference this Data Profile, i.e. Data Template, Graph Template in which I refer to the new Data Source template. I also include this graph template in the device template, although not strictly needed.

Finally, I try to create the graph referencing, but this is unsuccesful, i.e. the data source and the graph are not created, although the GUI pop-up claims the graph was created sucessfully. The cacti.log remains empty, despite the cron job:

root@cacti-server:/var/log/cacti# cat /etc/cron.d/cacti
*/1 * * * * www-data php /usr/share/cacti/cacti-1.1.23/poller.php >/dev/null 2>/var/log/cacti/poller-error.log

The only error message I can find is the error.log from the Apache2 service, with many error messages about the missing RRD file:

ERROR: opening '/usr/share/cacti/cacti-1.1.23/rra/2/38.rrd': No such file or directory

But more importantly, there is also the one I already reported earlier:

[Wed Sep 13 08:16:57.664206 2017] [:error] [pid 710] [client 10.X.X.X:63982] PHP Notice:  Undefined index: color_id in /usr/share/cacti/cacti-1.1.23/lib/html_form_template.php on line 175, referer: http://10.X.X.X/cacti/graphs_new.php?host_id=2
[Thu Sep 14 06:25:03.610405 2017] [mpm_prefork:notice] [pid 585] AH00171: Graceful restart requested, doing restart

I appreciate that it could be somewhat a jump in dark because of the quite new Debian 9, PHP 7, (still on MySQL 5.7), RRDtool 1.7.0, Cacti-spine 1.1.23.

I have checked and doublechecked the entire config, but I may have made a mistake. Only I have no indications from any log files what this could be.

When I run the poller.php script manually as user www-data, I get the following output:

root@cacti-server:/usr/share/cacti/cacti-1.1.23# runuser -u www-data ./poller.php
OK u:0.02 s:0.03 r:1.06
OK u:0.02 s:0.03 r:1.06
OK u:0.02 s:0.06 r:1.09
OK u:0.02 s:0.06 r:1.09
OK u:0.03 s:0.07 r:1.12
OK u:0.03 s:0.07 r:1.12
OK u:0.05 s:0.12 r:1.19
OK u:0.05 s:0.12 r:1.19
2017/09/18 11:30:31 - SYSTEM STATS: Time:2.3597 Method:spine Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:4
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
2017/09/18 11:30:40 - SYSTEM STATS: Time:1.2315 Method:spine Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:4
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
2017/09/18 11:30:50 - SYSTEM STATS: Time:1.2200 Method:spine Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:4
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
2017/09/18 11:31:00 - SYSTEM STATS: Time:1.2274 Method:spine Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:4
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
2017/09/18 11:31:10 - SYSTEM STATS: Time:1.2266 Method:spine Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:4
OK u:0.00 s:0.00 r:1.00
OK u:0.00 s:0.00 r:1.00
OK u:0.00 s:0.00 r:0.00
OK u:0.00 s:0.00 r:0.00
2017/09/18 11:31:20 - SYSTEM STATS: Time:1.2387 Method:spine Processes:1 Threads:1 Hosts:3 HostsPerProcess:3 DataSources:6 RRDsProcessed:4
OK u:0.00 s:0.00 r:0.99
OK u:0.00 s:0.00 r:0.99

The RRD files are then created, and finally also the graphs become visible. So I also wonder why the cron job does not seem to be exectuted periodically.

Thanks for any further advise.

cigamit commented 6 years ago

Check your Console > Settings > Poller and insure 1 minute cron, 10 second poller. Then, run the following two queries:

select rrd_heartbeat, count(*) as totals from data_template_rrd group by rrd_heartbeat; select rrd_step, count(*) as totals from data_template_data group by rrd_step; select rrd_step, count(*) as totals from poller_item group by rrd_step;

The GUI which is the one error that you reported is odd. It will be generated when viewing the graph setup when viewing either the Graph or the Graph Template from the Console.

janmaris commented 6 years ago

Hi, The poller settings are correct. The output of the queries is as follows:

mysql> select rrd_heartbeat, count(*) as totals from data_template_rrd group by rrd_heartbeat;
+---------------+--------+
| rrd_heartbeat | totals |
+---------------+--------+
|            30 |      6 |
|           600 |     61 |
+---------------+--------+
2 rows in set (0.00 sec)

mysql> select rrd_step, count(*) as totals from data_template_data group by rrd_step;
+----------+--------+
| rrd_step | totals |
+----------+--------+
|       10 |      6 |
|      300 |     37 |
+----------+--------+
2 rows in set (0.00 sec)

mysql> select rrd_step, count(*) as totals from poller_item group by rrd_step;
+----------+--------+
| rrd_step | totals |
+----------+--------+
|       10 |      6 |
|      300 |      2 |
+----------+--------+
2 rows in set (0.00 sec)

what can we conclude from this output?

cigamit commented 6 years ago

Sorry, i've been quite busy for the last few weeks, and am only opening up my off hours today to catch up on things. The output tells me that you have 6 data sources polling at a 10 second polling interval, and the remainder at a 5 minute polling interval. Not as much as I had hoped.

By animation, it's like a video. But there are some animated gif programs out there that allow you to perform a screen capture of your mouse clicks and then save that animated gif to this forum. I really need to know exactly how you created the graphs.

janmaris commented 6 years ago

No problem for the delay. I have limited time too and I only found out earlier this week why this set-up was not polling via the cron job: by mistake the /var/log/cacti folder for the log files was not writable by the www-data user. I corrected this and the cron job was able to execute the poller process.

Furthermore, I also found out why I still had data sources with 5 min. polling interval while I thought I only used 10 sec data source templates, 10 sec graph template and 10s SNMP Data Input (data collection). This is because one of the data sources referenced in the graph template was wrongly referring to the 5 minute data source template, and the graph also selects the unexisiting 5 min rrd file.

So I can conclude that the error messages reported initially are not blocking over-all operation. The devil is in the detail when creating a "10s" chain of graphs with indexed data (most via duplication and modification of existing 5 min templates - where possible).

cigamit commented 6 years ago

Yes, this is acknowledged, and we have a feature request to make some fundamental changes in design when it comes to the interaction of Data Source Profiles and the Data Queries.

So, with that said, are you still having this issue?

NetVicious commented 6 years ago
16/01/2018 17:36:53 - ERROR PHP NOTICE: Undefined index: color_id in file: /usr/share/cacti/site/lib/html_form_template.php  on line: 175
16/01/2018 17:36:53 - CMDPHP PHP ERROR NOTICE Backtrace: (/graphs.php: 104 graph_edit)(/graphs.php: 1414 draw_nontemplated_fields_graph_item)(/lib/html_form_template.php: 175 CactiErrorHandler)(/lib/functions.php: 4434 cacti_debug_backtrace)
16/01/2018 17:36:53 - ERROR PHP NOTICE: Undefined index: text_format in file: /usr/share/cacti/site/lib/html_form_template.php  on line: 175
16/01/2018 17:36:53 - CMDPHP PHP ERROR NOTICE Backtrace: (/graphs.php: 104 graph_edit)(/graphs.php: 1414 draw_nontemplated_fields_graph_item)(/lib/html_form_template.php: 175 CactiErrorHandler)(/lib/functions.php: 4434 cacti_debug_backtrace)

I'm getting the same problem, but IMHO I think it's due because after creating the graph the poller needs to be executed one time to create the RRD of the Data Source. The thing it's the user sees the Graph in a disabled way (all fields gray and disabled) and one rrd image with the RRD not found error string. So the user thinks something went wrong. IMHO it's not very user friendly for the first time to see it, and mind me, I'm a very old cacti user

My problem it's I'm a cacti old user, and I usually created manually the data sources and after that I created the Graph using the previous data source. Now it seems to be working always with templates (I set Advanced in Settings - Graph/Data Source Creation Method.

If that's not the problem, the bug should be related with the PHP 7.0.

I'm running as janmaris Debian 9 with PHP 7.0 and I upgraded recently to the debian package 1.1.30+ds1-1~bpo9+1

cigamit commented 6 years ago

Okay, this is resolved now.