diff --git a/.build b/.build index e360ecd1..60a78f0f 100644 --- a/.build +++ b/.build @@ -96,7 +96,7 @@ dist/merriweather-latin-ext-300-normal-K6L27CZ5.woff2 dist/merriweather-vietnamese-300-italic-EHHNZPUO.woff2 dist/merriweather-vietnamese-300-normal-U376L4Z4.woff2 dist/remixicon-NKANDIL5.woff2 -dist/search_data-4FC63431.js +dist/search_data-EE7CC24E.js dist/sidebar_items-E53B19A0.js expression_language.html gatherers.html diff --git a/Wanda.DataCase.html b/Wanda.DataCase.html index c9e8160b..9f1ee828 100644 --- a/Wanda.DataCase.html +++ b/Wanda.DataCase.html @@ -186,9 +186,9 @@
A helper that transforms changeset errors into a map of messages.
assert {:error, changeset} = Accounts.create_user(%{password: "short"})
-assert "password is too short" in errors_on(changeset).password
-assert %{password: ["password is too short"]} = errors_on(changeset)
+A helper that transforms changeset errors into a map of messages.
assert {:error, changeset} = Accounts.create_user(%{password: "short"})
+assert "password is too short" in errors_on(changeset).password
+assert %{password: ["password is too short"]} = errors_on(changeset)
Gatherers can be thought of as functions:
Facts Gathering process in a nutshell
fact = gatherer(argument)
Gatherers can be thought of as functions:
Facts Gathering process in a nutshell
fact = gatherer(argument)
Here's a collection of built-in gatherers, with information about how to use them.
Here's a collection of built-in gatherers, with information about how to use them.
Argument required: yes.
This gatherer allows access to certain webmethods that sapcontrol
implements. An argument is required to specify which webmethod should be called. The communication with sapcontrol
is created opening a unix socket connection using the file /tmp/.sapstream5xx13
. The Sapcontrol Web Service Interface documents the SOAP API interface, including all the possible values each of the fields could have, specifically helpful for enumerators like dispstatus
in GetProcessList
and state/category
in HACheckConfig
webmethod.
The return value is grouped by discovered SIDs, which include the list of command outputs for each instance in this system.
Supported webmethods:
GetProcessList
GetSystemInstanceList
GetVersionInfo
HACheckConfig
HAGetFailoverConfig
Example specification:
facts:
+ - name: processes
+ gatherer: sapcontrol
+ argument: GetProcessList
+
+ - name: instances
+ gatherer: sapcontrol
+ argument: GetSystemInstanceList
Example output (in Rhai):
// GetProcessList
+#{
+ "NWP": [
+ #{
+ "instance_nr": "10",
+ "name": "ERS10",
+ "output": [
+ #{
+ "description": "EnqueueReplicator",
+ "dispstatus": "SAPControl-GREEN",
+ "elapsedtime": "266:08:15",
+ "name": "enrepserver",
+ "pid": 7221,
+ "starttime": "2023 09 29 09:41:41",
+ "textstatus": "Running"
+ }
+ ]
+ }
+ ]
+}
+
+// GetSystemInstanceList
+#{
+ "NWP": [
+ #{
+ "instance_nr": "10",
+ "name": "ERS10",
+ "output": [
+ #{
+ "dispstatus": "SAPControl-GREEN",
+ "features": "MESSAGESERVER|ENQUE",
+ "hostname": "sapnwpas",
+ "http_port": 50013,
+ "https_port": 50014,
+ "instance_nr": 0,
+ "start_priority": "1"
+ },
+ #{
+ "dispstatus": "SAPControl-GREEN",
+ "features": "ENQREP",
+ "hostname": "sapnwper",
+ "http_port": 51013,
+ "https_port": 51014,
+ "instance_nr": 10,
+ "start_priority": "0.5"
+ },
+ ...
+ ]
+ }
+ ]
+}
+
+// GetVersionInfo
+#{
+ "NWP": [
+ #{
+ "instance_nr": "10",
+ "name": "ERS10",
+ "output": [
+ #{
+ "architecture": "linuxx86_64",
+ "build": "optU (Oct 16 2021, 00:03:15)",
+ "changelist": "2094654",
+ "filename": "/usr/sap/NWP/ERS10/exe/sapstartsrv",
+ "patch": "900",
+ "rks_compatibility_level": "1",
+ "sap_kernel": "753",
+ "time": "2021 10 15 22:14:31"
+ },
+ #{
+ "architecture": "linuxx86_64",
+ "build": "optU (Oct 16 2021, 00:03:15)",
+ "changelist": "2094654",
+ "filename": "/usr/sap/NWP/ERS10/exe/gwrd",
+ "patch": "900",
+ "rks_compatibility_level": "1",
+ "sap_kernel": "753",
+ "time": "2021 10 15 22:04:14"
+ },
+ ...
+ ]
+ }
+ ]
+}
+
+// HACheckConfig
+#{
+ "NWP": [
+ #{
+ "instance_nr": "10",
+ "name": "ERS10",
+ "output": [
+ #{
+ "category": "SAPControl-SAP-CONFIGURATION",
+ "comment": "2 ABAP instances detected",
+ "description": "Redundant ABAP instance configuration",
+ "state": "SAPControl-HA-SUCCESS"
+ },
+ #{
+ "category": "SAPControl-SAP-CONFIGURATION",
+ "comment": "0 Java instances detected",
+ "description": "Redundant Java instance configuration",
+ "state": "SAPControl-HA-SUCCESS"
+ },
+ ...
+ ]
+ }
+ ]
+}
+
+//HAGetFailoverConfig
+#{
+ "NWP": [
+ #{
+ "instance_nr": "10",
+ "name": "ERS10",
+ "output": #{
+ "ha_active": false,
+ "ha_active_nodes": "",
+ "ha_documentation": "",
+ "ha_nodes": [],
+ "ha_product_version": "",
+ "ha_sap_interface_version": ""
+ }
+ }
+ ]
+}
+
asdf allows using specific versions of programming language tools that are known to be compatible with the project, rather than relying on the version that's installed globally on the host system.
In order to use asdf, follow the official asdf getting started guide.
Install all required asdf plugins from .tool-versions inside the web repository.
cut -d' ' -f1 .tool-versions|xargs -i asdf plugin add {}
Set up the asdf environment
asdf install
asdf allows using specific versions of programming language tools that are known to be compatible with the project, rather than relying on the version that's installed globally on the host system.
In order to use asdf, follow the official asdf getting started guide.
Install all required asdf plugins from .tool-versions inside the web repository.
cut -d' ' -f1 .tool-versions|xargs -i asdf plugin add {}
Set up the asdf environment
asdf install
Often times knowing the returned value of the gathered facts is not a trivial thing, more during the implementation of new checks.
To better debug the fact gathering process and the returned values, the facts
subcommand of trento-agent
is a really useful tool. This command helps to see in the target itself what the gathered fact looks like. This is specially interesting when the returned value is a complex object or the target under test is modified and the check developer wants to see how this affects the gathered fact.
The command can be used as:
./trento-agent facts gather --gatherer corosync.conf --argument totem.token
# To see the currently available gatherers and their names
-# ./trento-agent facts list
Which would return the next where the Value
is the available value in the written check:
{
+# ./trento-agent facts list
Which would return the next where the Value
is the available value in the written check:
{
"Name": "totem.token",
"CheckID": "",
- "Value": {
+ "Value": {
"Value": 30000
- },
+ },
"Error": null
-}