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

When collecting data, spine should be stripping alpha characters from output #151

Closed
TheWitness opened this issue Mar 29, 2020 · 4 comments · Fixed by #152
Closed

When collecting data, spine should be stripping alpha characters from output #151

TheWitness opened this issue Mar 29, 2020 · 4 comments · Fixed by #152

Comments

@TheWitness
Copy link
Member

Describe the bug
In prior releases of spine, if a value was returned from snmp that not numeric, spine used to strip those characters automatically in an attempt to create valid output, but now it's not.

Expected behavior
Strip alpha characters off of the SNMP output as expected.

TheWitness added a commit that referenced this issue Mar 29, 2020
Spine no longer stripping alpha characters from output
@TheWitness TheWitness added this to the v1.2.11 milestone Mar 29, 2020
@eriksejr
Copy link
Contributor

eriksejr commented Mar 30, 2020

@TheWitness This patch actually has to go in two locations to make sure the alpha is stripped from the result:

--- poller.c.orig       2020-03-28 11:19:05.740000000 -0400
+++ poller.c    2020-03-30 09:32:59.180000000 -0400
@@ -1173,8 +1173,10 @@
                                                                /* is valid output, continue */
                                                        } else {
                                                                /* remove double or single quotes from string */
-                                                               snprintf(temp_result, RESULTS_BUFFER, "%s", snmp_oids[j].result);
+                                                               snprintf(temp_result, RESULTS_BUFFER, "%s", strip_alpha(trim(snmp_oids[j].result)));
                                                                snprintf(snmp_oids[j].result , RESULTS_BUFFER, "%s", %s",host_id, snmp_oids[j].result));

                                                                /* detect erroneous non-numeric result */
                                                                if (!validate_result(snmp_oids[j].result)) {
@@ -1474,8 +1476,10 @@
                                        /* is valid output, continue */
                                } else {
                                        /* remove double or single quotes from string */
-                                       snprintf(temp_result, RESULTS_BUFFER, "%s", snmp_oids[j].result);
+                                       snprintf(temp_result, RESULTS_BUFFER, "%s", strip_alpha(trim(snmp_oids[j].result)));
                                        snprintf(snmp_oids[j].result , RESULTS_BUFFER, "%s", temp_result);

                                        /* detect erroneous non-numeric result */
                                        if (!validate_result(snmp_oids[j].result)) {

But I'm still trying to test this further. After the patch I referenced in the forum post I was seeing spine terminate early sometimes creating some broken graphs:

image

The logs show segmentation faults on some runs, but I'm having problems consistently reproducing them, so I have not been able to track down the cause. Reverting the patch stops the segfaults.

@eriksejr
Copy link
Contributor

I'm still running this as a test, so far It's working well, I have not reproduced the issues shown above, but I'd like to let it go for a day or two and I'll follow up and let you know if I see any problems with it

@eriksejr
Copy link
Contributor

This has been running overnight with no further issues noted now. One thing I changed was to remove a number of bad data sources for which polling was failing anyway, that may have helped with regards to the broken graph.

@TheWitness
Copy link
Member Author

Take another peak at what's in GitHub now. Thanks.

@netniV netniV changed the title Spine no longer stripping alpha characters from output When collecting data, spine should be stripping alpha characters from output Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants