My script that updates the sensor's comments under a group is no longer working. This worked before. Could this be due to PRTG upgrades lately?
This is the script:
#!/bin/bash groupID=116442 uname=****.***** hash=********** runbookURL=https://asurion.service-now.com/kb_view.do?sysparm_article=KB0015183 prtgURL=`echo $runbookURL | sed -e 's/+/%2b/g'` output="This is a Front Office L2 Support EU Squad sensor.%0D%0ARunbook: $prtgURL"; curl -k "https://prtg.prod.asurion.net/api/table.xml?content=sensors&output=xml&columns=objid,device,sensor,status&id=$groupID&username=$uname&passhash=$hash" | while read item; do id=$(echo $item | grep '<objid' | cut -f2 -d">" | cut -f1 -d"<";) if [ -n "$id" ] then curl -k "https://prtg.prod.asurion.net/api/setobjectproperty.htm?id=$id&name=comments&value=$output&username=$uname&passhash=$hash" | awk -F"[><]" '{print $7}' fi done
Add comment