mirror of https://github.com/statping/statping
docs
parent
112b50aae2
commit
15c6e02e46
|
@ -2,7 +2,8 @@
|
|||
//
|
||||
// Example Notifier
|
||||
//
|
||||
// Below is an example of a Notifier with multiple Form values to custom your inputs.
|
||||
// Below is an example of a Notifier with multiple Form values to custom your inputs. Place your notifier go file
|
||||
// into the /notifiers/ directory and follow the example below.
|
||||
//
|
||||
// type ExampleNotifier struct {
|
||||
// *Notification
|
||||
|
@ -61,11 +62,60 @@
|
|||
// }},
|
||||
// }}
|
||||
//
|
||||
// Loading the Notifier into the Statup Notification system with the following
|
||||
// Load the Notifier
|
||||
//
|
||||
// Include the init() function with AddNotifier and your notification struct. This is ran on start of Statup
|
||||
// and will automatically create a new row in the database so the end user can save their own values.
|
||||
//
|
||||
// func init() {
|
||||
// AddNotifier(example)
|
||||
// }
|
||||
//
|
||||
// Required Methods for Notifier Interface
|
||||
//
|
||||
// Below are the required methods to have your notifier implement the Notifier interface. The Send method
|
||||
// will be where you would include the logic for your notification.
|
||||
//
|
||||
// // REQUIRED
|
||||
// func (n *ExampleNotifier) Send(msg interface{}) error {
|
||||
// message := msg.(string)
|
||||
// fmt.Printf("i received this string: %v\n", message)
|
||||
// return nil
|
||||
// }
|
||||
//
|
||||
// // REQUIRED
|
||||
// func (n *ExampleNotifier) Select() *Notification {
|
||||
// return n.Notification
|
||||
// }
|
||||
//
|
||||
// // REQUIRED
|
||||
// func (n *ExampleNotifier) OnSave() error {
|
||||
// msg := fmt.Sprintf("received on save trigger")
|
||||
// n.AddQueue(msg)
|
||||
// return errors.New("onsave triggered")
|
||||
// }
|
||||
//
|
||||
// Basic Events for Notifier
|
||||
//
|
||||
// You must include OnSuccess and OnFailure methods for your notifier. Anytime a service is online or offline
|
||||
// these methods will be ran with the service corresponding to it.
|
||||
//
|
||||
// // REQUIRED - BASIC EVENT
|
||||
// func (n *ExampleNotifier) OnSuccess(s *types.Service) {
|
||||
// msg := fmt.Sprintf("received a count trigger for service: %v\n", s.Name)
|
||||
// n.AddQueue(msg)
|
||||
// }
|
||||
//
|
||||
// // REQUIRED - BASIC EVENT
|
||||
// func (n *ExampleNotifier) OnFailure(s *types.Service, f *types.Failure) {
|
||||
// msg := fmt.Sprintf("received a failure trigger for service: %v\n", s.Name)
|
||||
// n.AddQueue(msg)
|
||||
// }
|
||||
//
|
||||
// Additional Events
|
||||
//
|
||||
// You can implement your notifier to different types of events that are triggered. Checkout the wiki to
|
||||
// see more details and examples of how to build your own notifier.
|
||||
//
|
||||
// More info on: https://github.com/hunterlong/statup/wiki/Notifiers
|
||||
package notifier
|
||||
|
|
Loading…
Reference in New Issue