TECHZEN Zenoss User Community ARCHIVE  

API change zparemeter fails

Subject: API change zparemeter fails
Author: Chris De Coster
Posted: 2019-05-07 14:41

Hi,

I can add devices, but changing some of the parameters fails.
Example:

zenoss_api properties_router PropertiesRouter setZenProperty '{"uid": "/zport/dmd/Devices/Network/Cisco/Nexus/7000/Test7k", "zSnmpAuthType": "MD5"}'

Doesn't change this parameter (the value on /networkCisco/Nexus/7000 level is AES) but for this specific advice I need to set it on MD5.

Other parameters like sSnmpAuthPassword work fine.
Is there any way to set this via API (or CLI) ?

Thx,
Chris



------------------------------
Chris De Coster
------------------------------


Subject: RE: API change zparemeter fails
Author: Adam McCurdy
Posted: 2019-05-07 14:46

Hey Chris,

Is Test7k a device class or a device? If it's a device, your uid is missing devices/ before the device id.

------------------------------
Adam McCurdy
Sr. Manager, Customer Enablement
Zenoss
------------------------------


Subject: RE: API change zparemeter fails
Author: Chris De Coster
Posted: 2019-05-07 14:59

Test7k is a device... your are right, I missed /devices/ in my uid.

With the correct uid it also fails for this specific parameter zSnmpAuthType. 
It seems to fail with all parameters that can be selected from a dropdown list. The parameters that accept a string seem work fine to change.

------------------------------
Chris De Coster
------------------------------


Subject: RE: API change zparemeter fails
Author: Adam McCurdy
Posted: 2019-05-07 16:04

It looks like your JSON object isn't formatted correctly. I just did it in the browser and captured the output in Firefox's developer tools:



Try this: {"uid":"/zport/dmd/Devices/Network/Cisco/Nexus/7000/devices/Test7k","zProperty":"zSnmpAuthType","value":"MD5"}

------------------------------
Adam McCurdy
Sr. Manager, Customer Enablement
Zenoss
------------------------------


Subject: RE: API change zparemeter fails
Author: Chris De Coster
Posted: 2019-05-08 07:24

Hi,
I was able to make it work with the following script:

 #!/bin/ksh
ZENOSS_URL="https://zenoss.url:8080"
ZENOSS_USERNAME="user"
ZENOSS_PASSWORD="Pasword"
DEVICE_HOSTNAME=$1
DEVICE_CLASS="Network/Cisco/Nexus/7000/DCI-COLF/devices"
COLLECTOR="localhost"
ROUTER_ACTION="PropertiesRouter"
ROUTER_METHOD="setZenProperty"
ROUTER_ENDPOINT="properties_router"

DATA="{\"uid\":\"/zport/dmd/Devices/$DEVICE_CLASS/$DEVICE_HOSTNAME\", \"zProperty\":\"zSnmpAuthType\",\"value\":\"MD5\"}"
curl -s \
-w "\n" \
-k \
-u "$ZENOSS_USERNAME:$ZENOSS_PASSWORD" \
-X POST \
-H "Content-Type: application/json" \
-d "{\"action\":\"$ROUTER_ACTION\",\"method\":\"$ROUTER_METHOD\",\"data\":[$DATA], \"type\":\"rpc\", \"tid\":1}" \
"$ZENOSS_URL/zport/dmd/$ROUTER_ENDPOINT"\
|grep success --color=auto

Thanks a lot to point me in the right direction !

------------------------------
Chris De Coster
------------------------------


< Previous
Zenoss 6.2.1 Support for Old ZenPacks
  Next
Dynamic component modeling
>