From d28b1cac3f218c9acd6a0c57f0a3e40b158c5017 Mon Sep 17 00:00:00 2001 From: bnerickson Date: Sun, 30 Oct 2022 12:18:02 -0700 Subject: [PATCH] Adding systemd application (#14540) --- doc/Extensions/Applications.md | 35 + .../graphs/application/systemd-common.inc.php | 35 + .../graphs/application/systemd_active.inc.php | 10 + .../graphs/application/systemd_load.inc.php | 10 + .../graphs/application/systemd_sub.inc.php | 21 + includes/html/pages/apps.inc.php | 5 + .../html/pages/device/apps/systemd.inc.php | 108 +++ includes/polling/applications/systemd.inc.php | 119 +++ includes/systemd-shared.inc.php | 157 ++++ tests/data/linux_systemd-v1.json | 731 ++++++++++++++++++ tests/snmpsim/linux_systemd-v1.snmprec | 10 + 11 files changed, 1241 insertions(+) create mode 100644 includes/html/graphs/application/systemd-common.inc.php create mode 100644 includes/html/graphs/application/systemd_active.inc.php create mode 100644 includes/html/graphs/application/systemd_load.inc.php create mode 100644 includes/html/graphs/application/systemd_sub.inc.php create mode 100644 includes/html/pages/device/apps/systemd.inc.php create mode 100644 includes/polling/applications/systemd.inc.php create mode 100644 includes/systemd-shared.inc.php create mode 100644 tests/data/linux_systemd-v1.json create mode 100644 tests/snmpsim/linux_systemd-v1.snmprec diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index ec48ac2262..56f702dec2 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -2457,6 +2457,41 @@ setup. If the default does not work, check the docs for it at [MetaCPAN for suricata_stat_check](https://metacpan.org/dist/Suricata-Monitoring/view/bin/suricata_stat_check) + +## Systemd + +The systemd application polls systemd and scrapes systemd units' load, activation, and sub states. + +### SNMP Extend + +1. Copy the python script, systemd.py, to the desired host +``` +wget https://github.com/librenms/librenms-agent/raw/master/snmp/systemd.py -O /etc/snmp/systemd.py +``` + +2. Make the script executable +``` +chmod +x /etc/snmp/systemd.py +``` + +3. Edit your snmpd.conf file and add: +``` +extend systemd /etc/snmp/systemd.py +``` + +4. (Optional) Create a /etc/snmp/systemd.json file and specify: + a.) "systemctl_cmd" - String path to the systemctl binary [Default: "/usr/bin/systemctl"] + b.) "include_inactive_units" - True/False string to include inactive units in results [Default: "False"] +``` +{ + "systemctl_cmd": "/bin/systemctl", + "include_inactive_units": "True" +} +``` + +5. Restart snmpd. + + ## TinyDNS aka djbdns ### Agent diff --git a/includes/html/graphs/application/systemd-common.inc.php b/includes/html/graphs/application/systemd-common.inc.php new file mode 100644 index 0000000000..3880d425cf --- /dev/null +++ b/includes/html/graphs/application/systemd-common.inc.php @@ -0,0 +1,35 @@ +app_id, + $state_type, + ]); + + if (Rrd::checkRrdExists($rrd_filename)) { + $i = 0; + foreach ($rrdArray[$state_type] as $state_status => $state_status_desc) { + $rrd_list[$i]['filename'] = $rrd_filename; + $rrd_list[$i]['descr'] = $state_status_desc['descr']; + $rrd_list[$i]['ds'] = $state_status; + $i++; + } + } else { + d_echo('RRD ' . $rrd_filename . ' not found'); + } +} + +require 'includes/html/graphs/generic_multi_line_exact_numbers.inc.php'; diff --git a/includes/html/graphs/application/systemd_active.inc.php b/includes/html/graphs/application/systemd_active.inc.php new file mode 100644 index 0000000000..0bbf242aca --- /dev/null +++ b/includes/html/graphs/application/systemd_active.inc.php @@ -0,0 +1,10 @@ + $state_status]; +} + +require 'systemd-common.inc.php'; diff --git a/includes/html/graphs/application/systemd_load.inc.php b/includes/html/graphs/application/systemd_load.inc.php new file mode 100644 index 0000000000..3628880a30 --- /dev/null +++ b/includes/html/graphs/application/systemd_load.inc.php @@ -0,0 +1,10 @@ + $state_status]; +} + +require 'systemd-common.inc.php'; diff --git a/includes/html/graphs/application/systemd_sub.inc.php b/includes/html/graphs/application/systemd_sub.inc.php new file mode 100644 index 0000000000..000716942a --- /dev/null +++ b/includes/html/graphs/application/systemd_sub.inc.php @@ -0,0 +1,21 @@ + $sub_state_status, + ]; +} + +require 'systemd-common.inc.php'; diff --git a/includes/html/pages/apps.inc.php b/includes/html/pages/apps.inc.php index 038fc053b8..0aa33a8efb 100644 --- a/includes/html/pages/apps.inc.php +++ b/includes/html/pages/apps.inc.php @@ -423,6 +423,11 @@ $graphs['pwrstatd'] = [ 'percentage', 'minutes', ]; +$graphs['systemd'] = [ + 'sub', + 'active', + 'load', +]; echo '
'; echo '
'; diff --git a/includes/html/pages/device/apps/systemd.inc.php b/includes/html/pages/device/apps/systemd.inc.php new file mode 100644 index 0000000000..2294781c6c --- /dev/null +++ b/includes/html/pages/device/apps/systemd.inc.php @@ -0,0 +1,108 @@ + $sub_state_statuses) { + $graph_descr = ucfirst($state_type) . ' ' . ucfirst($sub_state_type) . ' State'; + $graphs[$graph_name]['sub_states'][$sub_state_type]['desc'] = $graph_descr; + } + } + + return $graphs; +} + +/** + * Builds a graph array and outputs the graph. + * + * @param string $state_type + * @param string $app_id + * @param null|string $sub_state_type + * @param string $graph_desc + */ +function systemd_graph_printer($state_type, $app_id, $sub_state_type, $graph_desc) +{ + $graph_type = $state_type; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = time(); + $graph_array['id'] = $app_id; + $graph_array['type'] = 'application_' . $state_type; + if (! is_null($sub_state_type)) { + $graph_array['sub_state_type'] = $sub_state_type; + } + echo '
+
+

' . + $graph_desc . + '

+
+
+
'; + include 'includes/html/print-graphrow.inc.php'; + echo '
'; + echo '
'; + echo '
'; +} + +$link_array = [ + 'page' => 'device', + 'device' => $device['device_id'], + 'tab' => 'apps', + 'app' => 'systemd', +]; + +print_optionbar_start(); + +echo generate_link('All Unit States', $link_array) . ' | '; + +$i = 0; +foreach ($systemd_mapper as $state_type => $state_statuses) { + echo generate_link(ucfirst($state_type) . ' State', $link_array, ['section' => $state_type]); + if ($i < count($systemd_mapper) - 1) { + echo ', '; + } + $i++; +} + +print_optionbar_end(); + +$graphs = []; + +// Build graphs variable +if (isset($vars['section'])) { + // Build graphs for the individual state sections (load, active, or sub). + $graphs = systemd_graph_builder($vars['section'], $systemd_mapper, $state_type_ternary_depth, $graphs); +} else { + // Build graphs for the combined states section (load, active, and sub). + foreach ($systemd_mapper as $state_type => $state_status) { + $graphs = systemd_graph_builder($state_type, $systemd_mapper, $state_type_ternary_depth, $graphs); + } +} + +// Display the built graphs +foreach ($graphs as $state_type => $values) { + if (in_array($values['type'], $state_type_ternary_depth)) { + foreach ($values['sub_states'] as $sub_state_type => $text) { + systemd_graph_printer($state_type, $app['app_id'], $sub_state_type, $text['desc']); + } + } else { + systemd_graph_printer($state_type, $app['app_id'], null, $values['desc']); + } +} diff --git a/includes/polling/applications/systemd.inc.php b/includes/polling/applications/systemd.inc.php new file mode 100644 index 0000000000..3f148f6975 --- /dev/null +++ b/includes/polling/applications/systemd.inc.php @@ -0,0 +1,119 @@ + $name, + 'app_id' => $app_id, + 'type' => $state_type, + 'rrd_def' => $rrd_def, + 'rrd_name' => $rrd_name, + ]; + data_update($device, $polling_type, $tags, $fields); + + return $metrics; +} + +// Grab systemd json data. +try { + $systemd_data = json_app_get($device, $name, 1)['data']; +} catch (JsonAppMissingKeysException $e) { + $systemd_data = $e->getParsedJson(); +} catch (JsonAppException $e) { + echo PHP_EOL . $name . ':' . $e->getCode() . ':' . $e->getMessage() . PHP_EOL; + update_application($app, $e->getCode() . ':' . $e->getMessage(), $metrics); + + return; +} + +// Use the mapping variable in systemd-shared.inc.php to parse +// the json data received from the systemd.py script. +foreach ($systemd_mapper as $state_type => $state_statuses) { + if (! in_array($state_type, $state_type_ternary_depth)) { + // Process systemd states that do not have three + // levels of depth (load and active) + + $rrd_def = RrdDefinition::make(); + $fields = []; + + // Iterate through unit state type's statuses. + foreach ($systemd_mapper[$state_type] as $state_status) { + $field_name = $state_status; + $field_value = $systemd_data[$state_type][$state_status] ?? null; + + // Verify data passed by application script is valid. + // Update fields and rrd definition. + if (is_int($field_value) || is_null($field_value)) { + $fields[$field_name] = $field_value; + } else { + $log_message = 'Systemd Polling Warning: Invalid data returned by application for systemd unit ' . + $state_type . ' state with' . $state_status . ' state status: ' . $field_value; + log_event($log_message, $device, 'application'); + continue; + } + $rrd_def->addDataset($field_name, 'GAUGE', 0); + } + $metrics = data_update_helper($app->app_id, $fields, $metrics, $name, $polling_type, $rrd_def, $state_type); + } else { + // Process systemd states that have three + // levels of depth (sub) + + // Iterate through unit sub state types. + foreach ($systemd_mapper[$state_type] as $sub_state_type => $sub_state_statuses) { + $rrd_def = RrdDefinition::make(); + $fields = []; + + // Iterate through unit sub state type's statuses. + foreach ($sub_state_statuses as $sub_state_status) { + $field_name = $sub_state_status; + $field_value = $systemd_data[$state_type][$sub_state_type][$sub_state_status] ?? null; + + // Verify data passed by application script is valid. + // Update fields and rrd definition. + if (is_int($field_value) || is_null($field_value)) { + $fields[$field_name] = $field_value; + } else { + $log_message = 'Systemd Polling Warning: Invalid data returned by application for systemd unit ' . + $state_type . ' state with ' . $sub_state_type . ' sub state type with ' . $sub_state_status . + ' sub state status: ' . $field_value; + log_event($log_message, $device, 'application'); + continue; + } + $rrd_def->addDataset($field_name, 'GAUGE', 0); + } + $flat_type = $state_type . '_' . $sub_state_type; + $metrics = data_update_helper($app->app_id, $fields, $metrics, $name, $polling_type, $rrd_def, $flat_type); + } + } +} + +update_application($app, $output, $metrics); diff --git a/includes/systemd-shared.inc.php b/includes/systemd-shared.inc.php new file mode 100644 index 0000000000..cb4d6f350d --- /dev/null +++ b/includes/systemd-shared.inc.php @@ -0,0 +1,157 @@ + [ + 'stub', + 'loaded', + 'not-found', + 'bad-setting', + 'error', + 'merged', + 'masked', + 'total', + ], + 'active' => [ + 'active', + 'reloading', + 'inactive', + 'failed', + 'activating', + 'deactivating', + 'maintenance', + 'total', + ], + 'sub' => [ + 'automount' => [ + 'dead', + 'waiting', + 'running', + 'failed', + 'total', + ], + 'device' => [ + 'dead', + 'tentative', + 'plugged', + 'total', + ], + 'freezer' => [ + 'running', + 'freezing', + 'frozen', + 'thawing', + 'total', + ], + 'mount' => [ + 'dead', + 'mounting', + 'mounting-done', + 'mounted', + 'remounting', + 'unmounting', + 'remounting-sigterm', + 'remounting-sigkill', + 'unmounting-sigterm', + 'unmounting-sigkill', + 'failed', + 'cleaning', + 'total', + ], + 'path' => [ + 'dead', + 'waiting', + 'running', + 'failed', + 'total', + ], + 'scope' => [ + 'dead', + 'start-chown', + 'running', + 'abandoned', + 'stop-sigterm', + 'stop-sigkill', + 'failed', + 'total', + ], + 'service' => [ + 'dead', + 'condition', + 'start-pre', + 'start', + 'start-post', + 'running', + 'exited', + 'reload', + 'stop', + 'stop-watchdog', + 'stop-sigterm', + 'stop-sigkill', + 'stop-post', + 'final-watchdog', + 'final-sigterm', + 'final-sigkill', + 'failed', + 'auto-restart', + 'cleaning', + 'total', + ], + 'slice' => [ + 'dead', + 'active', + 'total', + ], + 'socket' => [ + 'dead', + 'start-pre', + 'start-chown', + 'start-post', + 'listening', + 'running', + 'stop-pre', + 'stop-pre-sigterm', + 'stop-pre-sigkill', + 'stop-post', + 'final-sigterm', + 'final-sigkill', + 'failed', + 'cleaning', + 'total', + ], + 'swap' => [ + 'dead', + 'activating', + 'activating-done', + 'active', + 'deactivating', + 'deactivating-sigterm', + 'deactivating-sigkill', + 'failed', + 'cleaning', + 'total', + ], + 'target' => [ + 'dead', + 'active', + 'total', + ], + 'timer' => [ + 'dead', + 'waiting', + 'running', + 'elapsed', + 'failed', + 'total', + ], + ], +]; diff --git a/tests/data/linux_systemd-v1.json b/tests/data/linux_systemd-v1.json new file mode 100644 index 0000000000..80b77405f6 --- /dev/null +++ b/tests/data/linux_systemd-v1.json @@ -0,0 +1,731 @@ +{ + "os": { + "discovery": { + "devices": [ + { + "sysName": "", + "sysObjectID": ".1.3.6.1.4.1.8072.3.2.10", + "sysDescr": "Linux enemess 4.18.0-408.el8.x86_64 #1 SMP Mon Jul 18 17:42:52 UTC 2022 x86_64", + "sysContact": "", + "version": "4.18.0-408.el8.x86_64", + "hardware": "Generic x86 64-bit", + "features": null, + "location": "", + "os": "linux", + "type": "server", + "serial": null, + "icon": "linux.svg" + } + ] + }, + "poller": "matches discovery" + }, + "applications": { + "discovery": { + "applications": [ + { + "app_type": "systemd", + "app_state": "UNKNOWN", + "discovered": 1, + "app_state_prev": null, + "app_status": "", + "app_instance": "", + "data": null + } + ] + }, + "poller": { + "applications": [ + { + "app_type": "systemd", + "app_state": "OK", + "discovered": 1, + "app_state_prev": "UNKNOWN", + "app_status": "", + "app_instance": "", + "data": null + } + ], + "application_metrics": [ + { + "metric": "active_activating", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_active", + "value": 148, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_deactivating", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_inactive", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_maintenance", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_reloading", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "active_total", + "value": 148, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_bad-setting", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_error", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_loaded", + "value": 148, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_masked", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_merged", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_not-found", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_stub", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "load_total", + "value": 148, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_automount_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_automount_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_automount_running", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_automount_total", + "value": 1, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_automount_waiting", + "value": 1, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_device_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_device_plugged", + "value": 22, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_device_tentative", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_device_total", + "value": 22, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_freezer_freezing", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_freezer_frozen", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_freezer_running", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_freezer_thawing", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_freezer_total", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_cleaning", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_mounted", + "value": 12, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_mounting", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_mounting-done", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_remounting", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_remounting-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_remounting-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_total", + "value": 12, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_unmounting", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_unmounting-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_mount_unmounting-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_path_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_path_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_path_running", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_path_total", + "value": 2, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_path_waiting", + "value": 2, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_abandoned", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_running", + "value": 3, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_start-chown", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_stop-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_stop-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_scope_total", + "value": 3, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_auto-restart", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_cleaning", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_condition", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_exited", + "value": 24, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_final-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_final-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_final-watchdog", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_reload", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_running", + "value": 36, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_start", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_start-post", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_start-pre", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_stop", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_stop-post", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_stop-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_stop-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_stop-watchdog", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_service_total", + "value": 60, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_slice_active", + "value": 9, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_slice_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_slice_total", + "value": 9, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_cleaning", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_final-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_final-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_listening", + "value": 5, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_running", + "value": 6, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_start-chown", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_start-post", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_start-pre", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_stop-post", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_stop-pre", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_stop-pre-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_stop-pre-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_socket_total", + "value": 11, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_activating", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_activating-done", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_active", + "value": 1, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_cleaning", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_deactivating", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_deactivating-sigkill", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_deactivating-sigterm", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_swap_total", + "value": 1, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_target_active", + "value": 23, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_target_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_target_total", + "value": 23, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_timer_dead", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_timer_elapsed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_timer_failed", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_timer_running", + "value": 0, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_timer_total", + "value": 4, + "value_prev": null, + "app_type": "systemd" + }, + { + "metric": "sub_timer_waiting", + "value": 4, + "value_prev": null, + "app_type": "systemd" + } + ] + } + } +} diff --git a/tests/snmpsim/linux_systemd-v1.snmprec b/tests/snmpsim/linux_systemd-v1.snmprec new file mode 100644 index 0000000000..7a303c66d2 --- /dev/null +++ b/tests/snmpsim/linux_systemd-v1.snmprec @@ -0,0 +1,10 @@ +1.3.6.1.2.1.1.1.0|4|Linux enemess 4.18.0-408.el8.x86_64 #1 SMP Mon Jul 18 17:42:52 UTC 2022 x86_64 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 +1.3.6.1.2.1.1.3.0|67|77550514 +1.3.6.1.2.1.1.4.0|4| +1.3.6.1.2.1.1.5.0|4| +1.3.6.1.2.1.1.6.0|4| +1.3.6.1.2.1.25.1.1.0|67|77552962 +1.3.6.1.4.1.8072.1.3.2.2.1.21.6.100.105.115.116.114.111|2|1 +1.3.6.1.4.1.8072.1.3.2.2.1.21.7.115.121.115.116.101.109.100|2|1 +1.3.6.1.4.1.8072.1.3.2.3.1.2.7.115.121.115.116.101.109.100|4x|7b226572726f72537472696e67223a2022222c20226572726f72223a20302c202276657273696f6e223a20312c202264617461223a207b226c6f6164223a207b226c6f61646564223a203134382c2022746f74616c223a203134387d2c2022616374697665223a207b22616374697665223a203134382c2022746f74616c223a203134387d2c2022737562223a207b226175746f6d6f756e74223a207b2277616974696e67223a20312c2022746f74616c223a20317d2c2022646576696365223a207b22706c7567676564223a2032322c2022746f74616c223a2032327d2c20226d6f756e74223a207b226d6f756e746564223a2031322c2022746f74616c223a2031327d2c202270617468223a207b2277616974696e67223a20322c2022746f74616c223a20327d2c202273636f7065223a207b2272756e6e696e67223a20332c2022746f74616c223a20337d2c202273657276696365223a207b2272756e6e696e67223a2033362c2022746f74616c223a2036302c2022657869746564223a2032347d2c2022736c696365223a207b22616374697665223a20392c2022746f74616c223a20397d2c2022736f636b6574223a207b2272756e6e696e67223a20362c2022746f74616c223a2031312c20226c697374656e696e67223a20357d2c202273776170223a207b22616374697665223a20312c2022746f74616c223a20317d2c2022746172676574223a207b22616374697665223a2032332c2022746f74616c223a2032337d2c202274696d6572223a207b2277616974696e67223a20342c2022746f74616c223a20347d7d7d7d0a