Jaa


Using Opalis to get info from the SCX Cross Platform Agent

Having started on the Cross Platform & Interop team before Opalis was a part of it, I think about cross platform integration a lot. Working with Opalis these days, I think about how we can handle cross platform situations in the data center, which includes working with UNIX and Linux. Opalis includes and Integration Pack for UNIX, which includes the following activities:

Add Line Delete Line Rename File
Copy File Insert Line Replace Text
Create Folder Monitor File Restart System
Delete File Monitor Folder Run Program
Delete Folder Move File Search Text

Now these activities are great and form the basic building blocks of a lot of capabilities, but they require installing an agent on the remote machine, and the agent is supported on RedHat 4 and 5, Solaris 8, 9 and 10, HPUX 11.11, and AIX 5.3.

Meanwhile, the current cross platform integrations for Operations Manager support the following operating systems:

  • AIX 5.3 (Power), 6.1 (Power)
  • HP-UX 11iv2 (PA-RISC and IA64), and 11iv3 (PA-RISC and IA64)
  • Red Hat Enterprise Server 4 (x64 and x86) and 5 (x64 and x86)
  • Solaris 8 (SPARC), 9 (SPARC), and 10 (SPARC and x86 versions later than 120012-14)
  • SUSE Linux Enterprise Server 9 (x86), 10.1 (x86 and x64) and 11

If you already have the Operations Manager cross platform agent installed, you probably don't want another agent on there as well, so utilizing the existing agent would be a good thing. In this article, I'll show you how to quickly create your own Opalis activity using the QIK CLI wizard and simple WinRM commands. This activity will be able to query the OpenPegasus (CIM) database on the UNIX/Linux computer to get information provided by the SCX Agent. In another article, I'll show you how to use the "invoke" command to run command lines on a remote computer so you can replicate all of the functionality currently provided in the UNIX IP.

Creating your custom activity

The first thing to realize is that you can create a new custom object out of virtually any command line, and that using a WinRM command, you can talk to the SCX agent on a UNIX or Linux computer. For example, here's a command you can use to enumerate the SCX Agent info:

 winrm enumerate https://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_Agent?__cimnamespace=root/scx -username:root –password:<PASSWORD> -r:https://<computer name>:1270/wsman -auth:basic -encoding:utf-8 -skipCAcheck -skipCNCheck -skipRevocationCheck -format:#pretty

Knowing this, you can start creating your own custom activity! Here's how:

  1. Make sure you have the Quick Integration Kit installed

  2. Click Start > All Programs > Opalis Software > Quick Integration Kit 3 > QIK CLI

  3. Click Next

  4. Enter some information about the assembly you'll be creating. Just a name and file location will do here.

    image

  5. Click Assembly Information

  6. Enter some more information to give a description, title, version number,etc. to the assembly.

    image

  7. Click Next

  8. On the Commands page, click Add to add a new command for the assembly. The Add/Edit Command dialog appears.

  9. On the General tab, enter a Name for the command (this will appear as the object name in the Client).

  10. Select Run Command as the mode – this allows you to run a command line.

  11. Enter a Description for the command just to provide some useful information

    image

  12. Click on the Arguments tab. Now we have to add Parameters so that you can define some of the values at runtime.

  13. Click Add next to the Parameters box. The Add/Edit Parameter dialog appears.

  14. Since we need to make the namespace being queried a variable, it will become a parameter here. Enter the following information:

    image

  15. Click the Ellipsis (…) button next to Options and enter the following text to provide options for the namespace selection:

SCX_Agent

SCX_DiskDrive

SCX_DiskDriveStatisticalInformation

SCX_EthernetPortStatistics

SCX_FileSystem

SCX_FileSystemStatisticalInformation

SCX_IPProtocolEndpoint

SCX_LogFile

SCX_MemoryStatisticalInformation

SCX_OperatingSystem

SCX_ProcessorStatisticalInformation

SCX_StatisticalInformation

SCX_UnixProcess

SCX_UnixProcessStatisticalInformation

  • Click OK, then click Add again.

  • Enter the following information for providing a username at runtime:

    image

  • Click OK, then Add again.

  • Enter the following information for providing the password at runtime:

    image

  • Click OK, then Add again.

  • Enter the following information for providing the target computer name at runtime:

    image

  • Now go back up to the Command Line box and enter the following:

    winrm enumerate https://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/$(namespace)?__cimnamespace=root/scx -username:$(username) -password:$(password) -r:https://$(computer name):1270/wsman -auth:basic -encoding:utf-8 -skipCAcheck -skipCNCheck -skipRevocationCheck -format:#pretty

  • Since the output to StdOut and StdError automatically show up in published data, you don't need to  add any specific published data items. Click OK to go back to the Commands page.

  • Click Next. The wizard now builds your assembly file. By itself, your assembly could be used with the "Run .NET Object" activity that comes with QIK, but it's easier to use if you go ahead and make a custom Integration Pack.

  • Click Build Integration Pack. This starts the Opalis Quick Integration Kit Wizard.

  • Several of the fields will be filled in for you already. Just fill in the Category Name – this is what group the activity will appear under in the Designer Client. Use a unique name here.For the purposes of this exercise, I'll just use "SCX"

    image

  • Click Next

  • On the Objects tab, you should see the Query SCX Agent object automatically added

    image

  • Click Next

  • There are no files to be added with the IP, so click Next again at the Dependencies page.

  • Now you just need to name your IP file

    image

  • Click Next to built the IP, then Finish to exit the wizard.

  • Now just use the Opalis Deployment manager to register and deploy the IP to your client / action server.

 

Using the New Activity

image

Now that you have the custom IP built and imported, you can use it in a workflow. The simplest example is shown above. You can get information back using this example (you just don't have any means of acting on the information yet). But first you have to configure the activity with runtime information, like this:

image

Now just open it in the testing console by clicking the Test button in the toolbar. Click Run to start the policy, and when it finishes, you'll see details like this:

image

Of course, you can't read all of the content under Standard output, but when you mouse over it, you 'll see this:

image

Looks like XML, doesn't it? Well, it is! That means I can use a Query XML activity in the workflow to actually do something with the data. This part is REALLY simple… Just drag a Query XML activity (under Utilities) into the policy and link it after the Query SCX Agent activity. Open the properties and set them like this:

image

You now have a means to find out the architecture of the computer. Just look for the published data property of "Number of Matches" to be > 0 and you've matched a value, and the value appears in "Query Result" as shown here:

image

OK, that was simple, but how about if you want to get different information? I can just go back to the Query SCX Agent activity and change the namespace to any of the other values and re-run the policy. The result will show me what properties are available for me to use in the Query XML activity.

For example, changing the namespace value to "SCX_FileSystem", I get back two different instances of the class, and in each one I see the "<p:AvailableSpace>" element. Now if I change my Query XML activity to look for that element, it looks like this:

image

And when I run the policy in the test console, I get this:

image

The "<…>" means I got multi-value data back (which I can confirm because "Number of matches = 2). Opening the Published Data Browser I see my values:

image

Just to show you the power of this tiny little workflow, let's say I wanted to find the overall percentage of free disk space on the system. I can use a slightly more complicated XPath query to divide the available disk space into the total disk space and get that number! I just put the following text into the XPath Query box:

((//p:AvailableSpace) div (//p:FileSystemSize))

And here is the result:

image

I can now see that my system has 88.5% free disk space.!

Now it's your turn… go forth with this new knowledge and see what kind of information you can gather and use within your workflows using the SCX Cross Platform Agent for Operations Manager and Opalis!