InfoBox examples

This section contains the examples that show how you can create the basic commands underlying typical InfoBox items. The following examples are discussed:

Showing the PATROL KM product version

There are several ways to show the PATROL KM product version. Because InfoBox definitions are saved in the .km file, the easiest way is to use the simple PSL command that follows: 

print("1.1.00"); 

If your PATROL KM has multiple application classes and each of them has the same PATROL KM version number, you could write a PSL function called MyVersion and put the print(MyVersion()); command in the InfoBox item command:

function MyVersion() {return "1.1.00";}

For another example, assume there is a PATROL KM called ExampleKM and that the KM version is stored in the PATROL Agent symbol table at /ExampleKM/version. You could use the following PSL code to display the PATROL KM product version in an InfoBox:

print(get("/ExampleKM/version"));

Showing why an object is in the OFFLINE or ALARM state

Displaying the reason that an object is in OFFLINE or ALARM state is more difficult than displaying version numbers because the PATROL Agent does not keep this information in the PATROL Agent namespace. 
If you want to display this information, you must create logic within your PATROL KM to save the information somewhere. This may involve writing recovery actions to trap parameter alarm range changes as well as capturing events such as loss of PATROL Agent connection, server down, and so forth.

Showing the application uptime

To show information about application uptime, do the following things:

  • Retrieve the data once at application discovery
  • Save the data in the PATROL Agent namespace
  • Gather the data from the PATROL Agent namespace each time you open the InfoBox

For example, there is a PSL function that returns the uptime of the application. The following InfoBox item code displays that value in an InfoBox: 

uptime = getApplicationUptime(); 
print(uptime);

Showing number of users

Showing a listing of the users logged into a system is not the type of data that should be displayed in an InfoBox. Showing the number of users is more applicable.

Windows example

On a Windows platform, use the OS finger command to display a list of users who are logged on to a system.

system("finger bmc.com");

UNIX example

On a UNIX platform, use the OS finger command to display the number of users who are logged on to a system. You can also use the OS command finger | wc -l.

system("finger | wc -l");

PSL equivalent

The PSL equivalent of this is as follows:

user_list = system("finger");
num_users = lines(user_list);
print(num_users);
Was this page helpful? Yes No Submitting... Thank you

Comments