systemdunits

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: GPL-3.0 Imports: 13 Imported by: 1

README

Systemd units state collector

Overview

Systemd is a suite of basic building blocks for a Linux system.

This collector monitors Systemd units state. Works only on Linux systems.

Collected metrics

Metrics grouped by scope.

The scope defines the instance that the metric belongs to. An instance is uniquely identified by a set of labels.

unit

These metrics refer to the systemd unit.

Labels:

Label Description
unit_name systemd unit name

Metrics:

Metric Dimensions Unit
systemd.service_unit_state active, inactive, activating, deactivating, failed state
systemd.socket_unit_state active, inactive, activating, deactivating, failed state
systemd.target_unit_state active, inactive, activating, deactivating, failed state
systemd.path_unit_state active, inactive, activating, deactivating, failed state
systemd.device_unit_state active, inactive, activating, deactivating, failed state
systemd.mount_unit_state active, inactive, activating, deactivating, failed state
systemd.automount_unit_state active, inactive, activating, deactivating, failed state
systemd.swap_unit_state active, inactive, activating, deactivating, failed state
systemd.timer_unit_state active, inactive, activating, deactivating, failed state
systemd.scope_unit_state active, inactive, activating, deactivating, failed state
systemd.slice_unit_state active, inactive, activating, deactivating, failed state

Setup

Prerequisites

No action required.

Configuration
File

The configuration file name is go.d/systemdunits.conf.

The file format is YAML. Generally, the format is:

update_every: 1
autodetection_retry: 0
jobs:
  - name: some_name1
  - name: some_name1

You can edit the configuration file using the edit-config script from the Netdata config directory.

cd /etc/netdata 2>/dev/null || cd /opt/netdata/etc/netdata
sudo ./edit-config go.d/systemdunits.conf
Options

The following options can be defined globally: update_every, autodetection_retry.

Config options
Name Description Default Required
update_every Data collection frequency. 1
autodetection_retry Re-check interval in seconds. Zero means not to schedule re-check. 0
include Systemd units filter. Pattern syntax is shell file name pattern. *.service
timeout System bus requests timeout. 1
Examples
Service units

Collect state of all service type units.

Config
jobs:
  - name: service
    include:
      - '*.service'
One specific unit

Collect state of one specific unit.

Config
jobs:
  - name: my-specific-service
    include:
      - 'my-specific.service'
All unit types

Collect state of all units.

Config
jobs:
  - name: my-specific-service-unit
    include:
      - '*'
Multi-instance

Note: When you define multiple jobs, their names must be unique.

Collect state of all service and socket type units.

Config
jobs:
  - name: service
    include:
      - '*.service'

  - name: socket
    include:
      - '*.socket'

Troubleshooting

Debug mode

To troubleshoot issues with the systemdunits collector, run the go.d.plugin with the debug option enabled. The output should give you clues as to why the collector isn't working.

  • Navigate to the plugins.d directory, usually at /usr/libexec/netdata/plugins.d/. If that's not the case on your system, open netdata.conf and look for the plugins setting under [directories].

    cd /usr/libexec/netdata/plugins.d/
    
  • Switch to the netdata user.

    sudo -u netdata -s
    
  • Run the go.d.plugin to debug the collector:

    ./go.d.plugin -d -m systemdunits
    

Documentation

Overview

Package systemdunits is a systemd units states collector

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Include []string     `yaml:"include"`
	Timeout web.Duration `yaml:"timeout"`
}

type SystemdUnits

type SystemdUnits struct {
	module.Base
	Config `yaml:",inline"`
	// contains filtered or unexported fields
}

func New

func New() *SystemdUnits

func (*SystemdUnits) Charts

func (s *SystemdUnits) Charts() *module.Charts

func (*SystemdUnits) Check

func (s *SystemdUnits) Check() bool

func (*SystemdUnits) Cleanup

func (s *SystemdUnits) Cleanup()

func (*SystemdUnits) Collect

func (s *SystemdUnits) Collect() map[string]int64

func (*SystemdUnits) Init

func (s *SystemdUnits) Init() bool

Jump to

Keyboard shortcuts

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