notifiers

package
v0.90.74 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2020 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Overview

DO NOT EDIT ** This file was generated with go generate on 2020-10-13 00:26:28.325328 +0000 UTC ** DO NOT EDIT //

Index

Constants

This section is empty.

Variables

View Source
var AmazonSNS = &amazonSNS{&notifications.Notification{
	Method:      "amazon_sns",
	Title:       "Amazon SNS",
	Description: "Use amazonSNS to receive push notifications. Add your amazonSNS URL and App Token to receive notifications.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Icon:        "fab fa-amazon",
	Delay:       5 * time.Second,
	Limits:      60,
	SuccessData: null.NewNullString(`{{.Service.Name}} is back online and was down for {{.Service.Downtime.Human}}`),
	FailureData: null.NewNullString(`{{.Service.Name}} is offline and has been down for {{.Service.Downtime.Human}}`),
	DataType:    "html",
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "AWS Access Token",
		DbField:     "api_key",
		Placeholder: "AKPMED5XUXSEU3O5AB6M",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "AWS Secret Key",
		DbField:     "api_secret",
		Placeholder: "39eAZODxEosHRgzLx173ttX9sCtJVOE8rzElRE9B",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "Region",
		SmallText:   "Amazon Region for SNS",
		DbField:     "var1",
		Placeholder: "us-west-2",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "SNS Topic ARN",
		SmallText:   "The ARN of the Topic",
		DbField:     "Host",
		Placeholder: "arn:aws:sns:us-west-2:123456789012:YourTopic",
		Required:    true,
	}}},
}
View Source
var Command = &commandLine{&notifications.Notification{
	Method:      "command",
	Title:       "Command",
	Description: "Shell Command allows you to run a customized shell/bash Command on the local machine it's running on.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Delay:       time.Duration(1 * time.Second),
	Icon:        "fas fa-terminal",
	SuccessData: null.NewNullString("/usr/bin/curl -L http://localhost:8080"),
	FailureData: null.NewNullString("/usr/bin/curl -L http://localhost:8080"),
	DataType:    "text",
	Limits:      60,
}}
View Source
var Discorder = &discord{&notifications.Notification{
	Method:      "discord",
	Title:       "Discord",
	Description: "Send notifications to your discord channel using discord webhooks. Insert your discord channel Webhook URL to receive notifications. Based on the <a href=\"https://discordapp.com/developers/docs/resources/Webhook\">discord webhooker API</a>.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Delay:       time.Duration(5 * time.Second),
	Icon:        "fab fa-discord",
	SuccessData: null.NewNullString(`{"content": "Your service '{{.Service.Name}}' is currently back online and was down for {{.Service.Downtime.Human}}."}`),
	FailureData: null.NewNullString(`{"content": "Your service '{{.Service.Name}}' is has been failing for {{.Service.Downtime.Human}}! Reason: {{.Failure.Issue}}"}`),
	DataType:    "json",
	Limits:      60,
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "discord webhooker URL",
		Placeholder: "https://discordapp.com/api/webhooks/****/*****",
		DbField:     "host",
	}}},
}
View Source
var Gotify = &gotify{&notifications.Notification{
	Method:      "gotify",
	Title:       "Gotify",
	Description: "Use Gotify to receive push notifications. Add your Gotify URL and App Token to receive notifications.",
	Author:      "Hugo van Rijswijk",
	AuthorUrl:   "https://github.com/hugo-vrijswijk",
	Icon:        "broadcast-tower",
	Delay:       time.Duration(5 * time.Second),
	Limits:      60,
	SuccessData: null.NewNullString(`{"title": "{{.Service.Name}}", "message": "Your service '{{.Service.Name}}' is currently online!", "priority": 2}`),
	FailureData: null.NewNullString(`{"title": "{{.Service.Name}}", "message": "Your service '{{.Service.Name}}' is currently failing! Reason: {{.Failure.Issue}}", "priority": 5}`),
	DataType:    "json",
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "Gotify URL",
		SmallText:   "Gotify server URL, including http(s):// and port if needed",
		DbField:     "Host",
		Placeholder: "https://gotify.domain.com",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "App Token",
		SmallText:   "The Application Token generated by Gotify",
		DbField:     "api_key",
		Placeholder: "TB5gatYYyR.FCD2",
		Required:    true,
	}}},
}
View Source
var LineNotify = &lineNotifier{&notifications.Notification{
	Method:      lineNotifyMethod,
	Title:       "LINE Notify",
	Description: "LINE Notify will send notifications to your LINE Notify account when services are offline or online. Based on the <a href=\"https://notify-bot.line.me/doc/en/\">LINE Notify API</a>.",
	Author:      "Kanin Peanviriyakulkit",
	AuthorUrl:   "https://github.com/dogrocker",
	Icon:        "far fa-bell",
	Limits:      60,
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "Access Token",
		Placeholder: "Insert your Line Notify Access Token here.",
		DbField:     "api_secret",
	}}},
}
View Source
var Mobile = &mobilePush{&notifications.Notification{
	Method: "mobile",
	Title:  "Mobile",
	Description: `Receive push notifications on your Mobile device using the Statping App. You can scan the Authentication QR Code found in Settings to get the Mobile app setup in seconds.
				 <p align="center"><a href="https://play.google.com/store/apps/details?id=com.statping"><img src="https://img.cjx.io/google-play.svg"></a><a href="https://itunes.apple.com/us/app/apple-store/id1445513219"><img src="https://img.cjx.io/app-store-badge.svg"></a></p>`,
	Author:    "Hunter Long",
	AuthorUrl: "https://github.com/hunterlong",
	Delay:     time.Duration(5 * time.Second),
	Icon:      "fas fa-mobile-alt",
	Limits:    30,
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "Device Identifiers",
		Placeholder: "A list of your Mobile device push notification ID's.",
		DbField:     "var1",
		IsHidden:    true,
	},
	}},
}
View Source
var Pushover = &pushover{&notifications.Notification{
	Method:      "pushover",
	Title:       "Pushover",
	Description: "Use Pushover to receive push notifications. You will need to create a <a href=\"https://pushover.net/apps/build\">New Application</a> on Pushover before using this notifier.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Icon:        "fa dot-circle",
	Delay:       time.Duration(10 * time.Second),
	Limits:      60,
	SuccessData: null.NewNullString(`Your service '{{.Service.Name}}' is currently online!`),
	FailureData: null.NewNullString(`Your service '{{.Service.Name}}' is currently offline!`),
	DataType:    "text",
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "User Token",
		Placeholder: "Insert your Pushover User Token",
		DbField:     "api_key",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "Application API Key",
		Placeholder: "Create an Application and insert the API Key here",
		DbField:     "api_secret",
		Required:    true,
	}, {
		Type:        "list",
		Title:       "Priority",
		Placeholder: "Set the notification priority level",
		DbField:     "Var1",
		Required:    true,
		ListOptions: []string{"Lowest", "Low", "Normal", "High", "Emergency"},
	}, {
		Type:        "list",
		Title:       "Notification Sound",
		Placeholder: "Choose a sound for this Pushover notification",
		DbField:     "Var2",
		Required:    true,
		ListOptions: []string{"none", "pushover", "bike", "bugle", "cashregister", "classical", "cosmic", "falling", "gamelan", "incoming", "intermissioon", "magic", "mechanical", "painobar", "siren", "spacealarm", "tugboat", "alien", "climb", "persistent", "echo", "updown"},
	},
	}},
}
View Source
var Telegram = &telegram{&notifications.Notification{
	Method:      "telegram",
	Title:       "Telegram",
	Description: "Receive notifications on your Telegram channel when a service has an issue. You must get a Telegram API token from the /botfather. Review the <a target=\"_blank\" href=\"http://techthoughts.info/how-to-create-a-telegram-bot-and-send-messages-via-api\">Telegram API Tutorial</a> to learn how to generate a new API Token.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Icon:        "fab fa-telegram-plane",
	Delay:       time.Duration(5 * time.Second),
	SuccessData: null.NewNullString("Your service '{{.Service.Name}}' is currently online!"),
	FailureData: null.NewNullString("Your service '{{.Service.Name}}' is currently offline!"),
	DataType:    "text",
	Limits:      60,
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "Telegram API Token",
		Placeholder: "383810182:EEx829dtCeufeQYXG7CUdiQopqdmmxBPO7-s",
		SmallText:   "Enter the API Token given to you from the /botfather chat.",
		DbField:     "api_secret",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "Channel",
		Placeholder: "@statping_channel",
		SmallText:   "Insert your Telegram Channel including the @ symbol. The bot will need to be an administrator of this channel.",
		DbField:     "var1",
		Required:    true,
	}}},
}
View Source
var Twilio = &twilio{&notifications.Notification{
	Method:      "twilio",
	Title:       "Twilio",
	Description: "Receive SMS text messages directly to your cellphone when a service is offline. You can use a Twilio test account with limits. This notifier uses the <a href=\"https://www.twilio.com/docs/usage/api\">Twilio API</a>.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Icon:        "far fa-comment-alt",
	Delay:       time.Duration(10 * time.Second),
	SuccessData: null.NewNullString("Your service '{{.Service.Name}}' is currently online!"),
	FailureData: null.NewNullString("Your service '{{.Service.Name}}' is currently offline!"),
	DataType:    "text",
	Limits:      15,
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "Account SID",
		Placeholder: "Insert your Twilio Account SID",
		DbField:     "api_key",
		Required:    true,
	}, {
		Type:        "text",
		Title:       "Account Token",
		Placeholder: "Insert your Twilio Account Token",
		DbField:     "api_secret",
		Required:    true,
	}, {
		Type:        "number",
		Title:       "SMS to Phone Number",
		Placeholder: "18555555555",
		DbField:     "Var1",
		Required:    true,
	}, {
		Type:        "number",
		Title:       "From Phone Number",
		Placeholder: "18555555555",
		DbField:     "Var2",
		Required:    true,
	}}},
}
View Source
var Webhook = &webhooker{&notifications.Notification{
	Method:      webhookMethod,
	Title:       "Webhook",
	Description: "Send a custom HTTP request to a specific URL with your own body, headers, and parameters.",
	Author:      "Hunter Long",
	AuthorUrl:   "https://github.com/hunterlong",
	Icon:        "fas fa-code-branch",
	Delay:       time.Duration(3 * time.Second),
	SuccessData: null.NewNullString(`{"id": "{{.Service.Id}}", "online": true}`),
	FailureData: null.NewNullString(`{"id": "{{.Service.Id}}", "online": false}`),
	DataType:    "json",
	Limits:      180,
	Form: []notifications.NotificationForm{{
		Type:        "text",
		Title:       "HTTP Endpoint",
		Placeholder: "http://webhookurl.com/JW2MCP4SKQP",
		SmallText:   "Insert the URL for your HTTP Requests.",
		DbField:     "Host",
		Required:    true,
	}, {
		Type:        "list",
		Title:       "HTTP Method",
		Placeholder: "POST",
		SmallText:   "Choose a HTTP method for example: GET, POST, DELETE, or PATCH.",
		DbField:     "Var1",
		Required:    true,
		ListOptions: []string{"GET", "POST", "PATCH", "DELETE"},
	}, {
		Type:        "text",
		Title:       "Content Type",
		Placeholder: `application/json`,
		SmallText:   "Optional content type for example: application/json or text/plain",
		DbField:     "api_key",
	}, {
		Type:        "text",
		Title:       "Header",
		Placeholder: "Authorization=Token12345",
		SmallText:   "Optional Headers for request use format: KEY=Value,Key=Value",
		DbField:     "api_secret",
	},
	}}}

Functions

func Add added in v0.90.11

func Add(notifs ...services.ServiceNotifier)

func InitNotifiers added in v0.90.11

func InitNotifiers()

func ReplaceTemplate added in v0.90.36

func ReplaceTemplate(tmpl string, data replacer) string

func ReplaceVars added in v0.90.16

func ReplaceVars(input string, s services.Service, f failures.Failure) string

Types

type PushNotification added in v0.80.2

type PushNotification struct {
	Array []*pushArray `json:"notifications"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL