Posts

Showing posts from January, 2016

Next Post - Check Multi Path Status & Policy Across Core Infrastructure During SAN Upgrades

From GO to PowerCLI....... How often do you perform routine SAN upgrades such as extending flash disks etc, and your SAN provider asks you, please verify all your multipath is fully working prior and after the upgrade. Multiple systems e.g. VM Cluster, Linux Physical Servers, Linux Appliances which use the SAN.... Rundeck, PowerCLI, Bash & Expect to the rescue ...... coming next....

ROUGH - First Attempt at Site24x7 Provider for Terraform

This is fairly rough at the moment but its the basic structure of a resource within a terraform provider to support Site24x7 API using GO/REST API. // resource_MonitorGroup.go package main import ( "github.com/hashicorp/terraform/helper/schema"   "bytes"   "encoding/json"   "net/http"   "io/ioutil" ) type Site24x7MonitorGroup struct { Code int `json:"code"` Message string `json:"message"` Data struct { GroupID string `json:"group_id"` DisplayName string `json:"display_name"` Description string `json:"description"` Monitors []interface{} `json:"monitors"` } `json:"data"` } func resourceMonitorGroup() *schema.Resource { return &schema.Resource{ Create: resourceMonitorGroupCreate, Read:   resourceMonitorGroupRead, Update: resourceMonitorGroupUpdate, Delete: resourceMonitorGroupDelete, Schema: map[string]*schema

GO - Create Monitor Group in Site24x7 via REST API + JSON

package main import ( "bytes"     "fmt"     "net/http"     "io/ioutil" ) func main() {     url := "https://www.site24x7.com/api/monitor_groups"     fmt.Println("URL:>", url)     var jsonStr = []byte(` {    "display_name": "Test Automation Group",     "description": "Include Test Automation Monitors In This Group" }`)     req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonStr)) req.Header.Set("Authorization", "Zoho-authtoken <replace with your token-id>") req.Header.Set("Content-Type", "application/json")     client := &http.Client{}     resp, err := client.Do(req)     if err != nil {         panic(err)     }     defer resp.Body.Close()     fmt.Println("response Status:", resp.Status)     fmt.Println("response Headers:", resp.Header)     body, _ := ioutil.ReadAll(r

Convert Json to GO Structure

https://mholt.github.io/json-to-go/

test

test

NEXT - Terraform Provider for Site24x7..............

NEXT POST - Terraform Provider for Site24x7..............

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 (     "fmt" "os"     "net/http"     "io/ioutil" ) 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 {         panic(err)     }     defer resp.Body.Close()     fmt.Println("re

GO Routine to Call Site 24x7 API using net/http

Not too familar with GO just yet but needed to create some simple routine to make RESTFUL API call via  HTTP GET to access Site 24x7 API go build -tags 'main1' -o GetMonitorGroups.exe // +build main1 package main import (     "fmt"     "net/http"     "io/ioutil" ) func main() {     url := "https://www.site24x7.com/api/monitor_groups"     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 {         panic(err)     }     defer resp.Body.Close()     fmt.Println("response Status:", resp.Status)     fmt.Println("response Headers:", resp.Header)     body, _ := ioutil.ReadAll(resp.Body)