// Module included in the following assemblies: // // * scalability_and_performance/node-observability-operator.adoc :_mod-docs-content-type: PROCEDURE [id="node-observability-scripting_{context}"] = Configuring Node Observability Operator scripting .Prerequisites * You have installed the Node Observability Operator. * You have created the `NodeObservability` custom resource (CR). * You have access to the cluster with `cluster-admin` privileges. .Procedure . Create a file named `nodeobservabilityrun-script.yaml` that contains the following content: + [source,yaml] ---- apiVersion: nodeobservability.olm.openshift.io/v1alpha2 kind: NodeObservabilityRun metadata: name: nodeobservabilityrun-script namespace: node-observability-operator spec: nodeObservabilityRef: name: cluster type: scripting ---- + [IMPORTANT] ==== You can request only the following scripts: * `metrics.sh` * `network-metrics.sh` (uses `monitor.sh`) ==== . Trigger the scripting by creating the `NodeObservabilityRun` resource with the following command: + [source,terminal] ---- $ oc apply -f nodeobservabilityrun-script.yaml ---- . Review the status of the `NodeObservabilityRun` scripting by running the following command: + [source,terminal] ---- $ oc get nodeobservabilityrun nodeobservabilityrun-script -o yaml | yq '.status.conditions' ---- + .Example output [source,terminal] ---- Status: Agents: Ip: 10.128.2.252 Name: node-observability-agent-n2fpm Port: 8443 Ip: 10.131.0.186 Name: node-observability-agent-wcc8p Port: 8443 Conditions: Conditions: Last Transition Time: 2023-12-19T15:10:51Z Message: Ready to start profiling Reason: Ready Status: True Type: Ready Last Transition Time: 2023-12-19T15:11:01Z Message: Profiling query done Reason: Finished Status: True Type: Finished Finished Timestamp: 2023-12-19T15:11:01Z Start Timestamp: 2023-12-19T15:10:51Z ---- + The scripting is complete once `Status` is `True` and `Type` is `Finished`. . Retrieve the scripting data from the root path of the container by running the following bash script: + [source,bash] ---- #!/bin/bash RUN=$(oc get nodeobservabilityrun --no-headers | awk '{print $1}') for a in $(oc get nodeobservabilityruns.nodeobservability.olm.openshift.io/${RUN} -o json | jq .status.agents[].name); do echo "agent ${a}" agent=$(echo ${a} | tr -d "\"\'\`") base_dir=$(oc exec "${agent}" -c node-observability-agent -- bash -c "ls -t | grep node-observability-agent" | head -1) echo "${base_dir}" mkdir -p "/tmp/${agent}" for p in $(oc exec "${agent}" -c node-observability-agent -- bash -c "ls ${base_dir}"); do f="/${base_dir}/${p}" echo "copying ${f} to /tmp/${agent}/${p}" oc exec "${agent}" -c node-observability-agent -- cat ${f} > "/tmp/${agent}/${p}" done done ----