Create or edit "Chargeback Tag" in ELA license

Problem this snippet solves:

You are using BIG-IQ Centralized Manager or BIG-IQ License Manager to manage your ELA licenses.

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

When you first provision a license to a BIG-IP, you have the option to add a free text entry into a field call "Chargeback Tag". However, if you missed this or want to change this tag at a later time, it is currently not possible to add or edit the entry via the BIG-IQ GUI.

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 BIG-IP’s IP Address or MachineID and corresponding Chargeback Tag text you want to create or edit into the /shared directory of BIG-IQ.

You will then run the script, which will confirm "Updating" followed by each IP address or MachineID and corresponding Chargeback Tag text.

The Chargeback Tag can be seen in the BIG-IQ GUI: Devices >> License Management >> Licenses >> select ELA name >> Select Offering Name of the license type.

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

In the /shared directory of BIG-IQ, create a CSV file named update.csv and enter the value pair on a line for each BIG-IP device tag to chage using the format:

<BIG-IP IP address1>,<new tag text>

<BIG-IP IP address2>,<new tag text>

Or

<BIG-IP MachineID 1>,<new tag text>

<BIG-IP MachineID 2>,<new tag text>

For example:

cd /shared

vi update.csv

Enter values:

10.11.10.43,new tag value

10.23.12.100, new tag value

Or

xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,new tag value

yyyyyyy-yyyy-yyy-yyy-yyyyyyyyyyyyy,new tag value

Save the file.

Please note that no inverted commas are needed, and spaces are accepted within the Chargeback Tag value

Create a file named update.sh in the same directory using your favourite editor, copy and paste the provided code below and make this file executable with:

chmod u+x update.sh

Run the script by entering

./update.sh

If everything runs correctly, the output showing:

Updating <ip address> to 'new tag'

Or

Updating <MachineId> to 'new tag'

will be shown for each entry within the update.csv file

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,deviceMachineId:.deviceMachineId}' -c >> /var/tmp/offerings
                done
        done
done
​
curl -s localhost:8100/cm/device/licensing/audit/ | jq '.items[]|{add:.address,id:.id,stat:.status,deviceMachineId:.machineId}' -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:

BIG-IQ 8.3.0

Updated Jun 02, 2023
Version 12.0

Was this article helpful?

No CommentsBe the first to comment