Upload
duongphuc
View
495
Download
8
Embed Size (px)
Citation preview
1 © 2014 CA. ALL RIGHTS RESERVED.
HOW TO USE THE UIM API
2 © 2014 CA. ALL RIGHTS RESERVED.
TOPICS
API Overview
PDS – Portable Data Stream
Probe Utility
PU.EXE
LUA in the NAS
UMP REST API
3 © 2014 CA. ALL RIGHTS RESERVED.
UIM API OVERVIEW
UIM tenet #7: “Anything that can be done through a UI, can also be done programmatically”
API and SDKs available for UIM:
REST webservice SOAP webservice Perl SDK Java SDK .Net SDK Command line (PU.EXE) C, C++, C#, VB, VBScript, Lua
4 © 2014 CA. ALL RIGHTS RESERVED.
PDS - PORTABLE DATA STREAM
5 © 2014 CA. ALL RIGHTS RESERVED.
PDS – JAVA
NimUtility.displayPDS(pdsVariable); – This will print the output of the PDS in a readable format
NimRequest req = new NimRequest(“probeaddress”, “callback”, arguments)– Arguments are in PDS form.
PDS args = new PDS();
args.putString(“key”, “value”);
Return values by using pdsVariable.getString|Int(“key”);
PDS can return tables
6 © 2014 CA. ALL RIGHTS RESERVED.
PDS – LUA
req = nimbus.request(“probeaddress”, “callback”, arguments)– Arguments are in PDS form.
args = pds.create()
Pds.putString(args, “key”, “value”);
Return values by looping through returned table– for k,v in pairs(req) do
– print (k .. “ “ .. v)
– end
7 © 2014 CA. ALL RIGHTS RESERVED.
The Probe Utility accesses callbacks on probes and directly connects to internal hooks to force actions
Each probe supports multiple callback actions
Exploring these is the best way to learn them
PROBE UTILITY
8 © 2014 CA. ALL RIGHTS RESERVED.
PU.EXE COMMAND LINE UTILITY
Usage: pu [options] <nim-address> [command] [data]-i interactive mode -u user user name -p password NMS passwd-s SID Valid SID-t sec timeout in seconds-H host use probe host-P port use probe port-d level set debug level-L list commands on probe-I show probe info-R restart probe-S stop probe
Usage of pu.exe is notonly for returning values,but also changing creds,deploying entire probes, or changing behavior
Running these types of commands from within a batch or PERL script and feeding in lists can result in high caliber automation and even touch-less administration
9 © 2014 CA. ALL RIGHTS RESERVED.
To start a windows service: pu -u <user> -p <password> <Address> start_service <servicename>
To stop a windows service: pu -u <user> -p <password> <Address> stop_service <servicename>
Where: <user> is a Nimsoft user <password> is the password associated with the Nimsoft user <Address> is the Nimsoft address of the ntservices probe <servicename> is the name of the service
Format of Nimsoft address: /domain/hub/robot/ntservices
RESTART A WINDOWS SERVICE WITH PU.EXE
10 © 2014 CA. ALL RIGHTS RESERVED.
LUA AND THE NAS
LUA Basics PDS args
nimbus.request()
Looping through tables
Interact with Alarms alarm.get()
alarm.list()
Examples: Interacting with Probes Add note/annotation script
11 © 2014 CA. ALL RIGHTS RESERVED.
UMP REST API
REST API runs inside Wasp (UMP)
Uses Basic HTTP authentication Production Note: Configure Wasp to use HTTPS
Respects http accept header – returns xml/json/text
Endpoint is http://ump_host/rest
Wadl describes available services
12 © 2014 CA. ALL RIGHTS RESERVED.
REST API EXAMPLES FOR PROVISIONING
Check if a probe is installed
Deploy a robot using a callback to ADE
Deploy a probe using a callback to distsrv
Retrieve current probe configuration
Configure a probe
Get alarms
Get performance data
13 © 2014 CA. ALL RIGHTS RESERVED.
USE REST API TO VERIFY PROBE INSTALLATION
/probe/{domain}/{hub}/{robot}/{probe}/info
Command: curl -v -u api:CAdemo123
http://ump.nimsoft.com/rest/probe/Nimsoft-Monitor/WorldWideHQ/usildodnimms1/cdm/info | xmllint
Output:<?xml version="1.0" encoding="UTF-8" standalone="yes"?><probeinfo>
<company>Nimsoft Corporation</company><connections>506</connections><libDate>Jun 12 2012</libDate><libVersion>6.01 (64bit)</libVersion><messages>4</messages><name>cdm</name><started> 2014-05-02T17:59:41-04:00</started><version>4.70</version>
</probeinfo>
14 © 2014 CA. ALL RIGHTS RESERVED.
USE REST API TO DEPLOY A ROBOT
POST to /probe/{domain}/{hub}/{robot}/{probe}/{callback2}/submit_job
15 © 2014 CA. ALL RIGHTS RESERVED.
USE REST API TO DEPLOY A PROBE
POST to /probe/{domain}/{hub}/{robot}/{probe}/{callback2}/submit_job
16 © 2014 CA. ALL RIGHTS RESERVED.
USE REST API TO CONFIGURE A PROBE
Get current configuration: curl -v -u api:CAdemo123
http://ump.nimsoft.com/rest/probe/Nimsoft-Monitor/Worldxxxxxx/usildodnimms1/cdm/config
Modify / add configuration: curl -v -u api:CAxxxxxxx -X PUT -H "Content-Type:
application/xml" -d "<probeConfigKeys><configkey><key>/cpu/alarm/error/threshold</key><value>42</value></configkey><configkey><key>/cpu/alarm/warning/active</key><value>no</value></configkey></probeConfigKeys>" http://ump.nimsoft.com/rest/probe/Nimsoft-Monitor/Worldxxxxxx/usixxxxxxxx/cdm/config