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:
    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>

  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.