DX Unified Infrastructure Management

  • 1.  Delete a watcher using REST API

    Posted Apr 14, 2017 06:06 AM

    Hi

     

    I don't manage to delete an element on a probe, using the REST API.

    I can create elements (like process or filesystem or log watcher), I can update them but I don't manage to delete them.

    I have been following the documentation here : Probe Calls - CA Unified Infrastructure Management Probes - CA Technologies Documentation 

     

    I can send a DELETE on an URL like : https://server:port/rest/probe/{DOMAIN}/{HUB}/{ROBOT}/logmon/config/setup/TEST

    (where TEST is a log watcher)

     

    I get a http code 204 (which is supposed to be good) but the watcher is still there.

    Am I missing something ?

     

    thanks



  • 2.  Re: Delete a watcher using REST API

    Broadcom Employee
    Posted Apr 14, 2017 12:45 PM

    Currently there is not this capability in the rest API that is exposed.

    Even using a PU call back does not expose a delete option currently.

    REST API Add Delete Capabilities to Probe Config 



  • 3.  Re: Delete a watcher using REST API

    Posted Apr 14, 2017 02:45 PM

    In typical probe_config_set if you leave the value blank it will remove it, so in theory this should work from the REST API. 



  • 4.  Re: Delete a watcher using REST API

    Posted Apr 18, 2017 03:26 AM

    Hi Bryan,

     

    do you have more information about that ?

     

    thanks



  • 5.  Re: Delete a watcher using REST API

    Posted Apr 18, 2017 08:28 AM

    Yes, let's take for example you want to delete the entire <messages> section from the processes probe. You only need to send one probe_config_set request with the following parameters:

     

    Probe: processes

    Section: /messages

     

    Say you want to delete a single key:

     

    Probe: processes

    Section: /messages

    Key: test_key

     

    The first example will remove the entire section of <messages> </messages> and the second will remove a single key.



  • 6.  Re: Delete a watcher using REST API

    Posted Apr 18, 2017 03:26 AM

    Hi

     

    thanks for the answer; however I don't understand. what is this link : Probe Calls - CA Unified Infrastructure Management Probes - CA Technologies Documentation  supposed to deal with ?



  • 7.  Re: Delete a watcher using REST API

    Broadcom Employee
    Posted Apr 18, 2017 01:59 PM

    The below call will setup two new keys in CDM probe

     

    PUT /rest/probe/chris-dev/primaryhub/nb-1538/cdm/config HTTP/1.1 Accept: application/xml Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?>  <probeConfigKeys>         <configkey>         <key>/setup/resttest</key>         <value>ignoreme</value>     </configkey>     <configkey>         <key>/setup/resttest2</key>         <value>ignoremetoo</value>     </configkey> </probeConfigKeys> 

     

     

    Below should remove them

     

    PUT /rest/probe/chris-dev/primaryhub/nb-1538/cdm/config HTTP/1.1 Accept: application/xml Content-Type: application/xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?>  <probeConfigKeys>         <configkey>         <key>/setup/resttest</key>         <value></value>     </configkey>     <configkey>         <key>/setup/resttest2</key>         <value>/value>     </configkey> </probeConfigKeys> 

     

    Hope this helps

    Probe Calls - CA Unified Infrastructure Management Probes - CA Technologies Documentation 

    see the section:

    Update Probe Configuration Values (Multiple)

    Note: You can supply an empty value parameter to delete configuration values.



  • 8.  Re: Delete a watcher using REST API

    Posted Apr 18, 2017 02:44 PM

    Hello

     

    I tried that. It does create the config line with the value "ignoreme" but setting another PUT on the same key with an empty value does simply set an empty value, it doesn't actually remove the key;

     

    Any idea ?

     

    Thanks



  • 9.  Re: Delete a watcher using REST API

    Posted Apr 19, 2017 04:03 AM

    Hi Ordo,

     

    Maybe like pu.exe try to set the value field to "NULL" ( and key to "NULL" if you want to remove the whole section and not just the key).

     

    This is how it's work with pu.exe so maybe this is the same with the REST API (I think he just re-write something similar to the same API).

     

    Best Regards,

    Thomas



  • 10.  Re: Delete a watcher using REST API

    Broadcom Employee
    Posted Apr 19, 2017 10:18 AM

    I did some testing and was able to get the delete function to work with the rest API.

     

    The first call below creates a test key on the robot.cfg for the controller.

     

    POST /rest/probe/PrimaryUIM_domain/PrimaryUIM_hub/PrimaryUIM/controller/callback/probe_config_set HTTP/1.1

     

    Content-Type: application/xml
    Authorization: Basic YWRtaW5pc3RyYXRvcjoxMjM0NTY=
    Cache-Control: no-cache

     

    <callbackrequest>
    <timeout>50000</timeout>
    <parameters>
    <name>name</name>
    <type>string</type>
    <value>controller</value>
    </parameters>
    <parameters>
    <name>section</name>
    <type>string</type>
    <value>test</value>
    </parameters>
    <parameters>
    <name>key</name>
    <type>string</type>
    <value>Testkey</value>
    </parameters>
    <parameters>
    <name>value</name>
    <type>string</type>
    <value>MytestKeyValue</value>
    </parameters>
    </callbackrequest>

     

    this created the following in my robot.cfg

    <controller>
       robotname = PrimaryUIM
       hubip = ***.***.***.***
       robotip = ***.***.***.***
       first_probe_port = 48000
       set_qos_source = yes
       ip_version = ipv4 ipv6
       domain = PrimaryUIM_domain
       hub = PrimaryUIM_hub
       hubrobotname = PrimaryUIM
       hubport = 48002
       access_0 = 0
       access_1 = 1
       access_2 = 2
       access_3 = 3
       access_4 = 4
       <environment>
          NIM_JRE_HOME = jre/jre8u102
          NIM_JRE_HOME_1_8 = jre/jre8u102
       </environment>
    </controller>
    <test>
       Testkey = MytestKeyValue
    </test>

     

    The second call remove the section all together:

    POST /rest/probe/PrimaryUIM_domain/PrimaryUIM_hub/PrimaryUIM/controller/callback/probe_config_set HTTP/1.1

     

    Content-Type: application/xml
    Authorization: Basic YWRtaW5pc3RyYXRvcjoxMjM0NTY=
    Cache-Control: no-cache

    <callbackrequest>
    <timeout>50000</timeout>
    <parameters>
    <name>name</name>
    <type>string</type>
    <value>controller</value>
    </parameters>
    <parameters>
    <name>section</name>
    <type>string</type>
    <value>test</value>
    </parameters>
    </callbackrequest>

     

    Resulting  robot.cfg

    <controller>
       robotname = PrimaryUIM
       hubip = ***.***.***.***
       robotip = ***.***.***.***
       first_probe_port = 48000
       set_qos_source = yes
       ip_version = ipv4 ipv6
       domain = PrimaryUIM_domain
       hub = PrimaryUIM_hub
       hubrobotname = PrimaryUIM
       hubport = 48002
       access_0 = 0
       access_1 = 1
       access_2 = 2
       access_3 = 3
       access_4 = 4
       <environment>
          NIM_JRE_HOME = jre/jre8u102
          NIM_JRE_HOME_1_8 = jre/jre8u102
       </environment>
    </controller>

     

     

    Notes do create a section under another secion you would change

    <parameters>
    <name>section</name>
    <type>string</type>
    <value>test</value>
    </parameters>

     

    to

    <parameters>
    <name>section</name>
    <type>string</type>
    <value>environment/test</value>
    </parameters>

     

    Hope this helps