[Plug-In] SNMP


256 posts in this topic Last Reply

Recommended Posts

Hey folks,

 

Looks like I goofed up the github URL, so you're not going to see updates to the SNMP package unless you uninstall and reinstall. Sorry about that. FYI the only update in a while has been the fix for this problem.

Link to post
  • 2 weeks later...
  • Replies 255
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Created a pull request for the Coppit package on GitHub https://github.com/coppit/unraid-snmp/pull/6 but it doesn't seem like they've been active since August 2018 on here or on GitHub.   Wi

SNMP is a standard way to get raw data from devices, for monitoring purposes. With this package, you can hook your UNRAID server up to a monitor, and track things like network usage, cpu activity, eve

ok so I installed it, but important question: where can I set the SNMP community string?

Posted Images

Hi Guys,

 

Not sure if any of you will be able to help me, i can't get my head around observium, do i install it as bridge or host?

if i go bridge i can access observium but can't add any devices, and if i go host it has a cry about sql, i believe because i am already running mysql on port 3306

 

Ideas?

 

Cheers,

Link to post

hmm i'm past that part and i don't wanna delete unraid but i will if you can't get it working. try this first, it's just

 

hostname = tower

protocol version = v2c

port = 161

snmp community = public

 

pretty sure everything else was blank/default.

 

I can't seem to add unRaid as a device. Using those settings I get:

 

Adding host Tower community public port 161

Could not resolve Tower.

Link to post

Hi coppit,

is there any chance to add the drive temperatures to the MIBs the same way, you added the unraid drives?

.. and while thinking about it: It would be nice to add the up/down state also to MIBs - that would give a great historical view on the spinning status of the drives!

Is this possible?

Link to post

Checked it myself - if I understand it correct, it should be possible:

See http://www.net-snmp.org/docs/man/snmpd.conf.html

So snmpd.conf has to be extended by Agent functionality.

Current content of /usr/local/emhttp/plugins/snmp/snmpd.conf is:

rocommunity public
syslocation Here
syscontact root@tower
disk /mnt/disk1
disk /mnt/disk2
disk /mnt/disk3
disk /mnt/disk4
disk /mnt/disk5
disk /mnt/disk6
disk /mnt/disk7
disk /mnt/disk8
disk /mnt/disk9
disk /mnt/disk10
disk /mnt/disk11
disk /mnt/disk12
disk /mnt/disk13
disk /mnt/disk14
disk /mnt/disk15
disk /mnt/disk16
disk /mnt/disk17
disk /mnt/disk18
disk /mnt/disk19
disk /mnt/disk20
disk /mnt/cache

Extended agents could be implemented like this:

Extending Agent Functionality

Arbitrary Extension Commands

Old Style

    exec [MIBOID] NAME PROG ARGS"
    sh   [MIBOID] NAME PROG ARGS"
    execfix NAME PROG ARGS"

New Style

    extend [MIBOID] NAME PROG ARGS"
    extendfix [MIBOID] NAME PROG ARGS"

So if it is possible to get the information from emhttp via perl, it should be doable, iiuc?

Link to post

Sorry for another post, but continued some reading and it seems that also shell scripts are supported:

# Run a shell script containing:
#
# #!/bin/sh
# echo hello world
# echo hi there
# exit 35
#
# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest

# Other ideas:
#
# exec .1.3.6.1.4.1.2021.51 ps /bin/ps
# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top
# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq

So it shouldn't be too difficult to use the respective parts from e.g. dynamix temp plugin (shell script), that is already determining temperature and disk status and output to a MIB.

 

# Identify the drives in your array so we can test their temperature
COUNT=1
for d in $(ls /dev/[hs]d? | grep -v "$flash")
do
<------>HD[$COUNT]=$d
<------>#echo HDD=${HD[$COUNT]}><------><------><------><------><------><------><------># Uncomment for debugging
<------>COUNT=$[$COUNT+1]
done
<------>while [ $CURRENT_DRIVE -le $NUM_OF_DRIVES ]
<------>do
<------><------>SLEEPING=`hdparm -C ${HD[$CURRENT_DRIVE]} | grep -c standby`
<------><------>if [ "$SLEEPING" -eq 0 ]; then
<------><------><------>CURRENT_TEMP=`smartctl -A ${HD[$CURRENT_DRIVE]} | grep -m 1 -i Temperature_Celsius | awk '{print $10}'`
<------><------>fi
<------><------>CURRENT_DRIVE=$[$CURRENT_DRIVE+1]
<------>done

hdparm tells us, if the drive is in standby - smartctrl tells us the drive's temp.

Question: I had a look into myMain.awk code of unmenu - it also uses smartctl to gather disk temp - and also gets them when disk is spun down - iirc, this is not possible with all drives/manufacturers, but it would be nice to get temps continously :-).

I did a quick test with my drives on the command line and smartctl -A /dev/sdx does not spin up the drive and nicely reports the data...

Hope that helps?

Link to post

I can't seem to add unRaid as a device. Using those settings I get:

 

Adding host Tower community public port 161

Could not resolve Tower.

 

Try using the IP address instead?

 

Adding host 192.168.1.8 community public port 161

Could not resolve 192.168.1.8.

Screenshot_1.png.b02e2e1e5e542f72ca1275d5c5a5c252.png

Link to post
  • 2 weeks later...

Is there a way to test to make sure it is installed and working right? Having trouble trying to connect to observium.

 

On another computer I tried to telnet to tower on port 161 which should at least connect if the port is open but doesn't work.

 

Thanks

Link to post

Is there a way to test to make sure it is installed and working right? Having trouble trying to connect to observium.

 

On installation it does a self-test. Uninstall and reinstall to double-check it.

 

Installed and feeding data to MRTG (old school, I know).  Now to see what OIDs are good to watch!

Link to post

Hi all,

 

I've dropped the log level to "warning", and it so far hasn't put anything in my log. That should help with disk usage. :)

 

I've also integrated drive temperatures:

 

$ snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp"'
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".1 = STRING: ST3000DM001-1ER166_W500ARQN: 31
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".2 = STRING: ST3000DM001-1ER166_W500QFEF: 35
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".3 = STRING: WDC_WD20EARS-00MVWB0_WD-WMAZA3285404: 36
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".4 = STRING: ST2000DL003-9VT166_5YD317TZ: 37
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".5 = STRING: WDC_WD20EARS-00MVWB0_WD-WMAZA3209264: 37
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".6 = STRING: TOSHIBA_DT01ACA200_734L5LLKS: 42
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp".7 = STRING: WDC_WD20EARS-00MVWB0_WD-WMAZA2183297: 35

 

Unfortunately drive temps are like the only thing Observium doesn't handle automatically. This thread might give you some idea of how to set it up.

Link to post

I've also integrated drive temperatures

 

Nice.  I just updated the plug-in, but I'm not seeing temperatures, either in your installation test, or from my SNMP monitoring server.  Here's the snippet from your installation:

 

 

 

+==============================================================================
| Testing SNMP by listing mounts
+==============================================================================
Looks like snmpd is working... Output:
HOST-RESOURCES-MIB::hrFSMountPoint.1 = STRING: "/mnt/disk1"
HOST-RESOURCES-MIB::hrFSMountPoint.2 = STRING: "/mnt/disk2"
HOST-RESOURCES-MIB::hrFSMountPoint.3 = STRING: "/mnt/disk3"
HOST-RESOURCES-MIB::hrFSMountPoint.22 = STRING: "/var/log"
HOST-RESOURCES-MIB::hrFSMountPoint.25 = STRING: "/boot"


Here's what drive temperatures look like:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp" = No Such Instance currently exists at this OID

-----------------------------------------------------------
snmp has been installed.
Copyright 2015, David Coppit 
Version: 2015.08.24
-----------------------------------------------------------

 

Thanks,

 

John

 

Link to post

I'm not seeing temperatures, either in your installation test, or from my SNMP monitoring server

 

Doh. I forgot to install the helper script. Try version 2015.08.25. Hopefully this time the test output will show drive temps.

 

I'm not 100% sure the temps will be picked up by your monitor. If you can find any docs on what the monitor queries for, I can see about supporting it.

Link to post
Doh. I forgot to install the helper script. Try version 2015.08.25. Hopefully this time the test output will show drive temps.

 

I'm not 100% sure the temps will be picked up by your monitor. If you can find any docs on what the monitor queries for, I can see about supporting it.

 

Hmm...  On the plus side, this plug-in architecture works great!

 

Here's the fresh output - no real change:

 

+==============================================================================
| Testing SNMP by listing mounts
+==============================================================================
Looks like snmpd is working... Output:
HOST-RESOURCES-MIB::hrFSMountPoint.1 = STRING: "/mnt/disk1"
HOST-RESOURCES-MIB::hrFSMountPoint.2 = STRING: "/mnt/disk2"
HOST-RESOURCES-MIB::hrFSMountPoint.3 = STRING: "/mnt/disk3"
HOST-RESOURCES-MIB::hrFSMountPoint.22 = STRING: "/var/log"
HOST-RESOURCES-MIB::hrFSMountPoint.25 = STRING: "/boot"


Here's what drive temperatures look like:
NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp" = No Such Instance currently exists at this OID

-----------------------------------------------------------
snmp has been installed.
Copyright 2015, David Coppit 
Version: 2015.08.25
-----------------------------------------------------------

plugin: updated

 

unRAID can see the temps - as shown in the screen shot below.  To complicate things - My unRAID system is a virtual guest on VMware ESXi.  The disk controller is "passed through" to the VM, and is dedicated to the VM, as are all the attached disks.

 

Thanks,

 

 

John

 

temps.png.368ee7a09190d3fcd6b3e9f6097a3059.png

Link to post

Can you log into your server and run the following?

 

/usr/local/emhttp/plugins/snmp/drive_temps.sh 

 

That worked:

 

root@OshTank:~# /usr/local/emhttp/plugins/snmp/drive_temps.sh 
WDC_WD20EFRX-68EUZN0_WD-WCC4M0927675: 28
WDC_WD20EFRX-68EUZN0_WD-WCC4M4PJF00N: 28
WDC_WD20EFRX-68EUZN0_WD-WCC4M3PHD4DE: 29
WDC_WD20EFRX-68EUZN0_WD-WCC4M0072449: 27
root@OshTank:~# 

Link to post

Hi, I just did and it lists all my hard drives with a colon but no temperatures at all. Drives are all spun down though. Hope this helps, Alex. PS: I'm on the latest version of the plugin.

 

Yeah, I can't always get temps if the disks are spun down.

Link to post

That worked:

 

Well, is the config file updated properly?

 

$ tail -n 1 /usr/local/emhttp/plugins/snmp/snmpd.conf 
extend disktemp /usr/local/emhttp/plugins/snmp/drive_temps.sh

 

What happens if you run it manually?

 

snmpwalk -v 2c localhost -c public 'NET-SNMP-EXTEND-MIB::nsExtendOutLine."disktemp"'

 

If that works, you can try restarting snmpd:

 

bash /etc/rc.d/rc.snmpd stop
bash /etc/rc.d/rc.snmpd start

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.