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

fix: function snmp_get delete quotes in snmp query #7467

Merged
merged 7 commits into from Oct 31, 2017

Conversation

Projects
None yet
4 participants
@erotel
Contributor

erotel commented Oct 10, 2017

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

@erotel

This comment has been minimized.

Show comment
Hide comment
@erotel

erotel Oct 10, 2017

Contributor

with repairs

#### Load poller module applications ####
SQL[SELECT * FROM `applications` WHERE `device_id`  = '18']
SNMP[/usr/bin/snmpget -v2c -c COMMUNITY -Oqv -M /opt/librenms/mibs:/opt/librenms/mibs/supermicro:/opt/librenms/mibs/dell udp:HOSTNAME:161 .1.3.6.1.4.1.8072.1.3.2.3.1.2.7.117.112.115.45.110.117.116]
"100.0
120
16980
54.81
048
Unknown
247.6
029.9"

SQL[UPDATE `applications` set `app_state` ='OK',`app_status` ='',`timestamp` =NOW() WHERE `app_id` = '2']
ups-nutRRD[update /opt/librenms/rrd/10.133.139.17/app-ups-nut-2.rrd N:100.0:120:283:54.81:048:U:247.6:029.9]

no correction does not load the first and last item in the ups-RRD

#### Load poller module applications ####
SQL[SELECT * FROM `applications` WHERE `device_id`  = '18']
SNMP[/usr/bin/snmpget -v2c -c COMMUNITY -Oqv -M /opt/librenms/mibs:/opt/librenms/mibs/supermicro:/opt/librenms/mibs/dell udp:HOSTNAME:161 .1.3.6.1.4.1.8072.1.3.2.3.1.2.7.117.112.115.45.110.117.116]
"100.0
120
16020
54.81
048
Unknown
247.6
031.2"

SQL[UPDATE `applications` set `app_state` ='OK',`app_status` ='',`timestamp` =NOW() WHERE `app_id` = '2']
 ups-nutRRD[update /opt/librenms/rrd/10.133.139.17/app-ups-nut-2.rrd N:U:120:267:54.81:048:U:247.6:U]

Contributor

erotel commented Oct 10, 2017

with repairs

#### Load poller module applications ####
SQL[SELECT * FROM `applications` WHERE `device_id`  = '18']
SNMP[/usr/bin/snmpget -v2c -c COMMUNITY -Oqv -M /opt/librenms/mibs:/opt/librenms/mibs/supermicro:/opt/librenms/mibs/dell udp:HOSTNAME:161 .1.3.6.1.4.1.8072.1.3.2.3.1.2.7.117.112.115.45.110.117.116]
"100.0
120
16980
54.81
048
Unknown
247.6
029.9"

SQL[UPDATE `applications` set `app_state` ='OK',`app_status` ='',`timestamp` =NOW() WHERE `app_id` = '2']
ups-nutRRD[update /opt/librenms/rrd/10.133.139.17/app-ups-nut-2.rrd N:100.0:120:283:54.81:048:U:247.6:029.9]

no correction does not load the first and last item in the ups-RRD

#### Load poller module applications ####
SQL[SELECT * FROM `applications` WHERE `device_id`  = '18']
SNMP[/usr/bin/snmpget -v2c -c COMMUNITY -Oqv -M /opt/librenms/mibs:/opt/librenms/mibs/supermicro:/opt/librenms/mibs/dell udp:HOSTNAME:161 .1.3.6.1.4.1.8072.1.3.2.3.1.2.7.117.112.115.45.110.117.116]
"100.0
120
16020
54.81
048
Unknown
247.6
031.2"

SQL[UPDATE `applications` set `app_state` ='OK',`app_status` ='',`timestamp` =NOW() WHERE `app_id` = '2']
 ups-nutRRD[update /opt/librenms/rrd/10.133.139.17/app-ups-nut-2.rrd N:U:120:267:54.81:048:U:247.6:U]

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Oct 10, 2017

Member

I'd be more inclined to fix the issue with snmp_get not stripping quotes already.

Member

laf commented Oct 10, 2017

I'd be more inclined to fix the issue with snmp_get not stripping quotes already.

@erotel erotel changed the title from fix: ups-nut delete quotes in snmp query to fix: function snmp_get delete quotes in snmp query Oct 11, 2017

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Oct 13, 2017

Member

@laf perhaps, but I feel like snmp_get should return the raw output.

Member

murrant commented Oct 13, 2017

@laf perhaps, but I feel like snmp_get should return the raw output.

Show outdated Hide outdated includes/snmp.inc.php Outdated
@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Oct 15, 2017

Member

@laf perhaps, but I feel like snmp_get should return the raw output.

@murrant Then we need to rename this to snmp_get_raw() and snmp_get() is a new one which does strip the quotes. Personally I don't think we do need this though as we never want that data, we trim it loads of places already.

Member

laf commented Oct 15, 2017

@laf perhaps, but I feel like snmp_get should return the raw output.

@murrant Then we need to rename this to snmp_get_raw() and snmp_get() is a new one which does strip the quotes. Personally I don't think we do need this though as we never want that data, we trim it loads of places already.

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Oct 18, 2017

Member

@laf seems reasonable, I think the only places that would use snmp_get_raw() are inside snmp.inc.php, but maybe those are calling snmpget directly.

Member

murrant commented Oct 18, 2017

@laf seems reasonable, I think the only places that would use snmp_get_raw() are inside snmp.inc.php, but maybe those are calling snmpget directly.

erotel added some commits Oct 18, 2017

@erotel

This comment has been minimized.

Show comment
Hide comment
@erotel

erotel Oct 18, 2017

Contributor

Please, could you solve it? It does not show that I charge the battery, which is a problem on the central node.

Contributor

erotel commented Oct 18, 2017

Please, could you solve it? It does not show that I charge the battery, which is a problem on the central node.

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Oct 19, 2017

Member

@murrant what do you want to do? My opinion is still to just do the strip in snmp_get() - but update the way it's done inline with other snmp functions we have.

Member

laf commented Oct 19, 2017

@murrant what do you want to do? My opinion is still to just do the strip in snmp_get() - but update the way it's done inline with other snmp functions we have.

@laf

This comment has been minimized.

Show comment
Hide comment
@laf
Member

laf commented Oct 25, 2017

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Oct 30, 2017

Member

I'd still like to push this forward. Stripping quotes from snmp_get() will save all the occurrences of trim()

Member

laf commented Oct 30, 2017

I'd still like to push this forward. Stripping quotes from snmp_get() will save all the occurrences of trim()

@murrant

This comment has been minimized.

Show comment
Hide comment
@murrant

murrant Oct 30, 2017

Member

Looks good to me. It would be nice to have a follow-up removing some of the mentioned trim()/str_replace() calls.

Member

murrant commented Oct 30, 2017

Looks good to me. It would be nice to have a follow-up removing some of the mentioned trim()/str_replace() calls.

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Oct 30, 2017

Member

Happy to swap it out for trim($value, "\" \n\r");?

Member

laf commented Oct 30, 2017

Happy to swap it out for trim($value, "\" \n\r");?

@scrutinizer-notifier

This comment has been minimized.

Show comment
Hide comment
@scrutinizer-notifier

scrutinizer-notifier Oct 31, 2017

The inspection completed: No new issues

scrutinizer-notifier commented Oct 31, 2017

The inspection completed: No new issues

@laf laf merged commit 1dfcde3 into librenms:master Oct 31, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

TheMysteriousX added a commit to TheMysteriousX/librenms that referenced this pull request Nov 1, 2017

fix: function snmp_get delete quotes in snmp query (librenms#7467)
* fix: ups-nut delete quotes in snmp query

* fix: ups-nut delete quotes in snmp query

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

TheMysteriousX added a commit to TheMysteriousX/librenms that referenced this pull request Nov 1, 2017

fix: function snmp_get delete quotes in snmp query (librenms#7467)
* fix: ups-nut delete quotes in snmp query

* fix: ups-nut delete quotes in snmp query

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php

* Update snmp.inc.php
@erotel

This comment has been minimized.

Show comment
Hide comment
@erotel

erotel Nov 1, 2017

Contributor

thank you for the repair, it's working

Contributor

erotel commented Nov 1, 2017

thank you for the repair, it's working

@laf

This comment has been minimized.

Show comment
Hide comment
@laf

laf Nov 1, 2017

Member

Thanks for the fix :D

Member

laf commented Nov 1, 2017

Thanks for the fix :D

@lock

This comment has been minimized.

Show comment
Hide comment
@lock

lock bot May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

lock bot commented May 17, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 17, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.