SNMP, atau Simple Network Management Protocol, banyak digunakan untuk berkomunikasi dan memantau perangkat jaringan, seperti router, server, switch dan yang lainnya.
Kali ini, kita akan memasang atau menginstall serta mengkonfigurasi SNMP Agent di server dengan Sistem Operasi linux CentOS, ikuti langkah-langkahnya sebagai berikut:
- Install SNMP
[root@ns1 ~]# yum install net-snmp net-snmp-utils -y
- Konfigurasi SNMP
[root@ns1 ~]# cd /etc/snmp [root@ns1 snmp]# cp snmpd.conf snmpd.conf.ori
[root@ns1 snmp]# nano snmpd.conf #### # First, map the community name "public" into a "security name" # sec.name source community #com2sec notConfigUser default public com2sec notConfigUser default public@MySNMP #### # #### # Third, create a view for us to let the group have rights to: # Make at least snmpwalk -v 1 localhost -c public system fast again. # name incl/excl subtree mask(optional) view systemview included .1.3.6.1.2.1.1 view systemview included .1.3.6.1.2.1.25.1.1 view all included .1 #### # #### # Finally, grant the group read-only access to the systemview view. # group context sec.model sec.level prefix read write notif # access notConfigGroup "" any noauth exact systemview none none access notConfigGroup "" any noauth exact all none none # ----------------------------------------------------------------------------- # YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY # KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO # SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. ## sec.name source community #com2sec local localhost COMMUNITY #com2sec mynetwork NETWORK/24 COMMUNITY com2sec local localhost public@MySNMP com2sec mynetwork 0.0.0.0/0 public@MySNMP ## group.name sec.model sec.name # ############################################################################### # System contact information # # It is also possible to set the sysContact and sysLocation system # variables through the snmpd.conf file: #syslocation Unknown (edit /etc/snmp/snmpd.conf) #syscontact Root <root@localhost> (configure /etc/snmp/snmp.local.conf) syslocation SMKN 1 Klaten syscontact
This email address is being protected from spambots. You need JavaScript enabled to view it. # # Check the / partition and make sure it contains at least 10 megs. #disk / 10000 disk / # --------------------------------------------------------------------------------------
- Konfigurasi firewall
[root@ns1 snmp]# firewall-cmd --permanent --add-port=161/udp [root@ns1 snmp]# firewall-cmd --reload [root@ns1 snmp]# firewall-cmd --list-all public (active) target: default icmp-block-inversion: no interfaces: eno1 sources: services: cpanel dhcpv6-client ssh ports: 161/udp protocols: masquerade: no forward-ports: source-ports: icmp-blocks: rich rules:
- Pengujian
[root@ns1 snmp]# service snmpd start [root@ns1 snmp]# systemctl enable snmpd [root@ns1 snmp]# snmpwalk -v 2c -c public@MySNMP -O e localhost DISMAN-EVENT-MIB::mteEventNotificationObjectsOwner."_snmpd".'_linkDown' = STRING: _snmpd DISMAN-EVENT-MIB::mteEventNotificationObjectsOwner."_snmpd".'_linkUp' = STRING: _snmpd DISMAN-EVENT-MIB::mteEventNotificationObjectsOwner."_snmpd".'_mteTriggerFailure' = STRING: _snmpd DISMAN-EVENT-MIB::mteEventNotificationObjectsOwner."_snmpd".'_mteTriggerFalling' = STRING: _snmpd DISMAN-EVENT-MIB::mteEventNotificationObjectsOwner."_snmpd".'_mteTriggerFired' = STRING: _snmpd DISMAN-EVENT-MIB::mteEventNotificationObjectsOwner."_snmpd".'_mteTriggerRising' = STRING: _snmpd DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_linkDown' = STRING: _linkUpDown DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_linkUp' = STRING: _linkUpDown DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerFailure' = STRING: _triggerFail DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerFalling' = STRING: _triggerFire DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerFired' = STRING: _triggerFire DISMAN-EVENT-MIB::mteEventNotificationObjects."_snmpd".'_mteTriggerRising' = STRING: _triggerFire NOTIFICATION-LOG-MIB::nlmConfigGlobalEntryLimit.0 = Gauge32: 1000 NOTIFICATION-LOG-MIB::nlmConfigGlobalAgeOut.0 = Gauge32: 1440 minutes NOTIFICATION-LOG-MIB::nlmStatsGlobalNotificationsLogged.0 = Counter32: 0 notifications NOTIFICATION-LOG-MIB::nlmStatsGlobalNotificationsBumped.0 = Counter32: 0 notifications SCTP-MIB::sctpCurrEstab.0 = Gauge32: 0 SCTP-MIB::sctpActiveEstabs.0 = Counter32: 0 SCTP-MIB::sctpPassiveEstabs.0 = Counter32: 0 SCTP-MIB::sctpAborteds.0 = Counter32: 0 SCTP-MIB::sctpShutdowns.0 = Counter32: 0 SCTP-MIB::sctpOutOfBlues.0 = Counter32: 0 SCTP-MIB::sctpChecksumErrors.0 = Counter32: 0 SCTP-MIB::sctpOutCtrlChunks.0 = Counter64: 0 SCTP-MIB::sctpOutOrderChunks.0 = Counter64: 0 SCTP-MIB::sctpOutUnorderChunks.0 = Counter64: 0 SCTP-MIB::sctpInCtrlChunks.0 = Counter64: 0 SCTP-MIB::sctpInOrderChunks.0 = Counter64: 0 SCTP-MIB::sctpInUnorderChunks.0 = Counter64: 0 SCTP-MIB::sctpFragUsrMsgs.0 = Counter64: 0 SCTP-MIB::sctpReasmUsrMsgs.0 = Counter64: 0 SCTP-MIB::sctpOutSCTPPacks.0 = Counter64: 0 SCTP-MIB::sctpInSCTPPacks.0 = Counter64: 0 SCTP-MIB::sctpDiscontinuityTime.0 = Timeticks: (0) 0:00
- Selesai
Semoga bermanfaat