How to monitor different domains with Glassfish V2 SNMP 1.0

It is possible with Glassfish V2.1 to monitor different domains. In this blog, we will explain how to proceed.

Relationships between domain/DAS/ SNMP

The DAS (Domain administrative server) is the central piece of administration. A DAS is corresponding to a specific domain associated to a given administrative port.


 DAS with server instance, cluster instances within same domain

Glassfish V2.1 allows to create server and cluster instances instances within the same domain. Glassfish SNMP V2.1 allows to monitor SNMP at:

  • DAS level
  • standalone instance level
  • cluster instance level

It is even possible possible to deploy the snmp war file on the DAS, and on cluster instances at the same time by using different SNMP port. This is described in the SNMP documentation at:

Configuring Glassfish SNMP to monitor different domains

In this section, is shown how to monitor different domains through Glassfish SNMP. Let's assume that we create 3 different domains: domain1, domain2, domain3. Those 3 domains need to have 3 different administrative ports (4849, 4850, 4851)

asadmin create-domain --port 4849 domain1 --user admin
asadmin create-domain --port 4850 domain2 --user admin
asadmin create-domain --port 4851 domain3 --user admin

The user needs to  assign a specfic SNMP port for each domain:

asadmin set --port 4849 --user admin server.property.snmp-adapter-port=10163
asadmin set --port 4850 --user admin server.property.snmp-adapter-port=10164
asadmin set --port 4851 --user admin server.property.snmp-adapter-port=10165

The user  should restart each domain for each snmp-adapter port value to be taken account

asadmin stop-domain domain1
asadmin start-domain domain1
asadmin stop-domain domain2
asadmin start-domain domain2
asadmin stop-domain domain3
asadmin start-domain domain3

The user can now deploy the Glassfish snmp war file within each domain

asadmin deploy --port 4849 __assnmp.war
asadmin deploy --port 4850 __assnmp.war
asadmin deploy --port 4851 __assnmp.war



Viewing snmp data within the different domains

snmpwalk -c public -v 1 <hostname>:10163 J2EE-MIB::j2eeDomTable
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain1"
J2EE-MIB::j2eeDomEnterprise.1 = OID: J2EE-MIB::sun
J2EE-MIB::j2eeDomMoStateManaged.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoStatProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoEventProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomSMState.1 = INTEGER: running(4)
J2EE-MIB::j2eeDomSMStartTime.1 = STRING: "Thu Aug 06 10:13:56 MEST 2009"

 snmpwalk -c public -v 1 <hostname>:10164 J2EE-MIB::j2eeDomTable
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain2"
J2EE-MIB::j2eeDomEnterprise.1 = OID: J2EE-MIB::sun
J2EE-MIB::j2eeDomMoStateManaged.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoStatProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoEventProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomSMState.1 = INTEGER: running(4)
J2EE-MIB::j2eeDomSMStartTime.1 = STRING: "Thu Aug 06 10:11:43 MEST 2009"
snmpwalk -c public -v 1 hostname:10165 J2EE-MIB::j2eeDomTable
J2EE-MIB::j2eeDomMoName.1 = STRING: "domain3"
J2EE-MIB::j2eeDomEnterprise.1 = OID: J2EE-MIB::sun
J2EE-MIB::j2eeDomMoStateManaged.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoStatProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomMoEventProv.1 = INTEGER: false(2)
J2EE-MIB::j2eeDomSMState.1 = INTEGER: running(4)
J2EE-MIB::j2eeDomSMStartTime.1 = STRING: "Thu Aug 06 10:14:37 MEST 2009" 
  

TroubleShooting Glassfish Snmp

If you are not able to see the SNMP values, you check the glassfish server.log log file, and see within the log file to check that the SNMP value is correct for this specific domain:

  • SNMP Adapter Port: <value port> ( or example 10164 in case of domain2)



Comments:

Thank you for this information! Unfortunately, the asadmin set command did not work for me:

# asadmin set --port 4848 --user admin server.property.snmp-adapter-port=10166
Please enter the admin password>
Remote host closed connection during handshake
CLI137 Command set failed.

Any thoughts on why this failed would be appreciated.

Thank you.

Posted by skeeny on August 12, 2009 at 03:42 AM PDT #

There was some typos in the middle of my blog.
I've just fixed it.

asadmin create-domain --port 4849 domain1 --user admin
asadmin create-domain --port 4850 domain2 --user admin
asadmin create-domain --port 4851 domain3 --user admin

The user needs to assign a specfic SNMP port for each domain:

asadmin set --port 4849 --user admin server.property.snmp-adapter-port=10163
asadmin set --port 4850 --user admin server.property.snmp-adapter-port=10164
asadmin set --port 4851 --user admin server.property.snmp-adapter-port=10165

(There was 4849 everywhere before, which was wrong. You should have a separate port number to
specify a specific snmp-port-adapater value per domain. A domain is uniquely identified by its port number
4849 -->domain1
4850 --> domain2
4851 --> domain3

Regards,

Olivier

Posted by Olivier Rivat on August 14, 2009 at 04:36 PM PDT #

Further investigation into the particular functionality that I needed (snmp monitoring for multiple DAS' on one server) has revealed that the above commands to set the snmp port via the asadmin CLI will \*not\* work when the domain is created with the developer profile. You may receive the error messages:
Remote host closed connection during handshake
CLI137 Command set failed.

However, I was able to change the snmp port setting for developer profile domains by hand editing the domain.xml file and adding (in this example, changing the DAS snmp port to 10162):
<property name="snmp-adapter-port" value="10162"/> in the <servers> definition block. Just make sure to stop and start the domain after hand editing the file. And yes, hand editing an XML file is not recommended, but it's the only way I could get the port change into the DAS definition.

I should also note that deployment of the __assnmp.war file via asadmin CLI fails similarly when attempting to deploy to a domain created with the developer profile. I had to use the admin console in order to successfully deploy the __assnmp.war file to the domain.

Posted by skeeny on September 15, 2009 at 03:55 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Olivier Rivat

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today