Tietokoneiden näyttöjä, joissa näkyy kuvaa automaatiolaboratorion laitteistosta. Monitoreiden takana näkyy sama laitteisto kuin kuvissa.

timohei.net / My Courses / My Courses / Network Technologies for Automation / Zabbix /
SNMP

Install SNMP components

Give all the following commands as root:

$ sudo su
[sudo] password for timohei.net: password
#

Install SNMP package:

# apt-get install snmp

Download common SNMP MIBs:

# apt-get install snmp-mibs-downloader

Install SNMP agent service:

# apt-get install snmpd

Check that snmpd service has started:

# service --status-all
.
.
[+] snmpd
.
.

Starting and stopping the agent

The agent service (snmpd) starts automatically after installation and reboot. It can also be manually started or stopped:

# service snmpd start
# service snmpd stop

Making queries with snmpwalk

Make a query with snmpwalk. You do not need to be root:

$ snmpwalk -Os -c public -v 1 localhost system
sysDescr.0 = STRING: Linux debian-2gb-hel1-2 6.22.0-11-amd64 #1 SMP Debian 1.12.134-1 (2023-01-21) x86_64
sysObjectID.0 = OID: netSnmpAgentOIDs.10
sysUpTimeInstance = Timeticks: (74328) 0:12:23.28
sysContact.0 = STRING: Me 
sysName.0 = STRING: debian-2gb-hel1-2
sysLocation.0 = STRING: Sitting on the Dock of the Bay
sysServices.0 = INTEGER: 72
.
.
.
sysORUpTime.10 = Timeticks: (0) 0:00:00.00
$ snmpwalk localhost -v2c -c public sysName
SNMPv2-MIB::sysName.0 = STRING: debian-2gb-hel1-2
$

Example of MIB for SNMP RFC 3418

Source: Wikipedia
└── SNMPv2-MIB(.1.3.6.1.2.1)
  └── system(.1)
    ├── sysDescr (.1)
    ├── sysObjectID (.2)
    ├── sysUpTime (.3)
    ├── sysName (.5)
    ├── sysContact (.4)
    ├── sysLocation (.6)
    ├── sysServices (.7)
    ├── sysORLastChange (.8)
    └── sysORTable (.9)
      └── sysOREntry (.1)
        ├── sysORIndex (.1)
        ├── sysORID (.2)
        ├── sysORDescr (.3)
        └── sysORUpTime (.4)

To call the value of sysName one would use:

# snmpwalk 10.32.13.36 -v2c -c public sysName
SNMPv2-MIB::sysName.0 = STRING: SOME_HOSTNAME

or

# snmpwalk 10.32.13.36 -v2c -c public .1.3.6.1.2.1.1.5
SNMPv2-MIB::sysName.0 = STRING: SOME_HOSTNAME

or

# snmpwalk 10.32.13.36 -v2c -c public .1.3.6.1.2.1.1.5.0
SNMPv2-MIB::sysName.0 = STRING: SOME_HOSTNAME
Updated 12.4.2023

<<  Previous Page
(3) Installing Zabbix 6.0 LTS on Ubuntu 22.04 LTS
Sivu 4/4First Page >>
(1) Zabbix
© Timo Heikkinen | timo piste heikkinen at oamk piste fi