lib

package
v0.0.0-...-11af641 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const DROP_IN_DIRECTORY = "/etc/cron.d"
View Source
const SYSTEM_CRONTAB = "/etc/crontab"

Variables

This section is empty.

Functions

func EnumerateCrontabFiles

func EnumerateCrontabFiles(dirToEnumerate string) []string

func SendLogData

func SendLogData(apiKey string, monitorKey string, seriesID string, outputLogs string) ([]byte, error)

Types

type CronitorApi

type CronitorApi struct {
	IsDev          bool
	IsAutoDiscover bool
	ApiKey         string
	UserAgent      string
	Logger         func(string)
}

func (CronitorApi) GetMonitors

func (api CronitorApi) GetMonitors() ([]MonitorSummary, error)

func (CronitorApi) GetRawResponse

func (api CronitorApi) GetRawResponse(url string) ([]byte, error)

func (CronitorApi) PutMonitors

func (api CronitorApi) PutMonitors(monitors map[string]*Monitor) (map[string]*Monitor, error)

func (CronitorApi) Url

func (api CronitorApi) Url() string

type Crontab

type Crontab struct {
	User                    string
	IsUserCrontab           bool
	IsSaved                 bool
	Filename                string
	Lines                   []*Line
	TimezoneLocationName    *TimezoneLocationName
	UsesSixFieldExpressions bool
}

func CrontabFactory

func CrontabFactory(username, filename string) *Crontab

func ReadCrontabFromFile

func ReadCrontabFromFile(username, filename string, crontabs []*Crontab) []*Crontab

func ReadCrontabsInDirectory

func ReadCrontabsInDirectory(username, directory string, crontabs []*Crontab) []*Crontab

func (Crontab) CanonicalName

func (c Crontab) CanonicalName() string

func (Crontab) DisplayName

func (c Crontab) DisplayName() string

func (Crontab) Exists

func (c Crontab) Exists() bool

func (Crontab) IsRoot

func (c Crontab) IsRoot() bool

func (Crontab) IsWritable

func (c Crontab) IsWritable() bool

func (*Crontab) Parse

func (c *Crontab) Parse(noAutoDiscover bool) (error, int)

func (Crontab) Save

func (c Crontab) Save(crontabLines string) error

func (Crontab) Write

func (c Crontab) Write() string

type Line

type Line struct {
	Name           string
	FullLine       string
	LineNumber     int
	CronExpression string
	CommandToRun   string
	Code           string
	RunAs          string
	Mon            Monitor
}

func (Line) CommandIsComplex

func (l Line) CommandIsComplex() bool

func (Line) HasLegacyIntegration

func (l Line) HasLegacyIntegration() bool

func (Line) IsAutoDiscoverCommand

func (l Line) IsAutoDiscoverCommand() bool

func (Line) IsMetaCronJob

func (l Line) IsMetaCronJob() bool

func (Line) IsMonitorable

func (l Line) IsMonitorable() bool

func (Line) Key

func (l Line) Key(CanonicalPath string) string

func (Line) Write

func (l Line) Write() string

type Monitor

type Monitor struct {
	Name             string              `json:"name,omitempty"`
	DefaultName      string              `json:"defaultName"`
	Key              string              `json:"key"`
	Rules            []Rule              `json:"rules"`
	Tags             []string            `json:"tags"`
	Type             string              `json:"type"`
	Code             string              `json:"code,omitempty"`
	Timezone         string              `json:"timezone,omitempty"`
	Note             string              `json:"defaultNote,omitempty"`
	Notifications    map[string][]string `json:"notifications,omitempty"`
	NoStdoutPassthru bool                `json:"-"`
}

type MonitorSummary

type MonitorSummary struct {
	Name        string `json:"name,omitempty"`
	DefaultName string `json:"defaultName"`
	Key         string `json:"key"`
	Code        string `json:"code,omitempty"`
}

type Rule

type Rule struct {
	RuleType     string    `json:"rule_type"`
	Value        RuleValue `json:"value"`
	TimeUnit     string    `json:"time_unit,omitempty"`
	GraceSeconds uint      `json:"grace_seconds,omitempty"`
}

type RuleValue

type RuleValue string

func (*RuleValue) UnmarshalJSON

func (fi *RuleValue) UnmarshalJSON(b []byte) error

type TimezoneLocationName

type TimezoneLocationName struct {
	Name string
}

Jump to

Keyboard shortcuts

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