Tuesday Tip: Using Spectrum Web Services to toggle maintenance mode on a model CA Spectrum Tuesday Tip by Roger Nason, Principal Support Engineer Did you know that you can use Spectrum Web Services to place a model into, or out of, maintenance mode? Description: How to use Spectrum Web Services to set the isManaged attribute on a model. Solution: The two examples below use different methods to utilize Spectrum’s Web Services to toggle maintenance mode on a model. The first is a command line implementation. In this case I used cURL as my command line tool: To put a device into maintenance mode: curl.exe -i -H "application/xml" -X PUT -u username:password “http://localhost/spectrum/restful/model/0xa0000fa0?attr=0x1295d&val=false” To take a device out of maintenance mode: curl.exe -i -H "application/xml" -X PUT -u username:password "http://localhost/spectrum/restful/model/0xa0000fa0?attr=0x1295d&val=true" *Both commands above are one line each The second example uses the RESTClient (see figure 1). The attached video demonstrates a model in Spectrum being placed into maintenance mode using the RESTClient and taken out of maintenance mode using cURL.
Lekshmi wrote:I know how to make a device put in maintenance mode.If i want to put a series of devices in maintenance mode how should i do it?Do I can to go and put individual devices into maintenance mode?
The below xml is a pretty easy way to search for modelname and set maintenance.
you can change attribute to suit your search criteria.
note that the value false is used to set in maintenance.
<?xml version="1.0" encoding="UTF-8"?> <rs:update-models-request throttlesize="0" xmlns:rs="http://www.ca.com/spectrum/restful/schema/request" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd"> <rs:target-models> <rs:models-search> <rs:search-criteria xmlns="http://www.ca.com/spectrum/restful/schema/filter"> <filtered-models> <equals-ignore-case> <attribute id="0x1006e"> <!-- This attribute stores the name of the Model --> <value>MODELNAMEGOESHERE</value> <!-- name to match --> </attribute> </equals-ignore-case> </filtered-models> </rs:search-criteria> </rs:models-search> </rs:target-models>
<rs:attribute-value id="0x1295d">true</rs:attribute-value> <!-- false=set in maintenance --> </rs:update-models-request>
Instead of model handle; can we pass IP address or Device Name in the Web Service and also can we specify the start and end time of the maintenance.
I know how to make a device put in maintenance mode.If i want to put a series of devices in maintenance mode how should i do it?Do I can to go and put individual devices into maintenance mode?
e.heinemann wrote:Hi a cool solution.
Weeks ago, a customer requested to implement this in eHealth to stop polling devices while the device is in Maintenance in Spectrum.
... we developes a similar thing for CA eHealth.
Same idea, compareable solution.
We do not use curl, ... we implemented a Alarm-Notifier which fires only Maintenance-Alarms in Spectrum.
Inside its notifierscripts (Set/Clear) we use wget to call the customized maintenance-webservice for eHealth.
Web is great!
I wonder if it possible for you to share the setscript and all relevant files that you created / updated for the webservice to work. It would really be appreciated.
Regards and thank you in advance.
I have to make an application where i have to use RESTful apis to move hosts under maintenance mode through spectrum. I saw video as well, still not getting what values to pass in the URL. what is model_handle in this url "http://localhost/spectrum/restful/model/0xa0000fa0?attr=0x1295d&val=false". What is this attr value= 0x1295d. Please reply asap !
Please read this. It contains general information on Spectrum system.This is your starting point.
Thanks....m actually v new to spectrum so thanks for introducing wiki link to me i will be going through this and in case of any understanding issues will come back to you again
"isManaged" is the CA Spectrum attribute that sets a device model into or out of maintenance mode.
The Hex equivalent of isManaged=0*1295d
this attribute is of type boolean. its value can be Yes or No (True or False)
Model_Handle is the attribute that identifies an existing model. The Hex equivalent of Model_Handle=0*129fa
but the value of Model_Handle determines/identifies the existing model. The value of Model_Handle is not editable.
To see the values of these attributes for a particular model:
1. Select that model in the OneClick's Navigation hierarchy.
2. In Component Detail pane, click Attributes tab, and search for Model_Handle and isManaged in the search bar.
3. Double-click the attribute displayed in the left pane to see its value in the right pane.
Hope this helps! You can read further information here: Process SAML Authentication.
Is there any way for fetching the count of Accountable models in CA Spectrum through web service or using database ?