{"action":"opened","number":5114,"pull_request":{"url":"https://api.github.com/repos/librenms/librenms/pulls/5114","id":96532875,"html_url":"https://github.com/librenms/librenms/pull/5114","diff_url":"https://github.com/librenms/librenms/pull/5114.diff","patch_url":"https://github.com/librenms/librenms/pull/5114.patch","issue_url":"https://api.github.com/repos/librenms/librenms/issues/5114","number":5114,"state":"open","locked":false,"title":"Update raspberrypi sensor discovery to check for sensor existance","user":{"login":"jquagga","id":5832772,"avatar_url":"https://avatars.githubusercontent.com/u/5832772?v=3","gravatar_id":"","url":"https://api.github.com/users/jquagga","html_url":"https://github.com/jquagga","followers_url":"https://api.github.com/users/jquagga/followers","following_url":"https://api.github.com/users/jquagga/following{/other_user}","gists_url":"https://api.github.com/users/jquagga/gists{/gist_id}","starred_url":"https://api.github.com/users/jquagga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquagga/subscriptions","organizations_url":"https://api.github.com/users/jquagga/orgs","repos_url":"https://api.github.com/users/jquagga/repos","events_url":"https://api.github.com/users/jquagga/events{/privacy}","received_events_url":"https://api.github.com/users/jquagga/received_events","type":"User","site_admin":false},"body":"#### Please note\r\n\r\n> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.\r\n\r\n- [X] Have you signed the [Contributors agreement](http://docs.librenms.org/General/Contributing/)\r\n- [X] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)\r\n\r\nI recently added a RaspberryPi to my network to convert a USB UPS into a Network UPS.  As part of that I added snmp to the Pi and added it to my librenms install.  What I found is that the existing discovery code for the Pi just assumes that the snmp extend for raspberry.sh is enabled.  It discovers sensors which on my install, had no data and it made for a messy page.  So I offer this patch for consideration.  \r\n\r\nIt looks like 2 of the 4 sensors have code to validate the data before discovering the sensor, but only one of those works (temperature).  So these patches add if code to confirm we get something good back before ```discover_senors()```.  It's using ```is_numeric``` for all of the numeric sensors and for the codecs, I'm using ```stripos``` for \"abled\" since the options are enabled / disabled.  \r\n\r\nMy main use for this is that is allows me to run my own raspberry.sh snmp extend which only provides temperature data and doesn't require root/sudo.  I didn't want to give those permissions to the script/ run ```vcgencmd``` on the pi and this patch works nicely to enable that.  Also this is a headless box where I'm never going to change the voltage or enable codecs so didn't want to bother polling that.  \r\n\r\nThe attached screenshot shows the existing behavior with a snmp extend only providing temperature data, then the same situation after this patch (the unused sensors disappear).  Finally the bottom screenshot is after this patch is applied with a \"stock\" snmp extend showing the sensors still polled and working.  \r\n\r\n![out-fs8](https://cloud.githubusercontent.com/assets/5832772/20887224/cc6f1c7e-bac7-11e6-901d-8230b80c69ec.png)\r\n\r\nThis code should only run on raspberry pi discovery since it's already in an ```if``` block identifying the device as a RPI.  ","created_at":"2016-12-05T13:56:40Z","updated_at":"2016-12-05T13:56:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/librenms/librenms/pulls/5114/commits","review_comments_url":"https://api.github.com/repos/librenms/librenms/pulls/5114/comments","review_comment_url":"https://api.github.com/repos/librenms/librenms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/librenms/librenms/issues/5114/comments","statuses_url":"https://api.github.com/repos/librenms/librenms/statuses/7762874eaf4d1476ab94ba61968728718600531d","head":{"label":"jquagga:pi_sensors","ref":"pi_sensors","sha":"7762874eaf4d1476ab94ba61968728718600531d","user":{"login":"jquagga","id":5832772,"avatar_url":"https://avatars.githubusercontent.com/u/5832772?v=3","gravatar_id":"","url":"https://api.github.com/users/jquagga","html_url":"https://github.com/jquagga","followers_url":"https://api.github.com/users/jquagga/followers","following_url":"https://api.github.com/users/jquagga/following{/other_user}","gists_url":"https://api.github.com/users/jquagga/gists{/gist_id}","starred_url":"https://api.github.com/users/jquagga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquagga/subscriptions","organizations_url":"https://api.github.com/users/jquagga/orgs","repos_url":"https://api.github.com/users/jquagga/repos","events_url":"https://api.github.com/users/jquagga/events{/privacy}","received_events_url":"https://api.github.com/users/jquagga/received_events","type":"User","site_admin":false},"repo":{"id":70613244,"name":"librenms","full_name":"jquagga/librenms","owner":{"login":"jquagga","id":5832772,"avatar_url":"https://avatars.githubusercontent.com/u/5832772?v=3","gravatar_id":"","url":"https://api.github.com/users/jquagga","html_url":"https://github.com/jquagga","followers_url":"https://api.github.com/users/jquagga/followers","following_url":"https://api.github.com/users/jquagga/following{/other_user}","gists_url":"https://api.github.com/users/jquagga/gists{/gist_id}","starred_url":"https://api.github.com/users/jquagga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jquagga/subscriptions","organizations_url":"https://api.github.com/users/jquagga/orgs","repos_url":"https://api.github.com/users/jquagga/repos","events_url":"https://api.github.com/users/jquagga/events{/privacy}","received_events_url":"https://api.github.com/users/jquagga/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jquagga/librenms","description":"Community-based GPL-licensed network monitoring system","fork":true,"url":"https://api.github.com/repos/jquagga/librenms","forks_url":"https://api.github.com/repos/jquagga/librenms/forks","keys_url":"https://api.github.com/repos/jquagga/librenms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jquagga/librenms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jquagga/librenms/teams","hooks_url":"https://api.github.com/repos/jquagga/librenms/hooks","issue_events_url":"https://api.github.com/repos/jquagga/librenms/issues/events{/number}","events_url":"https://api.github.com/repos/jquagga/librenms/events","assignees_url":"https://api.github.com/repos/jquagga/librenms/assignees{/user}","branches_url":"https://api.github.com/repos/jquagga/librenms/branches{/branch}","tags_url":"https://api.github.com/repos/jquagga/librenms/tags","blobs_url":"https://api.github.com/repos/jquagga/librenms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jquagga/librenms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jquagga/librenms/git/refs{/sha}","trees_url":"https://api.github.com/repos/jquagga/librenms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jquagga/librenms/statuses/{sha}","languages_url":"https://api.github.com/repos/jquagga/librenms/languages","stargazers_url":"https://api.github.com/repos/jquagga/librenms/stargazers","contributors_url":"https://api.github.com/repos/jquagga/librenms/contributors","subscribers_url":"https://api.github.com/repos/jquagga/librenms/subscribers","subscription_url":"https://api.github.com/repos/jquagga/librenms/subscription","commits_url":"https://api.github.com/repos/jquagga/librenms/commits{/sha}","git_commits_url":"https://api.github.com/repos/jquagga/librenms/git/commits{/sha}","comments_url":"https://api.github.com/repos/jquagga/librenms/comments{/number}","issue_comment_url":"https://api.github.com/repos/jquagga/librenms/issues/comments{/number}","contents_url":"https://api.github.com/repos/jquagga/librenms/contents/{+path}","compare_url":"https://api.github.com/repos/jquagga/librenms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jquagga/librenms/merges","archive_url":"https://api.github.com/repos/jquagga/librenms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jquagga/librenms/downloads","issues_url":"https://api.github.com/repos/jquagga/librenms/issues{/number}","pulls_url":"https://api.github.com/repos/jquagga/librenms/pulls{/number}","milestones_url":"https://api.github.com/repos/jquagga/librenms/milestones{/number}","notifications_url":"https://api.github.com/repos/jquagga/librenms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jquagga/librenms/labels{/name}","releases_url":"https://api.github.com/repos/jquagga/librenms/releases{/id}","deployments_url":"https://api.github.com/repos/jquagga/librenms/deployments","created_at":"2016-10-11T16:28:55Z","updated_at":"2016-10-31T13:03:14Z","pushed_at":"2016-12-05T13:43:59Z","git_url":"git://github.com/jquagga/librenms.git","ssh_url":"git@github.com:jquagga/librenms.git","clone_url":"https://github.com/jquagga/librenms.git","svn_url":"https://github.com/jquagga/librenms","homepage":"http://www.librenms.org/","size":79836,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"librenms:master","ref":"master","sha":"09767f7e95d425772760481a1b36cae57d6dea4a","user":{"login":"librenms","id":5791783,"avatar_url":"https://avatars.githubusercontent.com/u/5791783?v=3","gravatar_id":"","url":"https://api.github.com/users/librenms","html_url":"https://github.com/librenms","followers_url":"https://api.github.com/users/librenms/followers","following_url":"https://api.github.com/users/librenms/following{/other_user}","gists_url":"https://api.github.com/users/librenms/gists{/gist_id}","starred_url":"https://api.github.com/users/librenms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/librenms/subscriptions","organizations_url":"https://api.github.com/users/librenms/orgs","repos_url":"https://api.github.com/users/librenms/repos","events_url":"https://api.github.com/users/librenms/events{/privacy}","received_events_url":"https://api.github.com/users/librenms/received_events","type":"Organization","site_admin":false},"repo":{"id":13914116,"name":"librenms","full_name":"librenms/librenms","owner":{"login":"librenms","id":5791783,"avatar_url":"https://avatars.githubusercontent.com/u/5791783?v=3","gravatar_id":"","url":"https://api.github.com/users/librenms","html_url":"https://github.com/librenms","followers_url":"https://api.github.com/users/librenms/followers","following_url":"https://api.github.com/users/librenms/following{/other_user}","gists_url":"https://api.github.com/users/librenms/gists{/gist_id}","starred_url":"https://api.github.com/users/librenms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/librenms/subscriptions","organizations_url":"https://api.github.com/users/librenms/orgs","repos_url":"https://api.github.com/users/librenms/repos","events_url":"https://api.github.com/users/librenms/events{/privacy}","received_events_url":"https://api.github.com/users/librenms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/librenms/librenms","description":"Community-based GPL-licensed network monitoring system","fork":false,"url":"https://api.github.com/repos/librenms/librenms","forks_url":"https://api.github.com/repos/librenms/librenms/forks","keys_url":"https://api.github.com/repos/librenms/librenms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/librenms/librenms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/librenms/librenms/teams","hooks_url":"https://api.github.com/repos/librenms/librenms/hooks","issue_events_url":"https://api.github.com/repos/librenms/librenms/issues/events{/number}","events_url":"https://api.github.com/repos/librenms/librenms/events","assignees_url":"https://api.github.com/repos/librenms/librenms/assignees{/user}","branches_url":"https://api.github.com/repos/librenms/librenms/branches{/branch}","tags_url":"https://api.github.com/repos/librenms/librenms/tags","blobs_url":"https://api.github.com/repos/librenms/librenms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/librenms/librenms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/librenms/librenms/git/refs{/sha}","trees_url":"https://api.github.com/repos/librenms/librenms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/librenms/librenms/statuses/{sha}","languages_url":"https://api.github.com/repos/librenms/librenms/languages","stargazers_url":"https://api.github.com/repos/librenms/librenms/stargazers","contributors_url":"https://api.github.com/repos/librenms/librenms/contributors","subscribers_url":"https://api.github.com/repos/librenms/librenms/subscribers","subscription_url":"https://api.github.com/repos/librenms/librenms/subscription","commits_url":"https://api.github.com/repos/librenms/librenms/commits{/sha}","git_commits_url":"https://api.github.com/repos/librenms/librenms/git/commits{/sha}","comments_url":"https://api.github.com/repos/librenms/librenms/comments{/number}","issue_comment_url":"https://api.github.com/repos/librenms/librenms/issues/comments{/number}","contents_url":"https://api.github.com/repos/librenms/librenms/contents/{+path}","compare_url":"https://api.github.com/repos/librenms/librenms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/librenms/librenms/merges","archive_url":"https://api.github.com/repos/librenms/librenms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/librenms/librenms/downloads","issues_url":"https://api.github.com/repos/librenms/librenms/issues{/number}","pulls_url":"https://api.github.com/repos/librenms/librenms/pulls{/number}","milestones_url":"https://api.github.com/repos/librenms/librenms/milestones{/number}","notifications_url":"https://api.github.com/repos/librenms/librenms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/librenms/librenms/labels{/name}","releases_url":"https://api.github.com/repos/librenms/librenms/releases{/id}","deployments_url":"https://api.github.com/repos/librenms/librenms/deployments","created_at":"2013-10-28T01:37:13Z","updated_at":"2016-12-05T09:31:34Z","pushed_at":"2016-12-05T13:56:40Z","git_url":"git://github.com/librenms/librenms.git","ssh_url":"git@github.com:librenms/librenms.git","clone_url":"https://github.com/librenms/librenms.git","svn_url":"https://github.com/librenms/librenms","homepage":"http://www.librenms.org/","size":110025,"stargazers_count":543,"watchers_count":543,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":392,"mirror_url":null,"open_issues_count":309,"forks":392,"open_issues":309,"watchers":543,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/librenms/librenms/pulls/5114"},"html":{"href":"https://github.com/librenms/librenms/pull/5114"},"issue":{"href":"https://api.github.com/repos/librenms/librenms/issues/5114"},"comments":{"href":"https://api.github.com/repos/librenms/librenms/issues/5114/comments"},"review_comments":{"href":"https://api.github.com/repos/librenms/librenms/pulls/5114/comments"},"review_comment":{"href":"https://api.github.com/repos/librenms/librenms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/librenms/librenms/pulls/5114/commits"},"statuses":{"href":"https://api.github.com/repos/librenms/librenms/statuses/7762874eaf4d1476ab94ba61968728718600531d"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":10,"deletions":6,"changed_files":4}}
{"actor":{"display_login":"jquagga"}}