This is archived documentation for an older version of Nirvana (v3.1). Please refer to documentation for the latest version if required.

Nirvana Management Information - nRealmNode

Introduction

The Nirvana admin API provides real time asynchronous management information on all objects within a realm server. By creating an nRealmNode, and connecting to a realm, information is automatically delivered to the nRealmNode object from the realm. This information is delivered periodically in summary form, and also as and when the state changes for one or all of the objects managed within a realm.

Before reading this section it may be useful to look at the management information available via the Nirvana enterprise manager. A full description of all Realm management screens is available in the enterprise manager guide. All functionality seen in the enterprise manager can be easily added to bespoke admin and monitoring processes as it is written entirely using the Nirvana Admin API.

This section discusses the following different types of information that can be obtained through the nAdmin API for the nRealmNode object:

Status Information
State Change Events
Logging And Audit

Status Information

The nRealmNode extends nContainer, that extends nNode which is a subclass of Observable, so when the status information is received for a realm node, (by default this is every 5 seconds although it is configurable by setting the StatusBroadcast property under the Global Values config group) the nRealmNode will trigger the update callback on any known Observers. For example, if you write a class that implements the Observer interface, it can be added as an observer as follows:

realm.addObserver(this);

Assuming 'this' is the instance of the class implementing Observer, then the implementation of the update(Observable obs, Object obj) will be notified that the realm node has changed.

When regular status events are sent, the Observable object referenced in the update method will be the realm node that you added your observer to, and the Object will be null.

State Change Events

When events occur on a realm node that you have added an observer to, the Observable/Observer mechanism will notify you of the details of that event. For example, the following implentation of the update method of the Observer interface demonstrates how to detect that a new channel or queue has been created or deleted. :

public void update(Observable obs, Object obj){

if (obs instanceof nContainer) {

if (obj instanceof nLeafNode) {

nLeafNode leaf = (nLeafNode)obj;
nContainer cont = (nContainer)obs;
if (cont.findNode(leaf) == null) {

// node has been deleted
System.out.println("Node "+leaf.getName()+" removed");

} else {

// node has been added
System.out.println("Node "+leaf.getName()+" added");

}

}

}

}

Any changes to the realm ACL will also use the same notification mechanism. For example, if an ACL entry was changed for a realm, the update method would be fired calling with the realm node object and the nACLEntry that had been modified.

Logging and Audit

An nRealmNode allows you to asynchronously receive realm log file entries as well as audit file entries as they occur.

Firstly, for receiving asynchronous log file entries, there is an interface called nLogListener which your class must implerment. This interface defines a callback method called report(String) that will deliver each new log entry as a string. Once implemented, the following call will add your log listener to the realm node:

realm.addLogListener(this);

Assuming 'this' is the instance of the class implementing the nLogListener interface.

The following is an example of the report(String) method implementation:

public void report(String msg) {

System.out.println("LOG "+msg);

}

Secondly, realm servers provide an audit file that tracks object creations and deletions, acl changes, connection attempts and failures. This information can be very useful for tracking who has created ACL entries for example and when they were done.

This information, as with log file entries can be asynchronously received by implementing an interface called nAuditListener. This interface defines a callback method called audit(nAuditEvent) that delivers contains the details of the audit entry. Once implemented, the following call will add your log listener to the realm node:

realm.addAuditListener(this);

Assuming 'this' is the instance of the class implementing the nAuditListener.

An example of how to monitor realm server log and audit files can be found here.

For more information on the Nirvana Administration, please see the Nirvana API documentation, and the Nirvana enterprise manager guide.