-
Notifications
You must be signed in to change notification settings - Fork 0
/
fnosummary
executable file
·21 lines (17 loc) · 1.09 KB
/
fnosummary
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/bash
# script to simplify Informix license reporting on FNO
#
# NOTE:
# For fnoadminpasswd - In the portal, click devices. For each device in turn, click the Action drop down and choose Set Password.
# Set the SAME password for each device. Put this password into the fnoadminpasswd file
#
# Copyright Spokey Wheeler, 18/2/2019
# MIT license
fnopwd=$( cat fnoadminpasswd )
while read -r line || [[ -n "$line" ]]
do
dvc2=$line
dvc=$( echo "${dvc2}" | awk '{print $1}' )
tkn=$( curl --request 'POST' --url "https://hclsoftware.compliance.flexnetoperations.com/api/1.0/instances/${dvc}/authorize" --header 'Content-Type: application/json' -d "{ \"user\" : \"admin\", \"password\" : \"${fnopwd}\" }" 2> /dev/null | grep token | tr -d \" | awk '{print $3}' )
curl --request "GET" --url "https://hclsoftware.compliance.flexnetoperations.com/api/1.0/instances/${dvc}/features" --header "Content-Type: application/json" --header "Authorization: Bearer ${tkn}" 2> /dev/null | grep used | head -1 | tr -d , | awk -v var="${dvc2}" '{printf "%d %s %s %s\n", $3, "licenses used (", var, ")"}'
done < fnohosts