Difference between revisions of "SNMP: Instalasi & Konfigurasi di Ubuntu"

From OnnoWiki
Jump to navigation Jump to search
(New page: Sumber: http://www.it-slav.net/blogs/2009/02/05/install-and-configure-snmp-on-ubuntu/ This guide describe howto install and configure SNMP on Ubuntu. In an earlier article I have descri...)
 
Line 8: Line 8:
 
   
 
   
  
   
+
  ==Installation==
1.Installation
 
 
 
root@ibsen:~# sudo apt-get install snmpd
 
Reading package lists... Done
 
Building dependency tree     
 
Reading state information... Done
 
The following packages were automatically installed and are no longer required:
 
  libmpich1.0gf libdc1394-22 genisoimage linux-headers-2.6.27-7 libgfortran2 dvd+rw-tools linux-headers-2.6.27-7-generic libcarp-clan-perl libxml-xql-perl libparse-yapp-perl
 
  rdate python-xml localechooser-data gcc-4.2-base libimage-size-perl libdebconfclient0 libvisual-0.4-0 libmyth-python perlmagick libvisual-0.4-plugins libavdevice52
 
Use 'apt-get autoremove' to remove them.
 
The following extra packages will be installed:
 
  libperl5.10 libsensors3 libsnmp-base libsnmp15
 
Suggested packages:
 
  lm-sensors
 
The following NEW packages will be installed:
 
  libperl5.10 libsensors3 libsnmp-base libsnmp15 snmpd
 
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
 
Need to get 2463kB of archives.
 
After this operation, 7987kB of additional disk space will be used.
 
Do you want to continue [Y/n]?
 
  
answer y
+
apt-get install snmpd
  
 
   
 
   
2. Configuration
+
==Configuration==
  
 
Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org
 
Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org
  
mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.org
+
mv /etc/snmp/snmpd.conf  /etc/snmp/snmpd.conf.org
  
 
Create a new /etc/snmp/snmpd.conf file:
 
Create a new /etc/snmp/snmpd.conf file:
  
rocommunity  public
+
rocommunity  public
syslocation  "PDC, Peters DataCenter"
+
syslocation  "PDC, Peters DataCenter"
syscontact  peter@it-slav.net
+
syscontact  peter@it-slav.net
  
 
Make snmpd use the newly created file and make it listen to all interfaces:
 
Make snmpd use the newly created file and make it listen to all interfaces:
  
Edit /etc/default/snmpd
+
==Edit /etc/default/snmpd==
  
 
Change from:
 
Change from:
  
# snmpd options (use syslog, close stdin/out/err).
+
# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
+
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
  
 
To:
 
To:
  
# snmpd options (use syslog, close stdin/out/err).
+
# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
+
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
+
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'
  
 
and restart snmpd
 
and restart snmpd
  
/etc/init.d/snmpd restart
+
/etc/init.d/snmpd restart
  
 
   
 
   
  
 
   
 
   
3. Test
+
==Test==
  
 
Do a snmpwalk from another host against your newly configured host.
 
Do a snmpwalk from another host against your newly configured host.
  
[root@op5 ~]# snmpwalk -v 1 -c public -O e ibsen
+
[root@op5 ~]# snmpwalk -v 1 -c public -O e ibsen
SNMPv2-MIB::sysDescr.0 = STRING: Linux ibsen 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686
+
SNMPv2-MIB::sysDescr.0 = STRING: Linux ibsen 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
+
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (68869) 0:11:28.69
+
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (68869) 0:11:28.69
SNMPv2-MIB::sysContact.0 = STRING: peter@it-slav.net
+
SNMPv2-MIB::sysContact.0 = STRING: peter@it-slav.net
SNMPv2-MIB::sysName.0 = STRING: ibsen
+
SNMPv2-MIB::sysName.0 = STRING: ibsen
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCenter"
+
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCenter"
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
+
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
+
SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance
+
SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
+
SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
+
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
+
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
+
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip
  
 
Yes it works!!
 
Yes it works!!

Revision as of 17:10, 9 March 2014

Sumber: http://www.it-slav.net/blogs/2009/02/05/install-and-configure-snmp-on-ubuntu/


This guide describe howto install and configure SNMP on Ubuntu.

In an earlier article I have described howto set it up on RHES or CentOS, it is slightly different in Ubuntu.


==Installation==
apt-get install snmpd


Configuration

Move existing /etc/snmp/snmpd.conf configuration file to /etc/snmp/snmpd.conf.org

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

Create a new /etc/snmp/snmpd.conf file:

rocommunity  public
syslocation  "PDC, Peters DataCenter"
syscontact  peter@it-slav.net

Make snmpd use the newly created file and make it listen to all interfaces:

Edit /etc/default/snmpd

Change from:

# snmpd options (use syslog, close stdin/out/err).
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'

To:

# snmpd options (use syslog, close stdin/out/err).
#SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 127.0.0.1'
SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid -c /etc/snmp/snmpd.conf'

and restart snmpd

/etc/init.d/snmpd restart



Test

Do a snmpwalk from another host against your newly configured host.

[root@op5 ~]# snmpwalk -v 1 -c public -O e ibsen
SNMPv2-MIB::sysDescr.0 = STRING: Linux ibsen 2.6.27-9-generic #1 SMP Thu Nov 20 21:57:00 UTC 2008 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (68869) 0:11:28.69
SNMPv2-MIB::sysContact.0 = STRING: peter@it-slav.net
SNMPv2-MIB::sysName.0 = STRING: ibsen
SNMPv2-MIB::sysLocation.0 = STRING: "PDC, Peters DataCenter"
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORID.1 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.2 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.3 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.5 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.6 = OID: IP-MIB::ip

Yes it works!!


4. Monitor example

Below is an example of how it looks using op5 Monitor a Nagios based Enterprise Monitor solution.

Optimussnmp-eth0.png


5. Useful links

   op5 Statistics, a cacti based graph tool
   op5 Monitor, an Enterprise Class Monitoring system based on Nagios
   Net-SNMP, an open source implementation of SNMP
   Cacti, an open source graph tool
   Nagios, the number 1 monitor tool



Referensi