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

[CLI] Error while adding Non Data Query (cg) Graphs #492

Closed
olebowle opened this issue Mar 28, 2017 · 2 comments
Closed

[CLI] Error while adding Non Data Query (cg) Graphs #492

olebowle opened this issue Mar 28, 2017 · 2 comments
Labels
bug Undesired behaviour

Comments

@olebowle
Copy link

$ php add_graphs.php --list-graph-templates --host-template-id=9
Known Graph Templates:(id, name)
35	DOCSIS Overview
36	DOCSIS Downstream
37	DOCSIS Upstream
38	DOCSIS Traffic
39	DOCSIS Errors
40	DOCSIS Channels

When trying to add a graph I get the following error:

$ php add_graphs.php --host-id=5 --graph-type=cg --graph-template-id=35
ERROR: You must supply a --snmp-value or --snmp-value-regex option with --snmp-field

This used to work in cacti-0.8.8h just fine. I can still add the graphs via the WebGUI ("Create Graphs for this Device"), though.

Applying the following patch fixes the problem:

--- a/cli/add_graphs.php
+++ b/cli/add_graphs.php
@@ -353,8 +353,10 @@ if (sizeof($parms)) {
 			exit(1);
 		}
 	} else {
+/*
 		echo "ERROR: You must supply a --snmp-value or --snmp-value-regex option with --snmp-field\n";
 		exit(1);
+*/
 	}
 
 	$index_filter = 0;
@@ -511,7 +513,7 @@ if (sizeof($parms)) {
 			echo "NOTE: Not Adding Graph - this graph already exists - graph-id: ($existsAlready) - data-source-id: ($dataSourceId)\n";
 			exit(1);
 		}else{
-			$returnArray = create_complete_graph_from_template($template_id, $host_id, '', $values['cg']);
+			$returnArray = create_complete_graph_from_template($template_id, $host_id, null, $values['cg']);
 			$dataSourceId = '';
 		}
 

Commenting the else branch is just a workaround, I'm not sure why this check is performed for cg graphs.

@cigamit
Copy link
Member

cigamit commented Mar 28, 2017

Committing something shortly. Please test.

cigamit added a commit that referenced this issue Mar 28, 2017
Also averting other issues by moving to prepared statements where
possible.
@cigamit cigamit added the bug Undesired behaviour label Mar 28, 2017
@olebowle
Copy link
Author

Fixed, thanks!

@github-actions github-actions bot locked 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
bug Undesired behaviour
Projects
None yet
Development

No branches or pull requests

2 participants