Wise people learn when they can; fools learn when they must - Arthur Wellesley

Sunday, 16 September 2018

45 - SNMP BASICS -P2


                              45 - SNMP BASICS -P2

Other post under SNMP-Basics
SNMP-BASICS P1

HOW TO INSTAALL AND CONFIGURE SNMP IN LINUX (RHEL6 & RHEL7),

The purpose of installing SNMP (Simple Network Transfer Protocol) is to monitor host resources like CPU, Memory, Network and Disk Utilization etc.

Required Packages,

net-snmp, net-snmp-libs, net-snmp-utils


net-snmp  The SNMP Agent Daemon and documentation. This package is required for exporting performance data.
net-snmp-libs  The netsnmp library and the bundled management information bases (MIBs). This package is required for exporting performance data.
net-snmp-utils SNMP clients such as snmpget and snmpwalk. This package is required in order to query a system's performance data over SNMP.

Default Configuration File,

/etc/snmp/snmpd.conf

Daemon,

snmpd

[root@rhel7-server ~]# cat /etc/sysconfig/snmpd
# snmpd command line options
# '-f' is implicitly added by snmpd systemd unit file
# OPTIONS="-LS0-6d"

What is this “OPTIONS” flag in /etc/sysconfig/snmpd

SNMP daemon startup attribute(s)

L    Logging
S    Syslog
D    Daemon
-Ls  Log messages via syslog

Syslog Daemon Options
-Lsd Log Syslog Daemon (default)
-Lsd Log Syslog Warning Message
-LSwd or -Ls4d Log Syslog Error Message

Logging Facility Table
Numeric  Character  Log       Logging Purpose
-Value   -Value     -Type    
0           !     LOG_EMERG   Emergencies – System is unusable
1           a     LOG_ALERT   Alerts – Immediate action needed
2           b     LOG_CRIT    Critical – Critical conditions
3           c     LOG_ERR     Error – Error conditions
4           e     LOG_WARNING Warnings – Warning conditions
5           n     LOG_NOTICE  Notifications – Informational messages
6           i     LOG_INFO    Informational – Normal but significant conditions
7           d     LOG_DEBUG   Debug – Debugging messages

Let’s search snmp packages are available in our system or not,

[root@rhel7-server ~]# rpm -qa |grep net-snmp*
net-snmp-5.7.2-18.el7.x86_64
net-snmp-libs-5.7.2-18.el7.x86_64
net-snmp-agent-libs-5.7.2-18.el7.x86_64
net-snmp-utils-5.7.2-18.el7.x86_64

All required packages are available, if not available then we can install them via yum install.

# yum install -y net-snmp net-snmp-utils net-snmp-libs
Loaded plugins: langpacks, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
localrepo                                                                                                | 2.9 kB  00:00:00
Package 1:net-snmp-5.7.2-18.el7.x86_64 already installed and latest version
Package 1:net-snmp-utils-5.7.2-18.el7.x86_64 already installed and latest version
Package 1:net-snmp-libs-5.7.2-18.el7.x86_64 already installed and latest version
Nothing to do

# mv /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.org

If we cat the default “/etc/snmp/snmpd.conf” file, we can see it’s a long and heavily commented file.

To see the uncommented values,

# grep -v "^$" /etc/snmp/snmpd.conf | grep -v '^ *#'
com2sec notConfigUser  default       public
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser
view    systemview    included   .1.3.6.1.2.1.1
view    systemview    included   .1.3.6.1.2.1.25.1.1
access  notConfigGroup ""      any       noauth    exact  systemview none none
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
dontLogTCPWrappersConnects yes

Intersection of snmpd.conf

com2sec NAME SOURCE COMMUNITY
This directive specifies the mapping from a source/community pair to a security name. SOURCE can be a hostname, a subnet, or the word "default".  A subnet can be specified as IP/MASK or IP/BITS. For example, given a directive "com2sec myLocal 10.10.10.0/24 public" then this would match requests from IP addresses 10.10.10.0 through to 10.10.10.255, but not one from 10.10.11.1 or similar. The first source/community combination
that matches the incoming packet is selected.

DEFAULT VALUE,
#       sec.name        source        community
com2sec notConfigUser  default       public

REPLACE WITH,
com2sec local     localhost           public
com2sec mynetwork 192.168.0.0/24      public

group NAME MODEL SECURITY
This directive defines the mapping from  securitymodel/security-name to group. MODEL is one of v1, v2c, or usm.

DEFAULT VALUE,
#       groupName       securityModel  securityName
group   notConfigGroup v1           notConfigUser
group   notConfigGroup v2c           notConfigUser

REPLACE WITH,
group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

view NAME TYPE SUBTREE [MASK]
This defines the named  view. TYPE is either included or
excluded.  MASK is a list of hex octets, separated by '.' or
':'. The MASK defaults to "ff" if not specified.
The reason for the mask is, that it allows you to control access
to one row in a table, in a relatively simple way.
.1 will give access to entire tree.

DEFAULT VALUE,
# name           incl/excl     subtree         mask(optional)
view    systemview    included   .1.3.6.1.2.1.1

REPLACE WITH,
view all    included                    .1    80

access NAME CONTEXT MODEL LEVEL PREFX READ WRITE NOTIFY
The access directive maps from group/security model/security
level to a view. MODEL is one of any, v1, v2c, or usm.  LEVEL
is one of noauth, auth, or priv. PREFX specifies how CONTEXT
should be matched against  the context of the incoming pdu,
either exact or  prefix. READ, WRITE and NOTIFY specifies the
view to be used for the corresponding access.  For v1 or v2c
access, LEVEL will be noauth, and CONTEXT will be empty.

DEFAULT VALUE,
#group context     sec.model  sec.level  prefix   read     write notif
access  notConfigGroup ""  any  noauth    exact  systemview none none

REPLACE WITH,
access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

DEFAULT VALUE,
syslocation Unknown (edit /etc/snmp/snmpd.conf)
syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf)

REPLACE WITH,
syslocation MY-SNMP-LAB , 192.168.135.133
syscontact Anurag <anurag@localhost.com>

Now final snmpd.conf will look like as,

[root@rhel7-server ~]# cat /etc/snmp/snmpd.conf
com2sec local     localhost           public
com2sec mynetwork 192.168.0.0/24      public

group MyRWGroup v1         local
group MyRWGroup v2c        local
group MyRWGroup usm        local
group MyROGroup v1         mynetwork
group MyROGroup v2c        mynetwork
group MyROGroup usm        mynetwork

view all    included                            .1    80

access MyROGroup ""      any       noauth    exact  all    none   none
access MyRWGroup ""      any       noauth    exact  all    all    none

syslocation MY-SNMP-LAB, 192.168.135.133
syscontact Anurag anurag@localhost.com

Activate at boot and start the snmp service,

[root@rhel7-server ~]# systemctl enable snmpd
ln -s '/usr/lib/systemd/system/snmpd.service' '/etc/systemd/system/multi-user.target.wants/snmpd.service'
[root@rhel7-server ~]# systemctl start snmpd
[root@rhel7-server ~]# systemctl status snmpd
snmpd.service - Simple Network Management Protocol (SNMP) Daemon.
   Loaded: loaded (/usr/lib/systemd/system/snmpd.service; enabled)
   Active: active (running) since Sat 2018-09-08 18:52:52 IST; 6 days ago
 Main PID: 17803 (snmpd)
   CGroup: /system.slice/snmpd.service
           └─17803 /usr/sbin/snmpd -LS0-6d -f

Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 08 18:53:03 rhel7-server snmpd[17803]: Connection from UDP: [127.0.0.1]:44373->[127.0.0.1]:161
Sep 15 17:15:50 rhel7-server systemd[1]: Started Simple Network Management Protocol (SNMP) Daemon..

# snmpwalk -v2c -c public localhost system |more -10
SNMPv2-MIB::sysDescr.0 = STRING: Linux rhel7-server 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 2014
x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (17294) 0:02:52.94
SNMPv2-MIB::sysContact.0 = STRING: Anurag <anurag@localhost.com>
SNMPv2-MIB::sysName.0 = STRING: rhel7-server
SNMPv2-MIB::sysLocation.0 = STRING: MY-SNMP-LAB, 192.168.135.133
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance

Though the above snmpd configuration is working but from below commands we can see that they are unable to parse MIB’s.

# snmpget -v 1 -c "public" localhost .1.3.6.1.4.1.40310.1
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: SNMPv2-SMI::enterprises.40310.1

# snmpwalk -v 1 -c public localhost .1
End of MIB

# snmpget -v 1 -c "public" localhost .1.3.6.1.4.1.2021.9.1.7.1
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: UCD-SNMP-MIB::dskAvail.1

# snmpwalk -v 1 -c public Server_IP .1.3.6.1.4.1.2021.50
getaddrinfo: Server_IP Temporary failure in name resolution
snmpwalk: Unknown host (Server_IP) (Resource temporarily unavailable)

# snmpwalk -v 1 -c public localhost .1.3.6.1.4.1.2021.50
End of MIB

  
Let’s check with another configuration of snmpd,

[root@rhel7-server ~]# vi /etc/snmp/snmpd.conf
#  sec.name  source   community
com2sec local  localhost  private
com2sec mynet  192.168.135.0/24  public
com2sec public  default  public
com2sec6 mynet  fec0::/64  public

#    sec.model sec.name
group mygroup v1  mynet
group mygroup v2c  mynet
group mygroup usm  mynet
group local  v1  local
group local  v2c  local
group local  usm  local
group public v1  public
group public v2c  public
group public usm  public

#   incl/excl subtree      mask
view all  included .1       80
view system included system      fe
view mib2  included .iso.org.dod.internet.mgmt.mib-2 fc

#     context sec.model sec.level prefix read  write notify
access mygroup ""    any noauth  exact mib2  none none
access public ""    any noauth  exact system none none
access local  ""    any noauth  exact all  all  all

syslocation MY-SNMP-LAB , 192.168.135.133
syscontact Anurag <anurag@localhost.com>


Restart the snmpd service,

[root@rhel7-server ~]# systemctl restart snmpd

# snmpget -v 1 -c "public" localhost .1.3.6.1.4.1.2021.9.1.7.1
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: UCD-SNMP-MIB::dskAvail.1

# snmpget -v 1 -c "public" localhost .1.3.6.1.4.1.40310.1
Error in packet
Reason: (noSuchName) There is no such variable name in this MIB.
Failed object: SNMPv2-SMI::enterprises.40310.1

[root@rhel7-server ~]# snmpwalk localhost -c public -v1
SNMPv2-MIB::sysDescr.0 = STRING: Linux rhel7-server 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 2014 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (10961) 0:01:49.61
SNMPv2-MIB::sysContact.0 = STRING: Anurag <anurag@localhost.com>
SNMPv2-MIB::sysName.0 = STRING: rhel7-server
SNMPv2-MIB::sysLocation.0 = STRING: MY-SNMP-LAB , 192.168.135.133
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.7 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.8 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.9 = OID: SNMP-NOTIFICATION-MIB::snmpNotifyFullCompliance
SNMPv2-MIB::sysORID.10 = OID: NOTIFICATION-LOG-MIB::notificationLogMIB
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.2 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.7 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.8 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.9 = STRING: The MIB modules for managing SNMP Notification, plus filtering.
SNMPv2-MIB::sysORDescr.10 = STRING: The MIB module for logging SNMP Notifications.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.10 = Timeticks: (1) 0:00:00.01
End of MIB

Checking same from remote machine,

# snmpwalk -v 2c -c public 192.168.135.133 system
Timeout: No Response from 192.168.135.133
You have new mail in /var/spool/mail/root

# snmpwalk -v 2c -c public 192.168.135.133:161 system
Timeout: No Response from 192.168.135.133:161

It might possible that firewall is blocking the request,
Let’s allow snmp via firewall at “192.168.135.133”

# firewall-cmd --zone=public --add-port=161/udp --permanent
success
# firewall-cmd --zone=public --add-port=161/tcp --permanent
success
# firewall-cmd --zone=public --add-port=162/udp --permanent
success
# firewall-cmd --zone=public --add-port=162/tcp --permanent
success
# firewall-cmd --reload
Success

Now check again,

# snmpwalk -v 2c -c public 192.168.135.133:161 system |head -10
SNMPv2-MIB::sysDescr.0 = STRING: Linux rhel7-server 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 2014 x86_64
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (43908) 0:07:19.08
SNMPv2-MIB::sysContact.0 = STRING: Anurag <anurag@localhost.com>
SNMPv2-MIB::sysName.0 = STRING: rhel7-server
SNMPv2-MIB::sysLocation.0 = STRING: MY-SNMP-LAB , 192.168.135.133
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance

# snmpwalk -Os -c public -v1 192.168.135.133 SNMPv2-MIB::sysDescr.0
sysDescr.0 = STRING: Linux rhel7-server 3.10.0-121.el7.x86_64 #1 SMP Tue Apr 8 10:48:19 EDT 2014 x86_64

# snmpwalk -Os -c public -v1 192.168.135.133 SNMPv2-MIB::sysUpTime.0
sysUpTimeInstance = Timeticks: (89648) 0:14:56.48

OID                           Description
HOST-RESOURCES-MIB::hrSystem     Contains general system information such as uptime, number of users, and number of running processes.
HOST-RESOURCES-MIB::hrStorage   Contains data on memory and file                                    system usage.
HOST-RESOURCES-MIB::hrDevices    Contains a listing of all           processors, network devices, --  and file systems.
HOST-RESOURCES-MIB::hrSWRun      Contains a listing of all running                                  processes.
HOST-RESOURCES-MIB::hrSWRunPerf  Contains memory and CPU statistics    on the process table from HOST-       RESOURCES-MIB::hrSWRun.
HOST-RESOURCES-MIB::hrSWInstalled Contains a listing of the RPM database.

# snmptable -v 2c -c public 192.168.135.133 HOST-RESOURCES-MIB::hrFSTable
SNMP table: HOST-RESOURCES-MIB::hrFSTable

 hrFSIndex   hrFSMountPoint hrFSRemoteMountPoint                        hrFSType hrFSAccess hrFSBootable hrFSStorageIndex hrFSLastFullBackupDate hrFSLastPartialBackupDate
         1              "/"                   "" HOST-RESOURCES-TYPES::hrFSOther  readWrite         true               31          0-1-1,0:0:0.0             0-1-1,0:0:0.0
         6       "/dev/shm"                   "" HOST-RESOURCES-TYPES::hrFSOther  readWrite        false               36          0-1-1,0:0:0.0             0-1-1,0:0:0.0
         8           "/run"                   "" HOST-RESOURCES-TYPES::hrFSOther  readWrite        false               38          0-1-1,0:0:0.0             0-1-1,0:0:0.0
         9 "/sys/fs/cgroup"                   "" HOST-RESOURCES-TYPES::hrFSOther  readWrite        false               39          0-1-1,0:0:0.0             0-1-1,0:0:0.0
        29          "/home"                   "" HOST-RESOURCES-TYPES::hrFSOther  readWrite        false               59          0-1-1,0:0:0.0             0-1-1,0:0:0.0
        30          "/boot"                   "" HOST-RESOURCES-TYPES::hrFSOther  readWrite        false               60          0-1-1,0:0:0.0             0-1-1,0:0:0.0


FILE SYSTEM AND DISK INFO,

# snmptable -v 2c -c public 192.168.135.133 HOST-RESOURCES-MIB::hrStorage
Was that a table? HOST-RESOURCES-MIB::hrStorage

# snmpwalk -v 2c -c public 192.168.135.133 HOST-RESOURCES-MIB::hrStorage |head -10
HOST-RESOURCES-MIB::hrMemorySize.0 = INTEGER: 1079164 KBytes
HOST-RESOURCES-MIB::hrStorageIndex.1 = INTEGER: 1
HOST-RESOURCES-MIB::hrStorageIndex.3 = INTEGER: 3
HOST-RESOURCES-MIB::hrStorageIndex.6 = INTEGER: 6
HOST-RESOURCES-MIB::hrStorageIndex.7 = INTEGER: 7
HOST-RESOURCES-MIB::hrStorageIndex.8 = INTEGER: 8
HOST-RESOURCES-MIB::hrStorageIndex.10 = INTEGER: 10
HOST-RESOURCES-MIB::hrStorageIndex.31 = INTEGER: 31
HOST-RESOURCES-MIB::hrStorageIndex.36 = INTEGER: 36
HOST-RESOURCES-MIB::hrStorageIndex.38 = INTEGER: 38

# snmptable -v 2c -c public 192.168.135.133 HOST-RESOURCES-MIB::hrStorageTable
SNMP table: HOST-RESOURCES-MIB::hrStorageTable

 hrStorageIndex hrStorageType  hrStorageDescr hrStorageAllocationUnits hrStorageSize hrStorageUsed hrStorageAllocationFailures
          1  HOST-RESOURCES-TYPES::hrStorageRam Physical memory   1024 Bytes    1079164 958184                    ?
          3  HOST-RESOURCES-TYPES::hrStorageVirtualMemory  Virtual memory   1024 Bytes    3176312 958184   ?
          6  HOST-RESOURCES-TYPES::hrStorageOther  Memory buffers   1024 Bytes    1079164  884                    ?
          7  HOST-RESOURCES-TYPES::hrStorageOther   Cached memory   1024 Bytes 424120 424120                             ?
          8  HOST-RESOURCES-TYPES::hrStorageOther   Shared memory   1024 Bytes 1020 1020                         ?
          10 HOST-RESOURCES-TYPES::hrStorageVirtualMemory   Swap space   1024 Bytes    2097148 0                    ?
          31  HOST-RESOURCES-TYPES::hrStorageFixedDisk   /   4096 Bytes    3069440    1777321                             ?
          36  HOST-RESOURCES-TYPES::hrStorageFixedDisk /dev/shm   4096 Bytes 134895   20                        ?
          38  HOST-RESOURCES-TYPES::hrStorageFixedDisk   /run   4096 Bytes 134895  234                          ?
          39  HOST-RESOURCES-TYPES::hrStorageFixedDisk  /sys/fs/cgroup   4096 Bytes 134895 0                    ?
          59  HOST-RESOURCES-TYPES::hrStorageFixedDisk  /home   4096 Bytes 259584 8301                          ?
          60  HOST-RESOURCES-TYPES::hrStorageFixedDisk  /boot   4096 Bytes 127147  30323                         ?


CPU & MEMORY INFO,

# snmpwalk -v2c localhost -c public UCD-SNMP-MIB::systemStats
UCD-SNMP-MIB::ssIndex.0 = INTEGER: 1
UCD-SNMP-MIB::ssErrorName.0 = STRING: systemStats
UCD-SNMP-MIB::ssSwapIn.0 = INTEGER: 0 kB
UCD-SNMP-MIB::ssSwapOut.0 = INTEGER: 0 kB
UCD-SNMP-MIB::ssIOSent.0 = INTEGER: 6 blocks/s
UCD-SNMP-MIB::ssIOReceive.0 = INTEGER: 0 blocks/s
UCD-SNMP-MIB::ssSysInterrupts.0 = INTEGER: 55 interrupts/s
UCD-SNMP-MIB::ssSysContext.0 = INTEGER: 90 switches/s
UCD-SNMP-MIB::ssCpuUser.0 = INTEGER: 0
UCD-SNMP-MIB::ssCpuSystem.0 = INTEGER: 0
UCD-SNMP-MIB::ssCpuIdle.0 = INTEGER: 99
UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 47221
UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 228
UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 31699
UCD-SNMP-MIB::ssCpuRawIdle.0 = Counter32: 26955948
UCD-SNMP-MIB::ssCpuRawWait.0 = Counter32: 10044
UCD-SNMP-MIB::ssCpuRawKernel.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawInterrupt.0 = Counter32: 1
UCD-SNMP-MIB::ssIORawSent.0 = Counter32: 890896
UCD-SNMP-MIB::ssIORawReceived.0 = Counter32: 766650
UCD-SNMP-MIB::ssRawInterrupts.0 = Counter32: 6863783
UCD-SNMP-MIB::ssRawContexts.0 = Counter32: 10381886
UCD-SNMP-MIB::ssCpuRawSoftIRQ.0 = Counter32: 3785
UCD-SNMP-MIB::ssRawSwapIn.0 = Counter32: 0
UCD-SNMP-MIB::ssRawSwapOut.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawSteal.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawGuest.0 = Counter32: 0
UCD-SNMP-MIB::ssCpuRawGuestNice.0 = Counter32: 0

# snmpwalk -v2c localhost -c public UCD-SNMP-MIB::memory
UCD-SNMP-MIB::memIndex.0 = INTEGER: 0
UCD-SNMP-MIB::memErrorName.0 = STRING: swap
UCD-SNMP-MIB::memTotalSwap.0 = INTEGER: 2097148 kB
UCD-SNMP-MIB::memAvailSwap.0 = INTEGER: 2097148 kB
UCD-SNMP-MIB::memTotalReal.0 = INTEGER: 1079164 kB
UCD-SNMP-MIB::memAvailReal.0 = INTEGER: 119592 kB
UCD-SNMP-MIB::memTotalFree.0 = INTEGER: 2216740 kB
UCD-SNMP-MIB::memMinimumSwap.0 = INTEGER: 16000 kB
UCD-SNMP-MIB::memShared.0 = INTEGER: 1020 kB
UCD-SNMP-MIB::memBuffer.0 = INTEGER: 884 kB
UCD-SNMP-MIB::memCached.0 = INTEGER: 423816 kB
UCD-SNMP-MIB::memSwapError.0 = INTEGER: noError(0)
UCD-SNMP-MIB::memSwapErrorMsg.0 = STRING:

FINDING LOAD AVERAGES,

# snmptable -v2c localhost -c public UCD-SNMP-MIB::laTable
SNMP table: UCD-SNMP-MIB::laTable

 laIndex laNames laLoad laConfig laLoadInt laLoadFloat laErrorFlag laErrMessage
       1  Load-1   0.00    12.00         0    0.000000     noError
       2  Load-5   0.01    12.00         1    0.010000     noError
       3 Load-15   0.05    12.00         5    0.050000     noError

FINDING DISK I/O,

# snmptable -v2c localhost -c public UCD-DISKIO-MIB::diskIOTable
SNMP table: UCD-DISKIO-MIB::diskIOTable

 diskIOIndex diskIODevice diskIONRead diskIONWritten diskIOReads diskIOWrites diskIOLA1 diskIOLA5 diskIOLA15 diskIONReadX diskIONWrittenX
           1          sda   392479744      458726400       18630        67266         0         0          0    392479744       458726400
           2         sda1     4781568        2109440        2082         2055         0         0          0      4781568         2109440
           3         sda2   386883072      456616960       16361        65211         0         0          0    386883072       456616960
           4          sr0       49152              0          12            0         0         0          0        49152               0
           5         dm-0   384059392      453672448       16433        69155         0         0          0    384059392       453672448
           6         dm-1     1110016              0         271            0         0         0          0      1110016               0
           7         dm-2     1414656        2944512         587          257         0         0          0      1414656         2944512



NETWORK INFO,

# snmptable -v2c localhost -c public IF-MIB::ifTable

SNMP table: IF-MIB::ifTable

ifIndex ifDescr           ifType ifMtu    ifSpeed  ifPhysAddress ifAdminStatus ifOperStatus ifLastChange ifInOctets ifInUcastPkts ifInNUcastPkts ifInDiscards ifInErrors ifInUnknownProtos ifOutOctets ifOutUcastPkts ifOutNUcastPkts ifOutDiscards ifOutErrors ifOutQLen              ifSpecific
     1      lo softwareLoopback 65536   10000000                  up           up 0:0:00:00.00    1082538         12923              0            0          0                 0     1082538          12923               0             0           0         0 SNMPv2-SMI::zeroDotZero
     2    eth0   ethernetCsmacd  1500 1000000000 0:c:29:9:e3:b8   up           up 0:0:00:00.00    6660791         87786              0            0          0                 0    63286964          50468               0             0           0         0 SNMPv2-SMI::zeroDotZero
     3    eth1   ethernetCsmacd  1500 1000000000 0:c:29:9:e3:cc   up           up 0:0:00:00.00    3030356         43856              0            0          0                 0        3927             25               0             0           0         0 SNMPv2-SMI::zeroDotZero
     4    eth2   ethernetCsmacd  1500 1000000000 0:c:29:9:e3:c2   up           up 0:0:00:00.00    2927462         43486              0            0          0                 0      112282            458               0             0           0         0 SNMPv2-SMI::zeroDotZero

INTERFACES,

# snmpwalk -v2c localhost -c public IF-MIB::ifDescr
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.2 = STRING: eth0
IF-MIB::ifDescr.3 = STRING: eth1
IF-MIB::ifDescr.4 = STRING: eth2

PACKEST IN/OUT FROM PARTICULAR INTERFACES,

# snmpwalk -v2c localhost -c public IF-MIB::ifOutOctets
IF-MIB::ifOutOctets.1 = Counter32: 1108507
IF-MIB::ifOutOctets.2 = Counter32: 63465468
IF-MIB::ifOutOctets.3 = Counter32: 3927
IF-MIB::ifOutOctets.4 = Counter32: 113330

# snmpwalk -v2c localhost -c public IF-MIB::ifInOctets
IF-MIB::ifInOctets.1 = Counter32: 1109250
IF-MIB::ifInOctets.2 = Counter32: 6878263
IF-MIB::ifInOctets.3 = Counter32: 3062944
IF-MIB::ifInOctets.4 = Counter32: 2959002




References and Good Read 
(Very thanks to all for your great Contribution)
https://www.freebsd.org/cgi/man.cgi?query=snmpd.conf&apropos =0&sektion=0&manpath=FreeBSD+5.2-RELEASE +and+Ports&format=html



1 comment: