Skip to content

Commit ab8b174

Browse files
committed
confd: augment new services container to ietf-system
This patch adds operational data support for system services. The data is in a generic format but is intended to be able to represent finit information (initctl) nicely. The reason for augmenting this to ietf-system and not to infix-services is that we consider this generic system information which is totally disconnected from what ever services infix might provide. In this first state we only support pid, name, description and state. Making the data look something like: "infix-system:services": { "service": [ { "pid": 1185, "name": "udevd", "status": "running", "description": "Device event daemon (udev)" }] Signed-off-by: Richard Alpe <[email protected]>
1 parent 7560da8 commit ab8b174

File tree

6 files changed

+661
-1
lines changed

6 files changed

+661
-1
lines changed

src/confd/yang/confd.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ MODULES=(
3030
3131
3232
33-
"infix-system@2025-01-25.yang"
33+
"infix-system@2025-04-29.yang"
3434
3535
3636

src/confd/yang/confd/infix-system.yang

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ module infix-system {
2828
contact "[email protected]";
2929
description "Infix augments and deviations to ietf-system.";
3030

31+
revision 2025-04-29 {
32+
description "Add services status.";
33+
reference "internal";
34+
}
35+
3136
revision 2025-01-25 {
3237
description "Add DNS resolver status.";
3338
reference "internal";
@@ -412,6 +417,99 @@ module infix-system {
412417
}
413418
}
414419
}
420+
421+
container services {
422+
description "List of monitored system services (processes)";
423+
config false;
424+
425+
list service {
426+
key "pid";
427+
description "Tracked system service processes.";
428+
429+
leaf pid {
430+
type uint32;
431+
description "Process ID (PID) of the service.";
432+
}
433+
434+
leaf name {
435+
type string;
436+
description "Name of the service or process.";
437+
}
438+
439+
leaf description {
440+
type string;
441+
description
442+
"Short description of the service.";
443+
}
444+
445+
leaf status {
446+
type enumeration {
447+
enum halted {
448+
description "Service is halted.";
449+
}
450+
enum missing {
451+
description "Service files or dependencies are missing.";
452+
}
453+
enum crashed {
454+
description "Service has crashed.";
455+
}
456+
enum stopped {
457+
description "Service has been manually stopped.";
458+
}
459+
enum busy {
460+
description "Service is busy.";
461+
}
462+
enum restart {
463+
description "Service is restarting.";
464+
}
465+
enum conflict {
466+
description "Service has a conflict preventing start.";
467+
}
468+
enum unknown {
469+
description "Service is in an unknown state.";
470+
}
471+
enum done {
472+
description "Service task has completed.";
473+
}
474+
enum failed {
475+
description "Service task has failed.";
476+
}
477+
enum active {
478+
description "Run/task type service is active.";
479+
}
480+
enum stopping {
481+
description "Service is in the process of stopping.";
482+
}
483+
enum teardown {
484+
description "Service is performing teardown operations.";
485+
}
486+
enum setup {
487+
description "Service is setting up.";
488+
}
489+
enum cleanup {
490+
description "Service is cleaning up.";
491+
}
492+
enum paused {
493+
description "Service is paused.";
494+
}
495+
enum waiting {
496+
description "Service is waiting for conditions.";
497+
}
498+
enum starting {
499+
description "Service is starting.";
500+
}
501+
enum running {
502+
description "Service is running.";
503+
}
504+
enum dead {
505+
description "Service process is dead.";
506+
}
507+
}
508+
description
509+
"Detailed current status of the process.";
510+
}
511+
}
512+
}
415513
}
416514

417515
deviation "/sys:system/sys:hostname" {

src/statd/python/yanger/ietf_system.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,24 @@ def add_platform(out):
177177

178178
insert(out, "platform", platform)
179179

180+
def add_services(out):
181+
data = HOST.run_json(["initctl", "-j"], [])
182+
services = []
183+
184+
for d in data:
185+
if "pid" not in d or "status" not in d or "identity" not in d or "description" not in d:
186+
continue
187+
188+
entry = {
189+
"pid": d["pid"],
190+
"name": d["identity"],
191+
"status": d["status"],
192+
"description": d["description"]
193+
}
194+
services.append(entry)
195+
196+
insert(out, "infix-system:services", "service", services)
197+
180198
def add_software(out):
181199
software = {}
182200
try:
@@ -291,5 +309,6 @@ def operational():
291309
add_dns(out_state)
292310
add_clock(out_state)
293311
add_platform(out_state)
312+
add_services(out_state)
294313

295314
return out

test/case/statd/system/ietf-system.json

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,148 @@
128128
"os-version": "v25.04.0-rc1-3-g8daf1571-dirty",
129129
"os-release": "v25.04.0-rc1-3-g8daf1571-dirty",
130130
"machine": "x86_64"
131+
},
132+
"infix-system:services": {
133+
"service": [
134+
{
135+
"pid": 1185,
136+
"name": "udevd",
137+
"status": "running",
138+
"description": "Device event daemon (udev)"
139+
},
140+
{
141+
"pid": 2248,
142+
"name": "dbus",
143+
"status": "running",
144+
"description": "D-Bus message bus daemon"
145+
},
146+
{
147+
"pid": 3039,
148+
"name": "confd",
149+
"status": "running",
150+
"description": "Configuration daemon"
151+
},
152+
{
153+
"pid": 3548,
154+
"name": "netopeer",
155+
"status": "running",
156+
"description": "NETCONF server"
157+
},
158+
{
159+
"pid": 2249,
160+
"name": "dnsmasq",
161+
"status": "running",
162+
"description": "DHCP/DNS proxy"
163+
},
164+
{
165+
"pid": 3559,
166+
"name": "tty:hvc0",
167+
"status": "running",
168+
"description": "Getty on hvc0"
169+
},
170+
{
171+
"pid": 2340,
172+
"name": "iitod",
173+
"status": "running",
174+
"description": "LED daemon"
175+
},
176+
{
177+
"pid": 3560,
178+
"name": "klishd",
179+
"status": "running",
180+
"description": "CLI backend daemon"
181+
},
182+
{
183+
"pid": 3617,
184+
"name": "mdns-alias",
185+
"status": "running",
186+
"description": "mDNS alias advertiser "
187+
},
188+
{
189+
"pid": 0,
190+
"name": "mstpd",
191+
"status": "stopped",
192+
"description": "Spanning Tree daemon"
193+
},
194+
{
195+
"pid": 3564,
196+
"name": "rauc",
197+
"status": "running",
198+
"description": "Software update service"
199+
},
200+
{
201+
"pid": 0,
202+
"name": "resolvconf",
203+
"status": "done",
204+
"description": "Update DNS configuration"
205+
},
206+
{
207+
"pid": 3472,
208+
"name": "statd",
209+
"status": "running",
210+
"description": "Status daemon"
211+
},
212+
{
213+
"pid": 3653,
214+
"name": "staticd",
215+
"status": "running",
216+
"description": "Static routing daemon"
217+
},
218+
{
219+
"pid": 2241,
220+
"name": "syslogd",
221+
"status": "running",
222+
"description": "System log daemon"
223+
},
224+
{
225+
"pid": 2242,
226+
"name": "watchdogd",
227+
"status": "running",
228+
"description": "System watchdog daemon"
229+
},
230+
{
231+
"pid": 3587,
232+
"name": "zebra",
233+
"status": "running",
234+
"description": "Zebra routing daemon"
235+
},
236+
{
237+
"pid": 3616,
238+
"name": "mdns",
239+
"status": "running",
240+
"description": "Avahi mDNS-SD daemon"
241+
},
242+
{
243+
"pid": 3618,
244+
"name": "chronyd",
245+
"status": "running",
246+
"description": "Chrony NTP v3/v4 daemon"
247+
},
248+
{
249+
"pid": 3633,
250+
"name": "lldpd",
251+
"status": "running",
252+
"description": "LLDP daemon (IEEE 802.1ab)"
253+
},
254+
{
255+
"pid": 3635,
256+
"name": "nginx",
257+
"status": "running",
258+
"description": "Web server"
259+
},
260+
{
261+
"pid": 3636,
262+
"name": "rousette",
263+
"status": "running",
264+
"description": "RESTCONF server"
265+
},
266+
{
267+
"pid": 3641,
268+
"name": "sshd",
269+
"status": "running",
270+
"description": "OpenSSH daemon"
271+
}
272+
]
131273
}
132274
}
133275
}

0 commit comments

Comments
 (0)