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

Spikekill API does not work when called from plugins #2576

Closed
YongBoLiu opened this issue Mar 27, 2019 · 4 comments
Closed

Spikekill API does not work when called from plugins #2576

YongBoLiu opened this issue Mar 27, 2019 · 4 comments
Labels
bug Undesired behaviour resolved A fixed issue
Milestone

Comments

@YongBoLiu
Copy link
Contributor

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

spikekill.php can't work well in plugins. Error 404, the strURL (plugin/xxx/spikekill.php) can not found.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Add the urlPath into the functions such as removeSpikesStdDev() in the ./include/layout.js file.
This makes cacti/spikekill.php works fine for plugins.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Add the urlPath into the functions such as removeSpikesStdDev() in the ./include/layout.js file.
This makes cacti/spikekill.php works fine for plugins.

Additional context
Add any other context or screenshots about the feature request here.

+++ ./include/layout.js	2019-03-27 11:31:09.451958965 +0800
@@ -2946,7 +2946,7 @@
 }
 
 function removeSpikesStdDev(local_graph_id) {
-	var strURL = 'spikekill.php?method=stddev&local_graph_id='+local_graph_id;
+	var strURL = urlPath+ 'spikekill.php?method=stddev&local_graph_id='+local_graph_id;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -2962,7 +2962,7 @@
 }
 
 function removeSpikesVariance(local_graph_id) {
-	var strURL = 'spikekill.php?method=variance&local_graph_id='+local_graph_id;
+	var strURL = urlPath+ 'spikekill.php?method=variance&local_graph_id='+local_graph_id;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -2978,7 +2978,7 @@
 }
 
 function removeSpikesInRange(local_graph_id) {
-	var strURL = 'spikekill.php?method=fill&avgnan=last&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
+	var strURL = urlPath+ 'spikekill.php?method=fill&avgnan=last&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -2994,7 +2994,7 @@
 }
 
 function removeRangeFill(local_graph_id) {
-	var strURL = document.location.origin + '/cacti/spikekill.php?method=float&avgnan=last&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
+	var strURL = urlPath+ 'spikekill.php?method=float&avgnan=last&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -3010,7 +3010,7 @@
 }
 
 function dryRunStdDev(local_graph_id) {
-	var strURL = 'spikekill.php?method=stddev&dryrun=true&local_graph_id='+local_graph_id;
+	var strURL = urlPath+ 'spikekill.php?method=stddev&dryrun=true&local_graph_id='+local_graph_id;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -3028,7 +3028,7 @@
 }
 
 function dryRunVariance(local_graph_id) {
-	var strURL = 'spikekill.php?method=variance&dryrun=true&local_graph_id='+local_graph_id;
+	var strURL = urlPath+ 'spikekill.php?method=variance&dryrun=true&local_graph_id='+local_graph_id;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -3046,7 +3046,7 @@
 }
 
 function dryRunSpikesInRange(local_graph_id) {
-	var strURL = 'spikekill.php?method=fill&avgnan=last&dryrun=true&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
+	var strURL = urlPath+ 'spikekill.php?method=fill&avgnan=last&dryrun=true&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@@ -3065,7 +3065,7 @@
 }
 
 function dryRunRangeFill(local_graph_id) {
-	var strURL = 'spikekill.php?method=float&avgnan=last&dryrun=true&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
+	var strURL = urlPath+ 'spikekill.php?method=float&avgnan=last&dryrun=true&local_graph_id='+local_graph_id+'&outlier-start='+graph_start+'&outlier-end='+graph_end;
 
 	$.getJSON(strURL)
 		.done(function(data) {
@pautiina
Copy link
Contributor

spikekill now in core code. Don't need install plugin

@cigamit cigamit changed the title spikekill.php can't work well in plugins Spikekill does not work well when called from plugins Mar 27, 2019
cigamit added a commit that referenced this issue Mar 27, 2019
Spikekill does not work well when called from plugins
@cigamit cigamit added bug Undesired behaviour resolved A fixed issue labels Mar 27, 2019
@cigamit
Copy link
Member

cigamit commented Mar 27, 2019

Thanks for the report. Resolved.

@cigamit cigamit closed this as completed Mar 27, 2019
@cigamit cigamit added this to the v1.2.3 milestone Mar 27, 2019
@netniV
Copy link
Member

netniV commented Mar 27, 2019

@pautiina you are correct that the SpikeKill code is now in the core, but you can call the functions from any plugin and they should activate the spikekill process.

@YongBoLiu
Copy link
Contributor Author

Thank you.

@netniV netniV changed the title Spikekill does not work well when called from plugins Spikekill API does not work when called from plugins Mar 30, 2019
@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
bug Undesired behaviour resolved A fixed issue
Projects
None yet
Development

No branches or pull requests

4 participants