func (m *Monitor) RunForSeconds(runningSeconds int) {
	if runningSeconds != 0 {
		go func() {
			runningSecondsTime := time.Duration(runningSeconds) * time.Second
			<-time.After(runningSecondsTime)
			m.stop <- struct{}{}
		}()
	}
	for _, server := range m.config.Servers {
		go m.scheduleServer(server)
	}
	logger.Logln("Starting monitor.")
	m.monitor()
}
RunForSeconds runs monitor for runningSeconds seconds or infinitely if 0 is passed as an argument
package gossm
import (
	"fmt"
	"os"
	"time"
	"github.com/ssimunic/gossm/dial"
	"github.com/ssimunic/gossm/logger"
	"github.com/ssimunic/gossm/notify"
	"github.com/ssimunic/gossm/track"
)
type Monitor struct {
	config *Config
	checkerCh chan *Server
	notifiers notify.Notifiers
	notifierCh chan *Server
	notificationTracker map[*Server]*track.TimeTracker
	dialer *dial.Dialer
	stop chan struct{}
	serverStatusData *ServerStatusData
}
func NewMonitor(c *Config) *Monitor {
	m := &Monitor{
		config:              c,
		checkerCh:           make(chan *Server),
		notifiers:           c.Settings.Notifications.GetNotifiers(),
		notifierCh:          make(chan *Server),
		notificationTracker: make(map[*Server]*track.TimeTracker),
		dialer:              dial.NewDialer(c.Settings.Monitor.MaxConnections),
		stop:                make(chan struct{}),
		serverStatusData:    NewServerStatusData(c.Servers),
	}
	m.initialize()
	return m
}
func (m *Monitor) initialize() {
	for _, notifier := range m.notifiers {
		if initializer, ok := notifier.(notify.Initializer); ok {
			logger.Logln("Initializing", initializer)
			initializer.Initialize()
		}
	}
	for _, server := range m.config.Servers {
		m.notificationTracker[server] = NewTrackerWithExpBackoff(m.config.Settings.Monitor.ExponentialBackoffSeconds)
		switch {
		case server.CheckInterval <= 0:
			server.CheckInterval = m.config.Settings.Monitor.CheckInterval
		case server.Timeout <= 0:
			server.Timeout = m.config.Settings.Monitor.Timeout
		}
	}
}
func NewTrackerWithExpBackoff(expBackoffSeconds int) *track.TimeTracker {
	return track.NewTracker(track.NewExpBackoff(expBackoffSeconds))
}
func (m *Monitor) Run() {
	m.RunForSeconds(0)
}