Saturday, March 8, 2008

Four idlcalls with no CLI equivalents

Some of the Tivoli folks use idlcall instead of 'w' command just because it makes them look cool. But there are some instances where idlcalls are the only way to get the information you want. I am always fascinated to find an idlcall or idlattr to do something that otherwise I won't be able to do via CLI (Command Line Interface). This article lists some of the idlcalls that have no CLI equivalents (AFAIK).

Disclaimer to purists: In this article, idlcall represents not just the "idlcall" command, but it includes "idlattr" command as well. Though technically idlcalls are part of CLI, here CLI refers to 'w' commands.

Disclaimer to everyone (including purists): IDL commands are risky because they directly access the data, so know what you're doing before hitting the key.

How do I find whether a profile manager is database or dataless?

Query the state attribute in profile manager. The valid values are "normal" for a database profile manager and "dataless" for a dataless profile manager.

$ pm_oid=`wlookup -r ProfileManager `
$ idlattr -tvg $pm_oid state string

How do I find the size of a Software Package?

This is a basic requirement, right? There is a "Calculate Size" option in the GUI but I could not find a CLI equivalent. However, there is an idlattr to do it.

$ sp_oid=`wlookup -r SoftwarePackage `
$ idlattr -tvg $sp_oid sp_size ulong

Again, this value could be little higher than actual size of the SPB because the SPO object stores some additional information. Please note that the above idl will not work for "non-built" packages.

How do I find if the given Software Package is built or not-built?

Sometimes, you may want to check whether the package is built or not built. The state attribute in Software Package object provides this information.

# an empty Software package
$ idlattr -tvg $oid state string

# not built Software Package
$ idlattr -tvg $oid state string

# a built software package
$ idlattr -tvg $oid state string

# a data-moving SoftwarePackage
$ idlattr -tvg $oid state string

How do I find which ProfileManager holds a profile?
How do I find the parent container for a specific object?

This is another common requirement. Say, you want to find out which profile manager contains a specific profile or which PolicyRegion holds a specific profile manager, it is very difficult to do it in CLI. However, it takes only couple of idlcalls to find out this information.

# Find the OID of the given object
$ sp_oid=`wlookup -r SoftwarePackage
# Get the back reference IDL and extract the third field
$ pm_oid=`idlcall $sp_oid get_backrefs 10 | awk '{print $3}'`
# Find the label for the OID
$ idlcall $pm_oid _get_label

There are so many examples like this, but now you get the idea. Though Tivoli CLI is pretty exhaustive and it enables you to script so many things, there are few things that you may not be able to do and idlcalls fill in this void nicely. Hope you find this article useful.

No comments: