cronjob

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

README

Cronjob Input Plugin

The cronjob input plugin generates events using robfig/cron package. Each job produces one event with cronjob.%job name% routing key.

Job schedule param accepts expression in used library format with seconds in first field.

Configuration

[[inputs]]
  [inputs.cronjob]
    # cron location in IANA format
    # see more in https://pkg.go.dev/time#LoadLocation
    location = "UTC"

    # a list of scheduled jobs
    [[inputs.cronjob.jobs]]
      # job name, used in routing key of generated event
      name = "partition.create"
      # job schedule
      schedule = "0 0 0 * * *"

    [[inputs.cronjob.jobs]]
      name = "healthcheck.notify"
      schedule = "@every 10s"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cronjob

type Cronjob struct {
	*core.BaseInput `mapstructure:"-"`
	Location        string `mapstructure:"location"`
	Jobs            []*Job `mapstructure:"jobs"`
	// contains filtered or unexported fields
}

func (*Cronjob) Close

func (i *Cronjob) Close() error

func (*Cronjob) Init

func (i *Cronjob) Init() error

func (*Cronjob) Run

func (i *Cronjob) Run()

type Job

type Job struct {
	*core.BaseInput `mapstructure:"-"`
	Name            string `mapstructure:"name"`
	Schedule        string `mapstructure:"schedule"`
}

func (*Job) Run

func (j *Job) Run()

Jump to

Keyboard shortcuts

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