Skip to content

Draft: Add new operational support for services #1033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/confd/yang/confd.inc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MODULES=(
"[email protected]"
"[email protected]"
"[email protected]"
"infix-system@2025-01-25.yang"
"infix-system@2025-04-29.yang"
"[email protected]"
"[email protected]"
"[email protected]"
Expand Down
98 changes: 98 additions & 0 deletions src/confd/yang/confd/infix-system.yang
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ module infix-system {
contact "[email protected]";
description "Infix augments and deviations to ietf-system.";

revision 2025-04-29 {
description "Add services status.";
reference "internal";
}

revision 2025-01-25 {
description "Add DNS resolver status.";
reference "internal";
Expand Down Expand Up @@ -412,6 +417,99 @@ module infix-system {
}
}
}

container services {
description "List of monitored system services (processes)";
config false;

list service {
key "pid";
description "Tracked system service processes.";

leaf pid {
type uint32;
description "Process ID (PID) of the service.";
}

leaf name {
type string;
description "Name of the service or process.";
}

leaf description {
type string;
description
"Short description of the service.";
}

leaf status {
type enumeration {
enum halted {
description "Service is halted.";
}
enum missing {
description "Service files or dependencies are missing.";
}
enum crashed {
description "Service has crashed.";
}
enum stopped {
description "Service has been manually stopped.";
}
enum busy {
description "Service is busy.";
}
enum restart {
description "Service is restarting.";
}
enum conflict {
description "Service has a conflict preventing start.";
}
enum unknown {
description "Service is in an unknown state.";
}
enum done {
description "Service task has completed.";
}
enum failed {
description "Service task has failed.";
}
enum active {
description "Run/task type service is active.";
}
enum stopping {
description "Service is in the process of stopping.";
}
enum teardown {
description "Service is performing teardown operations.";
}
enum setup {
description "Service is setting up.";
}
enum cleanup {
description "Service is cleaning up.";
}
enum paused {
description "Service is paused.";
}
enum waiting {
description "Service is waiting for conditions.";
}
enum starting {
description "Service is starting.";
}
enum running {
description "Service is running.";
}
enum dead {
description "Service process is dead.";
}
}
description
"Detailed current status of the process.";
}
}
}
}

deviation "/sys:system/sys:hostname" {
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions src/statd/python/yanger/ietf_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,24 @@ def add_platform(out):

insert(out, "platform", platform)

def add_services(out):
data = HOST.run_json(["initctl", "-j"], [])
services = []

for d in data:
if "pid" not in d or "status" not in d or "identity" not in d or "description" not in d:
continue

entry = {
"pid": d["pid"],
"name": d["identity"],
"status": d["status"],
"description": d["description"]
}
services.append(entry)

insert(out, "infix-system:services", "service", services)

def add_software(out):
software = {}
try:
Expand Down Expand Up @@ -291,5 +309,6 @@ def operational():
add_dns(out_state)
add_clock(out_state)
add_platform(out_state)
add_services(out_state)

return out
142 changes: 142 additions & 0 deletions test/case/statd/system/ietf-system.json
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,148 @@
"os-version": "v25.04.0-rc1-3-g8daf1571-dirty",
"os-release": "v25.04.0-rc1-3-g8daf1571-dirty",
"machine": "x86_64"
},
"infix-system:services": {
"service": [
{
"pid": 1185,
"name": "udevd",
"status": "running",
"description": "Device event daemon (udev)"
},
{
"pid": 2248,
"name": "dbus",
"status": "running",
"description": "D-Bus message bus daemon"
},
{
"pid": 3039,
"name": "confd",
"status": "running",
"description": "Configuration daemon"
},
{
"pid": 3548,
"name": "netopeer",
"status": "running",
"description": "NETCONF server"
},
{
"pid": 2249,
"name": "dnsmasq",
"status": "running",
"description": "DHCP/DNS proxy"
},
{
"pid": 3559,
"name": "tty:hvc0",
"status": "running",
"description": "Getty on hvc0"
},
{
"pid": 2340,
"name": "iitod",
"status": "running",
"description": "LED daemon"
},
{
"pid": 3560,
"name": "klishd",
"status": "running",
"description": "CLI backend daemon"
},
{
"pid": 3617,
"name": "mdns-alias",
"status": "running",
"description": "mDNS alias advertiser "
},
{
"pid": 0,
"name": "mstpd",
"status": "stopped",
"description": "Spanning Tree daemon"
},
{
"pid": 3564,
"name": "rauc",
"status": "running",
"description": "Software update service"
},
{
"pid": 0,
"name": "resolvconf",
"status": "done",
"description": "Update DNS configuration"
},
{
"pid": 3472,
"name": "statd",
"status": "running",
"description": "Status daemon"
},
{
"pid": 3653,
"name": "staticd",
"status": "running",
"description": "Static routing daemon"
},
{
"pid": 2241,
"name": "syslogd",
"status": "running",
"description": "System log daemon"
},
{
"pid": 2242,
"name": "watchdogd",
"status": "running",
"description": "System watchdog daemon"
},
{
"pid": 3587,
"name": "zebra",
"status": "running",
"description": "Zebra routing daemon"
},
{
"pid": 3616,
"name": "mdns",
"status": "running",
"description": "Avahi mDNS-SD daemon"
},
{
"pid": 3618,
"name": "chronyd",
"status": "running",
"description": "Chrony NTP v3/v4 daemon"
},
{
"pid": 3633,
"name": "lldpd",
"status": "running",
"description": "LLDP daemon (IEEE 802.1ab)"
},
{
"pid": 3635,
"name": "nginx",
"status": "running",
"description": "Web server"
},
{
"pid": 3636,
"name": "rousette",
"status": "running",
"description": "RESTCONF server"
},
{
"pid": 3641,
"name": "sshd",
"status": "running",
"description": "OpenSSH daemon"
}
]
}
}
}
Loading
Loading