Using SNMP with a Greenplum Database System

posted Apr 28, 2017, 12:05 PM by Sachchida Ojha
[root@sachi gpadmin]# rpm -qa|grep net-snmp
net-snmp-5.5-49.0.2.el6_5.4.x86_64
net-snmp-libs-5.5-49.0.2.el6_5.4.x86_64
[root@sachi gpadmin]# 


[root@sachi ~]# rpm -qa|grep net-snmp-utils
[root@sachi ~]# yum install net-snmp-utils
Loaded plugins: refresh-packagekit
adobe-linux-i386                                         |  951 B     00:00     
adobe-linux-x86_64                                       |  951 B     00:00     
chromium-el6                                             | 1.9 kB     00:00     
google-chrome                                            |  951 B     00:00     
google-chrome/primary                                    | 1.9 kB     00:00     
google-chrome                                                               3/3
google-chrome-32bit                                      |  951 B     00:00     
google-chrome-32bit/primary                              | 1.9 kB     00:00     
google-chrome-32bit                                                         3/3
google-chrome-64bit                                      |  951 B     00:00     
google-chrome-64bit/primary                              | 1.9 kB     00:00     
google-chrome-64bit                                                         3/3
gphd-admin-localrepo                                     | 2.9 kB     00:00 ... 
public_ol6_UEK_base                                      | 1.2 kB     00:00     
public_ol6_UEK_latest                                    | 1.2 kB     00:00     
public_ol6_latest                                        | 1.4 kB     00:00     
public_ol6_latest/primary                                |  41 MB     00:04     
public_ol6_latest                                                   26210/26210
rpmforge                                                 | 1.9 kB     00:00     
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package net-snmp-utils.x86_64 1:5.5-49.0.2.el6_5.4 will be installed
--> Processing Dependency: net-snmp-libs = 1:5.5-49.0.2.el6_5.4 for package: 1:net-snmp-utils-5.5-49.0.2.el6_5.4.x86_64
--> Running transaction check
---> Package net-snmp-libs.x86_64 1:5.5-49.0.1.el6 will be updated
--> Processing Dependency: net-snmp-libs = 1:5.5-49.0.1.el6 for package: 1:net-snmp-5.5-49.0.1.el6.x86_64
---> Package net-snmp-libs.x86_64 1:5.5-49.0.2.el6_5.4 will be an update
--> Running transaction check
---> Package net-snmp.x86_64 1:5.5-49.0.1.el6 will be updated
---> Package net-snmp.x86_64 1:5.5-49.0.2.el6_5.4 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package           Arch      Version                 Repository            Size
================================================================================
Installing:
 net-snmp-utils    x86_64    1:5.5-49.0.2.el6_5.4    public_ol6_latest    174 k
Updating for dependencies:
 net-snmp          x86_64    1:5.5-49.0.2.el6_5.4    public_ol6_latest    306 k
 net-snmp-libs     x86_64    1:5.5-49.0.2.el6_5.4    public_ol6_latest    1.5 M

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       2 Package(s)

Total download size: 2.0 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): net-snmp-5.5-49.0.2.el6_5.4.x86_64.rpm            | 306 kB     00:00     
(2/3): net-snmp-libs-5.5-49.0.2.el6_5.4.x86_64.rpm       | 1.5 MB     00:00     
(3/3): net-snmp-utils-5.5-49.0.2.el6_5.4.x86_64.rpm      | 174 kB     00:00     
--------------------------------------------------------------------------------
Total                                           2.1 MB/s | 2.0 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : 1:net-snmp-libs-5.5-49.0.2.el6_5.4.x86_64                    1/5 
/sbin/ldconfig: libraries libstdc++.so.6 and libstdc++.so.6.0.13 in directory /usr/lib have same soname but different type.
/sbin/ldconfig: /usr/lib/libstdc++.so.6 is not a symbolic link

  Installing : 1:net-snmp-utils-5.5-49.0.2.el6_5.4.x86_64                   2/5 
  Updating   : 1:net-snmp-5.5-49.0.2.el6_5.4.x86_64                         3/5 
  Cleanup    : 1:net-snmp-5.5-49.0.1.el6.x86_64                             4/5 
  Cleanup    : 1:net-snmp-libs-5.5-49.0.1.el6.x86_64                        5/5 
  Verifying  : 1:net-snmp-libs-5.5-49.0.2.el6_5.4.x86_64                    1/5 
  Verifying  : 1:net-snmp-utils-5.5-49.0.2.el6_5.4.x86_64                   2/5 
  Verifying  : 1:net-snmp-5.5-49.0.2.el6_5.4.x86_64                         3/5 
  Verifying  : 1:net-snmp-libs-5.5-49.0.1.el6.x86_64                        4/5 
  Verifying  : 1:net-snmp-5.5-49.0.1.el6.x86_64                             5/5 

Installed:
  net-snmp-utils.x86_64 1:5.5-49.0.2.el6_5.4                                    

Dependency Updated:
  net-snmp.x86_64 1:5.5-49.0.2.el6_5.4                                          
  net-snmp-libs.x86_64 1:5.5-49.0.2.el6_5.4                                     

Complete!
[root@sachi ~]# 

[root@sachi gpadmin]# rpm -qa|grep net-snmp
net-snmp-utils-5.5-49.0.2.el6_5.4.x86_64
net-snmp-5.5-49.0.2.el6_5.4.x86_64
net-snmp-libs-5.5-49.0.2.el6_5.4.x86_64
[root@sachi gpadmin]# 

[root@sachi ~]# snmpwalk
No hostname specified.
USAGE: snmpwalk [OPTIONS] AGENT [OID]

  Version:  5.5
  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
  E {OID}:  End the walk at the specified OID


[root@sachi ~]# service snmpd status
snmpd (pid 26678) is running...
[root@sachi ~]# snmpwalk -v 1 -c public localhost .1.3.6.1.2.1.1.1.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux sachi 2.6.32-100.34.1.el6uek.x86_64 #1 SMP Wed May 25 17:46:45 EDT 2011 x86_64
[root@sachi ~]# 

[20:05 sachi@sachi ~] > su
Password: 
[root@sachi sachi]# source $GPHOME/greenplum_path.sh
bash: /greenplum_path.sh: No such file or directory
[root@sachi sachi]# export GPHOME=/usr/local/greenplum-db/
[root@sachi sachi]# source $GPHOME/greenplum_path.sh
[root@sachi sachi]# ls -l /usr/share/snmp/mibs

[root@sachi sachi]# cp $GPHOME/share/postgresql/NETWORK-SERVICES-MIB.txt   /usr/share/snmp/mibs
cp: overwrite `/usr/share/snmp/mibs/NETWORK-SERVICES-MIB.txt'? y
[root@sachi sachi]# cp $GPHOME/share/postgresql/GPDB-MIB.txt /usr/share/snmp/mibs
[root@sachi sachi]# cp $GPHOME/share/postgresql/RDBMS-MIB.txt  /usr/share/snmp/mibs

[root@sachi sachi]# vi /etc/snmp/snmpd.conf

add line

master agentx

[21:49 sachi@sachi ~] > su - gpadmin
Password: 
[gpadmin@sachi ~]$ psql -d postgres -f $GPHOME/share/postgresql/gpsnmpd.sql 
psql:/usr/local/greenplum-db/./share/postgresql/gpsnmpd.sql:6: NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "gpsnmpd_rdbmsdbtable_pkey" for table "gpsnmpd_rdbmsdbtable"
CREATE TABLE
psql:/usr/local/greenplum-db/./share/postgresql/gpsnmpd.sql:11: NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'vendor_name' as the Greenplum Database data distribution key for this table.
HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
CREATE TABLE
[gpadmin@sachi ~]$ 
Comments