#!/bin/bash # # AUTHOR - Raman Sailopal # # Script that uses Unitrends API to attain backup failure information # credentials file is required # # First passed field is the Protected Asset name and the second is the IP # address of the Unitrends server # dat=$(date +%b" "%d", "%Y) token=$(curl -s -X POST -d @/usr/lib64/Nagios/plugins/utrendjson -H "Accept: application/json" -H "Host: "$2 $2"/api/login" | jq .auth_token) token1=$(echo $token | tr -d '"') #curl -s -X GET -H "Accept: application/json" -H "Host: "$2 -H "AuthToken: $token1" $2"/api/reports/backup/failure" cnames=$(curl -s -X GET -H "Accept: application/json" -H "Host: "$2 -H "AuthToken: $token1" $2"/api/reports/backup/failure" | jq '.data[].client_name') sdates=$(curl -s -X GET -H "Accept: application/json" -H "Host: "$2 -H "AuthToken: $token1" $2"/api/reports/backup/failure" | jq '.data[].start_date') count=0 for var in $(echo $cnames) do count=$(echo $count + 1 | bc) clientnames[$count]=$var done count1=0 echo $sdates | awk -F\" '{ for (i=1;i