Source
case "service", "target", "automount", "device", "mount", "path", "scope", "slice", "snapshot", "socket", "swap", "timer":
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
package systemd
import (
"encoding/json"
"fmt"
"path/filepath"
"reflect"
"strings"
"sync"
"github.com/godbus/dbus/v5"
"golang.zabbix.com/sdk/errs"
"golang.zabbix.com/sdk/plugin"
)
// Plugin -
type Plugin struct {
plugin.Base
connections []*dbus.Conn
mutex sync.Mutex
}
var impl Plugin
type unit struct {
Name string
Description string
LoadState string
ActiveState string
SubState string
Followed string
Path string
JobID uint32
JobType string
JobPath string
}
type unitFile struct {
Name string
EnablementState string
}
type unitJson struct {
Name string `json:"{#UNIT.NAME}"`
Description string `json:"{#UNIT.DESCRIPTION}"`
LoadState string `json:"{#UNIT.LOADSTATE}"`
ActiveState string `json:"{#UNIT.ACTIVESTATE}"`
SubState string `json:"{#UNIT.SUBSTATE}"`
Followed string `json:"{#UNIT.FOLLOWED}"`