DX NetOps

Expand all | Collapse all

Tuesday Tip: Using Spectrum Web Services to set maintenance mode

Anon Anon

Anon AnonSep 10, 2012 11:47 AM

Bill_Wol4th

Bill_Wol4thSep 19, 2012 07:01 PM

Dirk Boettcher

Dirk BoettcherJan 07, 2013 09:35 AM

  • 1.  Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Broadcom Employee
    Posted Sep 10, 2012 11:04 AM

    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.



  • 2.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Sep 10, 2012 11:47 AM
    Nice Tip.

    Thanks Roger.


    Rajashekar


  • 3.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Sep 14, 2012 02:08 PM
    Thanks Roger for sharing this helpful tip on Using Spectrum Web Services to toggle maintenance mode on a model.

    Mary


  • 4.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Broadcom Employee
    Posted Sep 19, 2012 07:01 PM
    Great tip! Thanks Roger.


  • 5.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Nov 08, 2012 11:13 PM
    Hey Roger,

    Nice tip....

    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. My scenario is, we have Remedy ticketing system where Network Operations team would open a Maintenance Ticket with the list of all the devices for which Maintenance will be performed that night.

    Can ask the remedy team to trigger this web service and pass the ip address, start time and end time to set the devices into maintenance. Please advise.

    Regards,
    Prash


  • 6.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Nov 08, 2012 11:29 PM
    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?


  • 7.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Nov 27, 2012 03:40 AM

    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?
    We put the series of devices into maintenance mode by Utility option of SPECTRUM.


  • 8.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Broadcom Employee
    Posted Dec 08, 2017 10:04 AM

    Hi

    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>



  • 9.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Nov 18, 2012 08:00 AM
    Nice tip. I wish I had known there was an open source GUI for the Restful API instead of brute force learning how to do it in Powershell.
    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.
    You could use the "GET Devices" from page 34 of the Web API Guide to parse the output for the IP or Name you're looking for. Use that info to create an HTTP URL that puts the device in maintenance mode. The Start and End times are handled by Schedules (OneClick->Locater->All Schedules). Dynamically creating a schedule then associating it with a model based on variables would be a lot of work and create an unmanageable amount of schedules. You're probably better off having Remedy call script that makes an HTTP call to put the device in maintenance mode, sleeps x amount of minutes/hours, then makes an HTTP call to bring the device out of maintenance mode.
    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?
    I prefer using the OneClick->Locater to bring up all the devices, rlight click all the devices you want to put in maintenance mode, go to Utilities->Attribute Editor->In Maintenance->Yes

    If you want to do it via script page 45 of the Web API Guide has the PUT MODELS method. Modify the example file "PutModelsByModelHandles.xml" on the OneClick server. Set the attribute "0xa0000fa0" with value "TRUE". You can manually put in the model handles or you can use the "GET Devices" I described above to dynamically search and parse for them.


  • 10.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Dec 21, 2012 10:54 AM
    Any ideas why I'm getting error Acess Denied when I try to put the device in maintenance mode via RESTClient (See Below)? Granted my team only have rights to a group of servers, but I can put the server in maintenance mode via Utilities\scheduleMaintenance\(Select from avaialble shedules)

    I was able to get the Model and attibute via http://CAServerName/spectrum/restful/devices?attr=0x1006e&attr=0x10000


    "<?xml version="1.0" encoding="UTF-8" standalone="yes"?><model-update-response-list xmlns="http://www.ca.com/spectrum/restful/schema/response"><model-responses><model mh="0x661474" error="PartialFailure"><attribute id="0x1006e" error="Error" error-message="ServerName.Domain: You do not have permission to set attribute Model_Name for this model."/></model></model-responses></model-update-response-list>"

    Please advise


  • 11.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Jan 07, 2013 09:35 AM
    really helpful tip! Thank you.


  • 12.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Apr 11, 2013 04:20 PM
    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!

    Regards
    Erich


  • 13.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Apr 11, 2013 05:09 PM
    This brings up a good point to discuss and I'm not sure I should ask this on this thread or start a new one. I had a conversation around implementing maintenance last week and which method is common practice vs the benefits of each. In the end I decided to go with scheduling SANM Policy's to enable/disable notifications and ticket generation. Prior I had tried to implement Maintenance Schedules on all devices but that prevented us from knowing the status of a device while in maintenance. This presents a problem of preventing availabilty issues when the blackout/change window is over.

    How are some of you on this community implementing maintenance windows? How do you determine the status of devices while in maintenance? Pros and cons?


  • 14.  RE: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted May 15, 2013 04:43 PM

    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!

    Regards
    Erich
    Hi, if is possible, could u sendme the modified setscript that you used to call the wbeservice and generate events..
    My email dpereyra@netsol-international.com

    Thanks.
    Diego


  • 15.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Mar 24, 2015 10:44 PM

    Hi there,

    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.

    Coenie Klopper

    coenraad.Klopper@kineticit.com.au



  • 16.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Jul 09, 2015 02:12 AM

    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 !



  • 17.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Jul 09, 2015 03:35 AM

    Please read this. It contains general information on Spectrum system.This is your starting point.



  • 18.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Jul 09, 2015 03:42 AM

    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



  • 19.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Jul 15, 2015 02:40 AM

    Hi Sumita,

     

    "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.



  • 20.  Re: Tuesday Tip: Using Spectrum Web Services to set maintenance mode

    Posted Sep 22, 2015 06:07 AM

    Hi Roger,

     

    Is there any way for fetching the count of Accountable models in CA Spectrum through web service or using database ?

     

    Regards

    Winkle Khurana