GO Script to return Site 24x7 Monitor Group Details for specific Monitor Group ID

The following will take one argument which is the Monitor Group ID returned within the JSON from the previous blog post script.  This will return the full details for that monitor group i.e. monitors, display name etc
To compile

go build -tags 'main2' -o GetMonitorGroup.exe

// +build main2

package main

import (

func main() {
arg := os.Args[1]
    url := "https://www.site24x7.com/api/monitor_groups/" + arg
    fmt.Println("URL:>", url)

    req, err := http.NewRequest("GET", url, nil)
    req.Header.Set("Authorization", "Zoho-authtoken <place your token id here>")
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)
    if err != nil {
    defer resp.Body.Close()

    fmt.Println("response Status:", resp.Status)
    fmt.Println("response Headers:", resp.Header)
    body, _ := ioutil.ReadAll(resp.Body)
    fmt.Println("response Body:", string(body))


Popular posts from this blog

ActiveMQ, easy to use open source message oriented middleware (MOM)

Basic Send Message to MQ with Java and IBM MQ JMS

Apache Apollo