Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Configure net-snmp with lm-sensors
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 359
Location: the Netherlands

PostPosted: Mon Mar 28, 2016 6:39 am    Post subject: Configure net-snmp with lm-sensors Reply with quote

Hi,

I am trying to remotely monitor my server using snmp. The goal would be to report stuff like temperatures from lm-sensors and other info using net-snmp.
Basic install seems to work (https://wiki.gentoo.org/wiki/Net-SNMP ) and lm-sensors works. However, I cant seem to be able to readout anything useful.


However, (while trying to get lm-sensors to be reported) I can't really find recent documentation or information about how to achieve that.
Also, most information I find seems to be outdated or at least old).


My question would be ( before putting to much time in it):

- Is using net-snmp (still) the way to achieve such a thing as remote monitoring? (If not, what would be the way?)

- If so, is there some information or simple example config to show how to set-up net-snmp and to report lm-sensors?


Thanks,

Alexander.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Thu Mar 31, 2016 9:17 pm    Post subject: Re: Configure net-snmp with lm-sensors Reply with quote

lexflex wrote:
Hi,

I am trying to remotely monitor my server using snmp. The goal would be to report stuff like temperatures from lm-sensors and other info using net-snmp.
Basic install seems to work (https://wiki.gentoo.org/wiki/Net-SNMP ) and lm-sensors works. However, I cant seem to be able to readout anything useful.


However, (while trying to get lm-sensors to be reported) I can't really find recent documentation or information about how to achieve that.
Also, most information I find seems to be outdated or at least old).


My question would be ( before putting to much time in it):

- Is using net-snmp (still) the way to achieve such a thing as remote monitoring? (If not, what would be the way?)

- If so, is there some information or simple example config to show how to set-up net-snmp and to report lm-sensors?


Thanks,

Alexander.


SNMP is a very long established component for monitoring and net-snmp is used in one form or another in more devices and monitoring systems than perhaps anything else in the world. So for a first go at monitoring you are on the right track.

However, if you have only one server to monitor then something like Munin might do the trick, running on the box itself. If you have wider needs (eg switch/WAN connections, printers etc etc) then you might like to look into Icinga or OpenNMS (not in Portage but works on Gentoo nicely) both of which offer alerting etc etc. There's also the OMD (Open Monitoring Distro) for a turnkey Icinga/Nagios/Check_MK/PNP4Nagios etc etc setup which is powerful stuff. Cacti is another great package for graphing stats. All of these have SNMP baked in.

Now back to your first question: net-snmp and lm-sensors. https://github.com/groeck/lm-sensors - there is no direct linkage to net-snmp that I can see in there but there is a sensorsd which can write to rrd files for graphing. With net-snmp you can get it to watch a logfile via a regex and store a number in an OID that you query or it can run a script whenever you hit a particular OID and return the result.

So, my advice is spend some time with SNMP if you want to do monitoring but it looks as though you will have to do some integration work to get data from lm_sensors out through net-snmp via some fairly trivial scripting.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 359
Location: the Netherlands

PostPosted: Sat Apr 09, 2016 4:12 pm    Post subject: Re: Configure net-snmp with lm-sensors Reply with quote

Hi gerdesj,

Thanks for your reply ( i was away so it took some time for me to reply :-) )

gerdesj wrote:

However, if you have only one server to monitor then something like Munin might do the trick, running on the box itself. If you have wider needs (eg switch/WAN connections, printers etc etc) then you might like to look into Icinga or OpenNMS (not in Portage but works on Gentoo nicely) both of which offer alerting etc etc. There's also the OMD (Open Monitoring Distro) for a turnkey Icinga/Nagios/Check_MK/PNP4Nagios etc etc setup which is powerful stuff. Cacti is another great package for graphing stats. All of these have SNMP baked in.


Ideally I would like to monitor multiple machines from one machine, which include a gentoo server, a nas, and a raspberry pi (and some other machines that are swtiched on incidentally like an htpc).

gerdesj wrote:

Now back to your first question: net-snmp and lm-sensors. https://github.com/groeck/lm-sensors - there is no direct linkage to net-snmp that I can see in there but there is a sensorsd which can write to rrd files for graphing. With net-snmp you can get it to watch a logfile via a regex and store a number in an OID that you query or it can run a script whenever you hit a particular OID and return the result.

net-snmp does have an 'lm_sensors' useflag, so i assumed it would somehow activate a coupling between the two, but since there is no further documentation I got somewhat lost... ( see https://wiki.gentoo.org/wiki/Net-SNMP ).


I will look into scripting as you say, or look into one of the options that support snmp.

Alex.
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 621
Location: Yeovil, Somerset, UK

PostPosted: Sat Apr 09, 2016 11:19 pm    Post subject: Re: Configure net-snmp with lm-sensors Reply with quote

I was looking at things from the lm_sensors perspective. Now you mention the USE flag I tried a new Googling recipe. I found this from the old Gentoo wiki:

http://www.gentoo-wiki.info/HOWTO_SNMP_and_MRTG_Made_Easy

Any good? Note the note under the CPU-temp section. I'll dig out emerge and see what I can find at .1.3.6.1.4.1.2021.13.16.2.1.3.1 or there abouts when lm_sensors is added in.

My other advice stands though. If you have multiple things to watch then spending time with Icinga will pay dividends. It is very, very good at the job but needs plenty of investment in time to get to grips with it. Mine watch over 1800 services on over 400 machines spread across the UK. If the text files get a bit boring then "nagiosql" (not in Portage but easy to setup manually) is a good but slightly weird webby front end - probably overkill for a few devices though, but rather handy for hundreds.
Back to top
View user's profile Send private message
lexflex
Guru
Guru


Joined: 05 Mar 2006
Posts: 359
Location: the Netherlands

PostPosted: Mon Apr 11, 2016 6:38 pm    Post subject: Re: Configure net-snmp with lm-sensors Reply with quote

gerdesj wrote:
I found this from the old Gentoo wiki:
http://www.gentoo-wiki.info/HOWTO_SNMP_and_MRTG_Made_Easy
Any good? Note the note under the CPU-temp section. I'll dig out emerge and see what I can find at .1.3.6.1.4.1.2021.13.16.2.1.3.1 or there abouts when lm_sensors is added in.


Thanks!

Although the info in that link seems somewhat outdated I did get further using that part of the snmp-tree ( '1.3.6.1.4' ) .
Another problem appeared to be a permission problem with snmp, giving 'LM-SENSORS-MIB::lmTempSensorsEntry = No more variables left in this MIB View (It is past the end of the MIB tree)' .
By allowing full local access, I can now probe the sensors from the local host:
Code:

alex@server ~ $ snmpwalk -v2c -cpublic 127.0.0.1   .1.3.6.1.4.1.2021.13.16.2.1
LM-SENSORS-MIB::lmTempSensorsIndex.1 = INTEGER: 1
LM-SENSORS-MIB::lmTempSensorsIndex.14 = INTEGER: 14
LM-SENSORS-MIB::lmTempSensorsIndex.15 = INTEGER: 15
LM-SENSORS-MIB::lmTempSensorsDevice.1 = STRING: temp1
LM-SENSORS-MIB::lmTempSensorsDevice.14 = STRING: temp2
LM-SENSORS-MIB::lmTempSensorsDevice.15 = STRING: temp3
LM-SENSORS-MIB::lmTempSensorsValue.1 = Gauge32: 36000
LM-SENSORS-MIB::lmTempSensorsValue.14 = Gauge32: 38000
LM-SENSORS-MIB::lmTempSensorsValue.15 = Gauge32: 29000
alex@server ~ $


So, thanks for your help so far.

Alex.



PS:
Quote:
Mine watch over 1800 services on over 400 machines spread across the UK.

That is impressive, I just want to monitor some stuff at home :-)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum