Comment Tab Output:
This is a Front Office L2 Support sensor. Runbook: http://servicedesk/CAisd/pdmweb.exe?OP=SHOW_DETAIL+PERSID=KD:409413+HTMPL=kt_document_view.htmpl+open_mode=2
Bash Script:
#!/bin/bash groupID=81601 uname=_name.surname hash=********* runbookURL=http://servicedesk/CAisd/pdmweb.exe?OP=SHOW_DETAIL+PERSID=KD:409413+HTMPL=kt_document_view.htmpl+open_mode=2 prtgURL=`echo $runbookURL | sed -e 's/+/%2b/g'` output="This is a Front Office L2 Support 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