Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index: color_id / task_item when viewing graphs #969

Closed
janmaris opened this issue Sep 12, 2017 · 17 comments
Closed

Undefined index: color_id / task_item when viewing graphs #969

janmaris opened this issue Sep 12, 2017 · 17 comments

Comments

@janmaris
Copy link

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

@cigamit
Copy link
Member

cigamit commented Sep 12, 2017

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

@janmaris
Copy link
Author

janmaris commented Sep 12, 2017 via email

@janmaris
Copy link
Author

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
Copy link
Member

cigamit commented Sep 13, 2017

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

@janmaris
Copy link
Author

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
Copy link
Member

cigamit commented Sep 13, 2017

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
Copy link
Author

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

@cigamit
Copy link
Member

cigamit commented Sep 14, 2017

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
Copy link
Member

cigamit commented Sep 17, 2017

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

@janmaris
Copy link
Author

janmaris commented Sep 18, 2017

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
Copy link
Member

cigamit commented Sep 23, 2017

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
Copy link
Author

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
Copy link
Member

cigamit commented Oct 12, 2017

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
Copy link
Author

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
Copy link
Member

cigamit commented Oct 12, 2017

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
Copy link

NetVicious commented Jan 16, 2018

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 cigamit changed the title PHP error msg: Undefined index: color_id / task_item - Cacti 1.1.19 Undefined index: color_id / task_item when viewing graphs Jan 21, 2018
cigamit added a commit that referenced this issue Jan 21, 2018
Undefined index: color_id / task_item when viewing graphs
@cigamit
Copy link
Member

cigamit commented Jan 21, 2018

Okay, this is resolved now.

@cigamit cigamit closed this as completed Jan 21, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants