[FEATURE REQUEST] A plugin to monitor the Sensu license
Opened this issue · 0 comments
asachs01 commented
As an enterprise or free user, I'd like to know if my license is close to expiring.
I've created this hacky bash script, but it's not an ideal solution:
#!/bin/bash
#Set variables
CURRENT_DATETIME=$(date -d now +"%s")
LICENSE_EXPIRY=$(sensuctl license info --format wrapped-json | jq .spec.license.validUntil | xargs)
LICENSE_EXPIRY_DATETIME=$(date -d $LICENSE_EXPIRY +"%s")
#Uncomment to make sure vars are working
#echo $CURRENT_DATETIME
#echo $LICENSE_EXPIRY_DATETIME
#Do some maths
DAYS_LEFT=$(( ( LICENSE_EXPIRY_DATETIME - CURRENT_DATETIME )/(60*60*24) ))
if [ $DAYS_LEFT -le 60 ]
then
echo "You have less than 60 days left for your Sensu license";
exit 1
elif [ $DAYS_LEFT -le 30 ]
then
echo "You have less than 30 days left for your Sensu license"
exit 2
else
echo "You have greater than 60 days left for your Sensu license"
exit 0
fi