Temat: digitemp - temperatura po snmp

Witam, proszę o pomoc w konfiguracji snmp. Chciałem odczytywać temperaturę po smnp  z 1wire, zainstalowałem digitemp oraz  snmpd .
temperaturę odczytuje  z digitemp-a komendą:

digitemp_DS9097U -a -q -c  /etc/digitemp.conf | awk '{print $7}'

komenda zwraca mi poprawną temperaturę.Teraz w /etc/snmp/snmpd.conf dopisałem linikę na końcu:

extend .1.3.6.1.4.1.2021.2000.1 temp0 /var/lib/snmp/checktemp

W lokalizacji /var/lib/snmp utworzyłem plik checktemp w którym mam taki skrypt:

#!/bin/bash
digitemp_DS9097U -a -q -c /etc/digitemp.conf | awk '{print $7}'

oczywiście nadałem plikowi checktemp uprawnienia 750. Niestety jak sprawdzę za pomocą snmpwalk :

root@debian:/var/lib/snmp# snmpwalk -v1 -c public localhost .1.3.6.1.4.1.2021.2300.2
End of MIB
root@debian:/var/lib/snmp#

nie  zwraca mi wyniku w postaci temperatury, nie bardzo wiem co dalej, pewnie problem jest z uprawnieniami użytkownika snmp, lecz nie bardzo umie sobie z tym poradzić.Przeładowałem usługę snmp, i zrobiłem restart serwera.
Proszę o pomoc.
Dziękuje i pozdrawiam
tipsntrix

2

Odp: digitemp - temperatura po snmp

777 daj, może uruchamiasz snmp na innych uprawnieniach i nie może tego wykonać.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

3

Odp: digitemp - temperatura po snmp

Dziękuje za odpowiedz, dałem 777 skryptowi , dalej nic.
Zerkniesz na ustawienia użytkowników?

snmp:x:108:110::/var/lib/snmp:/bin/bash

dałem dostęp snmp do powłoki i nie pomogło...

4

Odp: digitemp - temperatura po snmp

Nie pamiętam - w snmp możesz jakiś debug włączyć zeby zobaczy co wykonuje?

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

5

Odp: digitemp - temperatura po snmp

jest, ale coś nie działa, zerknij świeżym okiem:

USAGE: snmpwalk [OPTIONS] AGENT [OID]

  Version:  5.4.3
  Web:      http://www.net-snmp.org/
  Email:    net-snmp-coders@lists.sourceforge.net

OPTIONS:
  -h, --help            display this help message
  -H                    display configuration file directives understood
  -v 1|2c|3             specifies SNMP version to use
  -V, --version         display package version number
SNMP Version 1 or 2c specific
  -c COMMUNITY          set the community string
SNMP Version 3 specific
  -a PROTOCOL           set authentication protocol (MD5|SHA)
  -A PASSPHRASE         set authentication protocol pass phrase
  -e ENGINE-ID          set security engine ID (e.g. 800000020109840301)
  -E ENGINE-ID          set context engine ID (e.g. 800000020109840301)
  -l LEVEL              set security level (noAuthNoPriv|authNoPriv|authPriv)
  -n CONTEXT            set context name (e.g. bridge1)
  -u USER-NAME          set security name (e.g. bert)
  -x PROTOCOL           set privacy protocol (DES|AES)
  -X PASSPHRASE         set privacy protocol pass phrase
  -Z BOOTS,TIME         set destination engine boots/time
General communication options
  -r RETRIES            set the number of retries
  -t TIMEOUT            set the request timeout (in seconds)
Debugging
  -d                    dump input/output packets in hexadecimal
  -D TOKEN[,...]        turn on debugging output for the specified TOKENs
                           (ALL gives extremely verbose debugging output)
General options
  -m MIB[:...]          load given list of MIBs (ALL loads everything)
  -M DIR[:...]          look in given list of directories for MIBs
  -P MIBOPTS            Toggle various defaults controlling MIB parsing:
                          u:  allow the use of underlines in MIB symbols
                          c:  disallow the use of "--" to terminate comments
                          d:  save the DESCRIPTIONs of the MIB objects
                          e:  disable errors when MIB symbols conflict
                          w:  enable warnings when MIB symbols conflict
                          W:  enable detailed warnings when MIB symbols conflict
                          R:  replace MIB symbols from latest module
  -O OUTOPTS            Toggle various defaults controlling output display:
                          0:  print leading 0 for single-digit hex characters
                          a:  print all strings in ascii format
                          b:  do not break OID indexes down
                          e:  print enums numerically
                          E:  escape quotes in string indices
                          f:  print full OIDs on output
                          n:  print OIDs numerically
                          q:  quick print for easier parsing
                          Q:  quick print with equal-signs
                          s:  print only last symbolic element of OID
                          S:  print MIB module-id plus last element
                          t:  print timeticks unparsed as numeric integers
                          T:  print human-readable text along with hex strings
                          u:  print OIDs using UCD-style prefix suppression
                          U:  don't print units
                          v:  print values only (not OID = value)
                          x:  print all strings in hex format
                          X:  extended index format
  -I INOPTS             Toggle various defaults controlling input parsing:
                          b:  do best/regex matching to find a MIB node
                          h:  don't apply DISPLAY-HINTs
                          r:  do not check values for range/type legality
                          R:  do random access to OID labels
                          u:  top-level OIDs must have '.' prefix (UCD-style)
                          s SUFFIX:  Append all textual OIDs with SUFFIX before parsing
                          S PREFIX:  Prepend all textual OIDs with PREFIX before parsing
  -L LOGOPTS            Toggle various defaults controlling logging:
                          e:           log to standard error
                          o:           log to standard output
                          n:           don't log at all
                          f file:      log to the specified file
                          s facility:  log to syslog (via the specified facility)

                          (variants)
                          [EON] pri:   log to standard error, output or /dev/null for level 'pri' and above
                          [EON] p1-p2: log to standard error, output or /dev/null for levels 'p1' to 'p2'
                          [FS] pri token:    log to file/syslog for level 'pri' and above
                          [FS] p1-p2 token:  log to file/syslog for levels 'p1' to 'p2'
  -C APPOPTS            Set various application specific behaviours:
                          p:  print the number of variables found
                          i:  include given OID in the search range
                          I:  don't include the given OID, even if no results are returned
                          c:  do not check returned OIDs are increasing
                          t:  Display wall-clock time to complete the request

więc biorę tak:

root@debian:/var/lib/snmp# snmpwalk -v1 -L f file:/var/log/snmp -c public 127.0.0.1 .1.3.6.1.4.1.2021.2300.2
End of MIB

może składnia nie taka, ale duuużo kombinacji wypróbowałem..

6

Odp: digitemp - temperatura po snmp

Ale nie w snmpwalk tylko w samym demonie snmp.

Masz niepotrzebny router, uszkodzony czy nie - chętnie przygarnę go.

7

Odp: digitemp - temperatura po snmp

jedyne co mam w logu po wykonaniu skryptu to :

Feb  3 14:37:29 debian snmpd[1910]: Connection from UDP: [127.0.0.1]:44210->[127.0.0.1]