cancel
Showing results for 
Search instead for 
Did you mean: 
Login & Join the DevCentral Connects Group to watch the Recorded LiveStream (May 12) on Basic iControl Security - show notes included.
James_Preece
F5 Employee
F5 Employee

Problem this snippet solves:

You are using BiG-IQ or BIGIQ License manager to look after your ELA licenses.

The Charge back tag is visible on the customer usage reports, and can be useful if you bill across multiple departments within the account.

When you first deploy a license to a BIG-IP, you have the option to add a free text entry into a field call "charge back tag"

However if you missed this or want to change it, it is currently not possible to add or edit the entry.

How to use this snippet:

You will need to copy the bash code below and then create a simple CSV file including details of the IP address and Charge Back Tag text you want to create or edit into the /shared directory.

You will then run the script, which will confirm "Updating" followed by each IP address and Charge back tag text.

The Charge back tag can be seen in the BIG-IQ GUI: Devices>>License Management>>Licenses>>ELA pool name>>Select the license type

It can also be seen in the reports created and shared each quarter by the Customer Success team.


In /shared directory, create a CSV file named update.csv with format: IP,charge back value 

    cd /shared 

     "vi update.csv" and follow the example format below

    10.xx.yy.zz,department 33

     Save the file.


Create a file named update.sh in the same directory, copy the sample code below


Run the script

   ./update.sh

   Updating 10.xx.yy.zz to 'department 33'

Code :

> /var/tmp/offerings
> /var/tmp/lic-audit

curl -s localhost:8100/cm/device/licensing/pool/utility/licenses/ | jq .items[].regKey -r | while read -r  regkey ; do
        curl -s localhost:8100/cm/device/licensing/pool/utility/licenses/$regkey/offerings | jq .items[].id -r | while read -r off ; do
                curl -s localhost:8100/cm/device/licensing/pool/utility/licenses/$regkey/offerings/$off/members/ | jq .items[].id  -r | while read -r id ; do
                        curl -s localhost:8100/cm/device/licensing/pool/utility/licenses/$regkey/offerings/$off/members/$id | jq '.|{add:.deviceAddress,selfLink:.selfLink}' -c  >> /var/tmp/offerings
                done
        done
done

curl -s localhost:8100/cm/device/licensing/audit/ | jq '.items[]|{add:.address,id:.id,stat:.status}' -c | grep GRAN >> /var/tmp/lic-audit

cat update.csv | while read -r line ; do
        IP=$(echo $line | cut -d ',' -f1)
        VAL=$(echo $line | cut -d ',' -f2)
        echo "Updating $IP to '$VAL'"

        auditid=$(grep $IP /var/tmp/lic-audit | head -n1 | jq .id -r )
        curl -s localhost:8100/cm/device/licensing/audit/$auditid | jq 'del(.generation,.lastUpdateMicros,.chargebackTag)'  | jq --arg chargebackTag "$VAL" '. + {chargebackTag: $chargebackTag}' > /var/tmp/update-lic-audit
        curl -s localhost:8100/cm/device/licensing/audit/$auditid -XPUT -d @/var/tmp/update-lic-audit -o /dev/null

        offeringid=$(grep $IP /var/tmp/offerings | jq .selfLink -r | egrep -o '/cm/device/.*')
        curl -s "localhost:8100$offeringid" | jq 'del(.generation,.lastUpdateMicros,.chargebackTag)'  | jq --arg chargebackTag "$VAL" '. + {chargebackTag: $chargebackTag}' > /var/tmp/update-offering
        curl -s "localhost:8100$offeringid" -XPUT -d @/var/tmp/update-offering -o /dev/null
done

Tested this on version:

No Version Found
Version history
Last update:
‎20-Oct-2020 03:18
Updated by:
Contributors