From a777c31898da66540154f24f7338c3ea63a79164 Mon Sep 17 00:00:00 2001 From: Nelson Kopliku Date: Fri, 25 Aug 2023 16:03:25 +0200 Subject: [PATCH] Add initial host check --- priv/catalog/TRNT01.yaml | 29 +++++++++++++++++++++++++++++ priv/demo/fake_facts.yaml | 11 ++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 priv/catalog/TRNT01.yaml diff --git a/priv/catalog/TRNT01.yaml b/priv/catalog/TRNT01.yaml new file mode 100644 index 00000000..9eeb3053 --- /dev/null +++ b/priv/catalog/TRNT01.yaml @@ -0,0 +1,29 @@ +id: "TRNT01" +name: A host check +group: Trento +description: | + Trento agent service is enabled and running +remediation: | + ## Abstract + If not enabled, trento-agent service will not start automatically after reboots, affecting Trento's functionalities. + + To enable the service, run: + ``` + systemctl enable trento-agent + ``` + +when: env.target_type == "host" + +facts: + - name: trento_agent_service_state + gatherer: systemd + argument: trento-agent + +values: + - name: expected_trento_agent_service_state + default: active + +expectations: + - name: trento_agent_service_state_active + expect: facts.trento_agent_service_state == values.expected_trento_agent_service_state + failure_message: Trento agent service was expected to be active (enabled and running) but returned value is '${facts.trento_agent_service_state}' diff --git a/priv/demo/fake_facts.yaml b/priv/demo/fake_facts.yaml index 0f2dfc55..da55f695 100644 --- a/priv/demo/fake_facts.yaml +++ b/priv/demo/fake_facts.yaml @@ -439,4 +439,13 @@ facts: target3: -1 target4: 0 target5: -1 - target6: 0 \ No newline at end of file + target6: 0 + + "TRNT01": + trento_agent_service_state: + target1: active + target2: active + target3: active + target4: active + target5: active + target6: active