Skip to content

chrissnell/victorops-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

victorops-go

An unofficial Go library for the VictorOps on-call pager rotation service

Current Status

The VictorOps API is very limited and thus, this library is also limited. It only supports the sending of events.

Usage Example

package main

import (
	"github.com/chrissnell/victorops-go"
	"log"
	"time"
)

func main() {

	vo := victorops.NewClient("YOUR_API_KEY_GOES_HERE")

  // Only RoutingKey and MessageType are required.  The rest are all optional.
  // See the Event struct for all possible options.
  // If you don't set an EntityID, one will be set for you and returned in the response.  You can re-use
  // this EntityID to send updated events (i.e. changed status/MessageType) in subsequent requests.
	e := &victorops.Event{
		RoutingKey:        "SomeRoutingKey",
		MessageType:       victorops.Critical,
		EntityID:          "SomeServer/Disk",
		StateMessage:      "Disk space is almost full",
		Timestamp:         time.Now(),
		EntityDisplayName: "SomeServer",
	}

	resp, err := vo.SendAlert(e)
	if err != nil {
		log.Fatalln("Error:", err)
	}

	log.Printf("Response: %+v\n", resp)
}

Author

(c) 2015 Christopher Snell - http:https://output.chrissnell.com

About

Go library for the VictorOps on-call pager rotation service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages