Sunday, June 1, 2008

Listing Situations and their distributions

If you're like me then you've got customers who want to know "Exactly what is being monitored".
They don't want to go to the portal and check for themselves, nor will they use any of the Tools and Scripts which are available.

They just want the list! And they want it now!
What to do, what to do?
ITM has a very nifty feature in which you can extract data from the system using SOAP web services.

I found the exact commands I needed in the Gulfbreeze Blog and in the OrbData site (All the heavy lifting was done by them).

However, the type of person who needs to display this information is probably rather new to ITM and, lets face it, you've got more important things to do right now than learn a few new out-of-the-way features of ITM.

Gulfbreeze and Orbdata assume you know what you're doing. They also give you the data unformatted - i.e. nothing than can be shown to anyone without a lot of massaging of the information.

I'm going to show the simple, cut & paste way of doing it.
(Appendix A of the ITM Administrator's guide goes into all the gory details.)

  1. In order to run a SOAP request, you need two files
    1. In the bin directory of the TEMS server, create a file called URL.txt which contains the text:
      http://TEMSServerName:1920///cms/soap
    2. In the same directory, create a file called SoapRequest.txt and insert the following text:
      (change userid and password to taste)
    3. <CT_Export>
      <filename>data.xml</filename>
      <request>
      <attach>header-data.xml</attach>
      </request>
      <request>
      <CT_Get>
      <userid>sysadmin</userid><password>mypassword</password>
      <table>O4SRV.LOCALTIME</table>
      <sql>
      SELECT TOBJACCL.OBJNAME,TNODELST.NODE
      FROM O4SRV.TNODELST,O4SRV.TOBJACCL
      WHERE TNODELST.NODELIST=TOBJACCL.NODEL AND TNODELST.NODETYPE="V"
      </sql>
      </CT_Get>
      </request>
      </CT_Export>

  2. In order to see the XML data nicely, you need so insert a reference to an XSL file. Add the file header-data.xml into the cms/html directory with the following content:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="kshrpt.xsl"?>
  3. From the bin directory, run the command kshsoap SoapRequest.txt URL.txt (or  CandleSOAPClient on *nix)
  4. You should then find a data.xml file in the cms\html directory. Open it in a web browser and you'll get a nicely formatted table of all the situations and the agents they're associated with.

So what did we do?

We used a CT_Get call to extract the information we wanted. (See the documentation and the other blogs for more details as to what exactly the SELECT does).

We wrapped it in a CT_Export so that we would get an XML file.

We added an attachment to the beginning of the XML file so that we could use the formatting file (which comes with ITM)  to present the information as a proper table and not as an odd looking string.

As I said, the hard part is knowing what SELECT to use, but I hope this little entry will help people.

4 comments:

John Alvord said...

I had to use kshsrpt.xsl in the header-data.xml file. That was on a ITM 6.2 FP1-IF1 environment.

Chuck Tribolet said...

1. It appears this has to be done on the hub TEMS. (If run from the rTEMS, the header-data.xml and data.xml files are on the hub TEMS.)

2. By "bin" directory, it looks like you mean C:\IBM\ITM\cms.

3. After slogging through all that, I get back a data.xml file with nothing in it but header-data.xml.

Robert said...

@John. I wrote this using 6.1FP5, I haven't tested it on 6.2FP1IF1, Thanks for the feedback.

@Chuck. I used bin(binary) as shorthand for both the Windows and Unix directories which hold the ITM images. Do you get correct results when you use the regular soap interface http://localhost:1920///cms/soap/kshhsoap.htm? (appendix A of the admin's guide)

Usman said...

I tried it but it seems like its listing all of the situations that exist on tems enabled or not enabled.