For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

devopsdd_183664's avatar
devopsdd_183664
Icon for Altostratus rankAltostratus
Jan 28, 2015

BigIP VE 11.6.0 modify json subcollection for SNMP

Hi all, I'm trying to automate modifying the SNMP community string via icontrol REST API, using curl on linux, on our BigIP Virtual Edition appliances. It's a subcollection in /mgmt/tm/sys/snmp but I just can't figure out the right PUT method syntax. I've read the icontrol user guide and I'm missing something that I need some help on. Here's the JSON output:

 

 

"communitiesReference": {
    "isSubcollection": true,
    "items": [
        {
            "access": "ro",
            "communityName": "public",
            "fullPath": "/Common/comm-public",
            "generation": 0,
            "ipv6": "disabled",
            "kind": "tm:sys:snmp:communities:communitiesstate",
            "name": "comm-public",
            "partition": "Common",
            "selfLink": "https://localhost/mgmt/tm/sys/snmp/communities/~Common~comm-public?ver=11.6.0",
            "source": "default"
        }

 

 

I basically want to modify pair "communityName":"public" to "communityName":"nonpublic" as an example. That's it. My curl syntax is like so:

 

 

curl -sk -u admin:admin -H "Content-type: application/json" -X PUT -d '{"communities": [{"access":"ro","communityName":"nonpublic"}]}' 'https://10.1.1.25/mgmt/tm/sys/snmp | python -m json.tool'

 

 

My error when I run that is:

{ "code": 400, "errorStack": [], "message": "one or more configuration identifiers must be provided" }

I don't know what I'm missing. Thank you!

1 Reply

  • The iControlRest doesn't seem to do to well with updating collections. So in my experience, what I've had to do is grab the collection, modify the fields I want, and then PUT the collection back.

    I think your curl string is accurate, except that you need your identifiers (the name field at least)