
I utilized the VictorOps REST API with PowerShell to return data in a user readable format, or to use with PRTG sensors.
I wanted a way to display who was currently on call via a PRTG map that other users can publicly access.
Note: This is something I wrote in a day, and it will be evolving into a cleaner, error checked format!
-getInfo
-team
-user
-format
Examples
Here is some example output.
.\Get-VictorOpsInfo.ps1 -getInfo incidents
.\Get-VictorOpsInfo.ps1 -getInfo incidents -format prtg
You'll need your API Key and ID from VictorOps. Once you have that, be sure to set them in the script.
$apiKey = '' $apiID= ''
You can generate a key in VictorOps by going to "Settings -> API."
Be sure to change this switch to match your team setup in VictorOps.
Switch ($team) {
{$team -like "*team1*"}{
$teamName ='team1name'
}
{$team -like "*team2*"} {
$teamName = 'team2name'
}
}Your username will be set to the username you're logged into the machine with. This is important to note as it sends username when you use the script to ack alerts. To change this, edit the following (you'll want to do this if your username does not match the one in VictorOps):
$ackUser = (Get-ChildItem ENV:\USERNAME).Value
To use this and report info into PRTG, setup the script and ensure Quest AD PowerShell tools are installed on the PRTG machine.
You can also setup a sensor for team on call reporting.
To do this, perform the above steps, but specify the parameters -getInfo OnCall -team unix -format prtg.
That will return a sensor that returns a text message of who is on call with their phone number (pulled from AD).
You can then create a map in PRTG of who is on call that can be provided publicly. To get the on call info use the "Status Icons -> Sensor Message only" Properties in the PRTG map builder.
Scanning Interval
Be sure to change the scanning interval in PRTG to something that makes sense. There probably isn't a reason to keep it at every minute, so change it!
Have any ideas on how to use this, or general feedback? Leave a comment!
No comments yet. Be the first!