snmp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2026 License: MIT Imports: 8 Imported by: 0

README

SNMP plugin

The SNMP plugin provides checks that query SNMP.

Checks

snmp.int
check snmp.int "example" {
  agent = "192.168.1.1"
  port = 161
  community = "public"
  oid = [".1.3.6.1.4.1.2021.4.11.0", ".1.3.6.1.4.1.2021.4.4"]
  at_least = 10000
  at_most = 90000
}

Queries one or more SNMP OIDs, and checks that the (integer) value is in the given range.

Port and community are optional, defaulting to 161 and public.

Only one of at_least and at_most needs to be specified, but both can be.

snmp.string
check snmp.string "example" {
  agent = "192.168.1.1"
  port = 161
  community = "public"
  oid = ".1.3.6.1.4.1.2021.9.1.2"
  content = "HDD"
  content_expected = true
}

Queries one or more SNMP OIDs, and checks that the (string) value contains (or doesn't contain) the given content.

Port and community are optional, defaulting to 161 and public.

Content_expected is optional and defaults to true, if set to false then the check will fail if the given content is found in the returned value.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseCheck

type BaseCheck struct {
	Agent     string
	Port      int
	Community string
	Oid       []string
	// contains filtered or unexported fields
}

func (BaseCheck) Validate

func (b BaseCheck) Validate() error

type IntCheck

type IntCheck struct {
	BaseCheck `config:",squash"`
	AtLeast   int64 `config:"at_least"`
	AtMost    int64 `config:"at_most"`
}

func (IntCheck) Execute

func (c IntCheck) Execute(ctx context.Context) goplum.Result

func (IntCheck) Validate

func (c IntCheck) Validate() error

type Plugin

type Plugin struct{}

func (Plugin) Alert

func (p Plugin) Alert(kind string) goplum.Alert

func (Plugin) Check

func (p Plugin) Check(kind string) goplum.Check

type StringCheck

type StringCheck struct {
	BaseCheck       `config:",squash"`
	Content         string
	ContentExpected bool `config:"content_expected"`
}

func (StringCheck) Execute

func (s StringCheck) Execute(ctx context.Context) goplum.Result

func (StringCheck) Validate

func (s StringCheck) Validate() error

Jump to

Keyboard shortcuts

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