GithubHelp home page GithubHelp logo

updown's Introduction

Antoine Augusti's github stats

updown's People

Contributors

aliartiza75 avatar antoineaugusti avatar golint-fixer avatar josephinesharp avatar mvisonneau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

updown's Issues

issue in CheckItem struct definition

Hi @AntoineAugusti,

While using your go module I hit with an issue.

Issue Details

In CheckItem Struct

type CheckItem struct {
		// The URL you want to monitor
		URL string `json:"url,omitempty"`
		// Interval in seconds (30, 60, 120, 300 or 600)
		Period int `json:"period,omitempty"`
		// APDEX threshold in seconds (0.125, 0.25, 0.5 or 1.0)
		Apdex float64 `json:"apdex_t,omitempty"`
		// Is the check enabled
		Enabled bool `json:"enabled,omitempty"`
		// Shall the status page be public
		Published bool `json:"published,omitempty"`
		// Human readable name
		Alias string `json:"alias,omitempty"`
		// Search for this string in the page
		StringMatch string `json:"string_match,omitempty"`
		// Mute notifications until given time, accepts a time, 'recovery' or 'forever'
		MuteUntil string `json:"mute_until,omitempty"`
		// Disabled monitoring locations. It's an array of abbreviated location names
		DisabledLocations []string `json:"disabled_locations,omitempty"`
		// The HTTP headers you want in updown requests
		CustomHeaders map[string]string `json:"custom_headers,omitempty"`
	}

the omitempty param is causing the struct attributes to omit, like when I assign false to Published its gets omitted.

Because of this issue, I am unable to Update Updown's check features.

Issue location

omitempty basically causes an issue at this place in your code.

client.go:88

buf := new(bytes.Buffer)
if body != nil {
	err := json.NewEncoder(buf).Encode(body)
	if err != nil {
		return nil, err
	}
}

Sample Code

Sample Code given below explain how omitempty params causes struct attributes to omit.

package main

import (
	"encoding/json"
	"fmt"
)

func main() {

	type CheckItem struct {
		// The URL you want to monitor
		URL string `json:"url,omitempty"`
		// Interval in seconds (30, 60, 120, 300 or 600)
		Period int `json:"period,omitempty"`
		// APDEX threshold in seconds (0.125, 0.25, 0.5 or 1.0)
		Apdex float64 `json:"apdex_t,omitempty"`
		// Is the check enabled
		Enabled bool `json:"enabled,omitempty"`
		// Shall the status page be public
		Published bool `json:"published,omitempty"`
		// Human readable name
		Alias string `json:"alias,omitempty"`
		// Search for this string in the page
		StringMatch string `json:"string_match,omitempty"`
		// Mute notifications until given time, accepts a time, 'recovery' or 'forever'
		MuteUntil string `json:"mute_until,omitempty"`
		// Disabled monitoring locations. It's an array of abbreviated location names
		DisabledLocations []string `json:"disabled_locations,omitempty"`
		// The HTTP headers you want in updown requests
		CustomHeaders map[string]string `json:"custom_headers,omitempty"`
	}

	s := CheckItem{Published: true}
	fmt.Println(s)

	out, err := json.Marshal(s)
	if err != nil {
		panic(err)
	}
	fmt.Println(string(out))

}

Help needed in this regards. Thank you

Regards
Irtiza

how to add email alert address

Hi @AntoineAugusti,

I am using you go package for updown monitor and its rocking. Just want to know is there a way to add email alert addresses either by using your package or updown's REST API.

I am unable to find any resource in that regards, help would be appreciated.

Thank you
Irtiza

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.