Raspberry sensors #4057

Merged
merged 7 commits into from Aug 18, 2016

Projects

None yet

7 participants

@crcro
Contributor
crcro commented Aug 14, 2016

detect linux that runs on pi boxes and adds sensors (requires librenms-agent PR #48)
screen shot 2016-08-14 at 5 53 31 pm

@Rosiak
Contributor
Rosiak commented Aug 14, 2016

Don't think the "disabled" should be critital in the state part.

@crcro
Contributor
crcro commented Aug 14, 2016

@Rosiak better to warning?

@laf
Member
laf commented Aug 14, 2016

You can label it as disabled but you should set it to the unknown value (3)

Great work though :)

@laf laf and 1 other commented on an outdated diff Aug 14, 2016
doc/Extensions/Applications.md
@@ -168,6 +168,23 @@ extend memcached /usr/local/bin/memcached
4. Restart snmpd on your host
5. On the device page in Librenms, edit your host and check `Memcached` under the Applications tab.
+### Raspberry PI
+SNMP extend script to get your PI data into your host.
+
+##### Extend SNMP
+1. Copy the [raspberry script](https://github.com/librenms/librenms-agent/blob/master/snmp/raspberry.sh) to `/opt/` (or any other suitable location) on your PI host.
+2. Make the script executable: `chmod +x /opt/raspberry.sh`
+3. Edit your snmpd.conf file (usually `/etc/snmp/snmpd.conf`) and add:
+```
+extend raspberry /opt/raspberry.sh
+```
+4. Edit your sudo users (usually `visudo`) and add at the bottom:
+```
+snmp ALL=(ALL) NOPASSWD: ALL
@laf
laf Aug 14, 2016 Member

Is this a good idea? Not better to allow the specific command - or does net-snmp on the Pi not run as root anyway?

@crcro
crcro Aug 14, 2016 edited Contributor

on the raspberry pi that i had access to (running debian 7.8) it runs as snmp user
i will change the codec to state 3.
also there is some function available already to convert that Hz to Mhz or so?

@laf
laf Aug 14, 2016 Member

Ok so just restrict the command that snmp can run with no password.

No function to convert between those formats I don't believe.

@laf
Member
laf commented Aug 17, 2016

Sorry @crcro - needs a rebase :(

crcro added some commits Aug 14, 2016
@crcro crcro added sensors for raspberry hosts 3567baa
@crcro crcro added docs for pi host snmp extend script 70c93fe
@crcro crcro changed disabled codec state to unknown value (3) 776dfa9
@crcro crcro changed docs to sudo only the required command cce24a4
@crcro crcro fix rebase
72856ba
@crcro crcro fix github markup in files
207ca03
@crcro crcro fix github markup in files 2
76fa983
@crcro
Contributor
crcro commented Aug 18, 2016

rebased

@laf laf added the New-Device label Aug 18, 2016
@laf laf merged commit 20932bd into librenms:master Aug 18, 2016

2 checks passed

Auto-Deploy Build finished.
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@crcro crcro deleted the unknown repository branch Aug 18, 2016
@arrmo
Contributor
arrmo commented Aug 19, 2016

Hi,

Likely me just being dumb (OK, I'm sure it is unfortunately), but struggling with this a bit. I set up the script file, and it runs nicely on the Pi. I configured snmpd.conf and visudo, restarted, and I do get output from walking snmp, but it's as follows,

NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".1 = STRING:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".2 = STRING: We trust you have received the usual lecture from the local System
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".3 = STRING: Administrator. It usually boils down to these three things:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".4 = STRING:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".5 = STRING: #1) Respect the privacy of others.
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".6 = STRING: #2) Think before you type.
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".7 = STRING: #3) With great power comes great responsibility.
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".8 = STRING:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."raspberry".9 = STRING: sudo: no tty present and no askpass program specified

This repeats several times (OK, you get the picture ... :)). Thoughts?

Thanks!

@crcro
Contributor
crcro commented Aug 19, 2016

hi, could you please try commenting the visudo line:

Defaults requiretty

@arrmo
Contributor
arrmo commented Aug 19, 2016

Do you mean adding this to the end of the line? Tried that, no joy ... :(

Pulling my hair out (and I'm short of that ... LOL). From the command line, if I execute "sudo raspberry.sh" -> no issue at all, works fine.

Thanks!

@crcro
Contributor
crcro commented Aug 19, 2016

try changing:

snmp ALL=(ALL) NOPASSWD: /opt/raspberry.sh to
snmp ALL=(ALL) NOPASSWD: ALL

and give it a try

@arrmo
Contributor
arrmo commented Aug 19, 2016

Joy - thanks!

Not sure why this is needed, but no biggie.

Much appreciated!

@crcro
Contributor
crcro commented Aug 19, 2016 edited

@arrmo
could you please give it a try with the following:

snmp ALL=(ALL) NOPASSWD: /opt/raspberry.sh, /usr/bin/vcgencmd*

this is needed because vcgencmd command needs higher privileges to return anything

@arrmo
Contributor
arrmo commented Aug 19, 2016

Yep, that works! And I tried removing /usr/bin/vcgencmd* => breaks. So this is key.

Thanks!

@Rosiak Rosiak referenced this pull request Aug 29, 2016
Closed

Add Raspberry Pi #2916

@mirino75
Contributor

I have done everything according to documentation but I still do not see the value in the section overview : Temperature, Voltage , Freq.
image

## Output from raspberry.sh
image

## Edited by visudo :
image

## Also, I do not have a choice "RASPBERRY" in applications
image

image

## Is this association correct?
image

@cweakland

First off, thanks for all the great work. However, I have the same issue. I did a fresh install of librenms last week. I have two Pi's on the network and for both of them I see the codec charts created but I do not get the voltage/temp charts. Please let me know if I can provide any additional detail.

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