Hi,
This post was created as one of our subscriber Shashi.rsb was facing an issue in creating a SNMP trap for server health state, hence I have created this post. Here is a very simple demonstration and configuration to receive the SNMP traps for the health state of a Managed Server running as part of our WebLogic Domain. In this demo we will see how we can configure the SNMP Trap and SNMP Agent to provide us the Health State Information of a WebLogic Server. Usually if the Server’s Health state is HEALTH_OK,
At any point of time our WebLogic server may have in any of the following Health States:
public static final int HEALTH_OK;
public static final int HEALTH_WARN;
public static final int HEALTH_CRITICAL;
public static final int HEALTH_FAILED;
public static final int HEALTH_OVERLOADED;
So based on your requirement you can choose any Health State for SNMP monitoring … I am using HEALTH_OK for this demo.
Also Notice a kind of BUG: http://middlewaremagic.com/weblogic/?p=6149#comment-3264
Step1). Start WeLogic Admin Server and login to Admin Console and then create a SNMP Agent like following:
Step2). Now create a String Monitor By Clicking on “Diagnostics —> SNMP—> ServerSNMPAgent-0—-> String Monitors”
Step3). Now create a Trap Destination “Diagnostics —> SNMP—> ServerSNMPAgent-0—-> Trap Destinations”
Step4). After making all the above configurations your “” file will look ike following:
<snmp-agent-deployment> <name>ServerSNMPAgent-0</name> <enabled>true</enabled> <send-automatic-traps-enabled>true</send-automatic-traps-enabled> <snmp-port>1161</snmp-port> <snmp-trap-version>1</snmp-trap-version> <community-prefix>public</community-prefix> <snmp-trap-destination> <name>TrapDestination-0</name> <host>10.10.10.10</host> <port>1165</port> <community>public</community> <security-level>noAuthNoPriv</security-level> </snmp-trap-destination> <snmp-string-monitor> <name>SNMPStringMonitor-1</name> <enabled-server>AdminServer,MS-1</enabled-server> <monitored-m-bean-type>ServerRuntime</monitored-m-bean-type> <monitored-m-bean-name>MS-1</monitored-m-bean-name> <monitored-attribute-name>HealthState</monitored-attribute-name> <polling-interval>10</polling-interval> <string-to-compare>HEALTH_OK</string-to-compare> <notify-differ>false</notify-differ> <notify-match>false</notify-match> </snmp-string-monitor> <community-based-access-enabled>true</community-based-access-enabled> <snmp-engine-id>ServerSNMPAgent-0</snmp-engine-id> <authentication-protocol>noAuth</authentication-protocol> <privacy-protocol>noPriv</privacy-protocol> <inform-retry-interval>10000</inform-retry-interval> <max-inform-retry-count>1</max-inform-retry-count> <localized-key-cache-invalidation-interval>3600000</localized-key-cache-invalidation-interval> <snmp-access-for-user-m-beans-enabled>false</snmp-access-for-user-m-beans-enabled> <inform-enabled>false</inform-enabled> <master-agent-x-port>1705</master-agent-x-port> <target>AdminServer</target> </snmp-agent-deployment>
Step5). Restart your AdminServer.
Step6). Now start the ”SnmpTrapMonitor like following: (Make Sure to run the “. ./setWLSEnv.sh” to set the environment in the same shell prompt where you are planning to run the following command)
java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 1165
Step7). Now as soon as you will start your Managed Server you will get the following kind of Trap in the above Shell/Command prompt once the ManagedServer (MS-1) have the HEALTH_OK state:
java weblogic.diagnostics.snmp.cmdline.Manager SnmpTrapMonitor -p 1165 Listening on port:1165 --- Snmp Trap Received --- Version : v1 Source : UdpEntity:10.10.10.10:1161 Community : public Enterprise : enterprises.140.625 TrapOID : enterprises.140.625.0.65 RawTrapOID : 1.3.6.1.4.1.140.625.0.65 Trap Objects : { { enterprises.140.625.100.5=Mon Mar 21 20:17:02 IST 2011 } { enterprises.140.625.100.10=MS-1 } } Raw VarBinds : { { enterprises.140.625.100.5=Mon Mar 21 20:17:02 IST 2011 } { enterprises.140.625.100.10=MS-1 } } --- Snmp Trap Received --- Version : v1 Source : UdpEntity:10.10.10.10:1161 Community : public Enterprise : enterprises.140.625 TrapOID : enterprises.140.625.0.75 RawTrapOID : 1.3.6.1.4.1.140.625.0.75 Trap Objects : { { enterprises.140.625.100.5=Mon Mar 21 20:17:11 IST 2011 } { enterprises.140.625.100.10=MS-1 } { enterprises.140.625.100.55=jmx.monitor.error.type } { enterprises.140.625.100.60=null } { enterprises.140.625.100.65=null } { enterprises.140.625.100.70=com.bea:Location=MS-1,Name=MS-1,Type=ServerRuntime } { enterprises.140.625.100.75=ServerRuntime } { enterprises.140.625.100.80=HealthState } } Raw VarBinds : { { enterprises.140.625.100.5=Mon Mar 21 20:17:11 IST 2011 } { enterprises.140.625.100.10=MS-1 } { enterprises.140.625.100.55=jmx.monitor.error.type } { enterprises.140.625.100.60=null } { enterprises.140.625.100.65=null }
.
.
Thanks
Jay SenSharma