Hi,
we try to use Skyline on R81.10, following sk178566. Our version is
Product version Check Point Gaia R81.10
OS build 335
OS kernel version 3.10.0-957.21.3cpx86_64
OS edition 64-bit
Running '/opt/CPotelcol/REST.py --set_open_telemetry "$(cat payload.json)"' throws an
Exception: OpenTelemetry Components are not up yet
This seems to be due to the result from '/opt/CPviewExporter/CPviewExporterCli.sh show':
{
"active_after_reboot":"false",
"status":"Agents are down"
}
Looking into CPviewExporterCli.sh, we see that the "show" parameter branches into the function product_status_json.
I assume that this function should check each virtual systems (loop over $(vslist) ) and either return "Agents are down", "All agents are up" or "Agents are partially up". To that end, it sets state variables FOUND_ONE_NON_ACTIVE and FOUND_ACTIVE:
function product_status_json() {
for VS in $(vslist); do
STAT=$(${COMPONENT_DIR}/otlp_wd.bash -o stat ${VS})
FOUND_ONE_NON_ACTIVE=false
FOUND_ACTIVE=false
if [[ ${STAT} == "Agent is not running" ]]; then
FOUND_ONE_NON_ACTIVE=true
elif [[ ${STAT} == "Agent is running" ]]; then
FOUND_ACTIVE=true
fi
if ${FOUND_ONE_NON_ACTIVE} && ${FOUND_ACTIVE}; then
RC_EXPORTER="Agents are partially up"
elif ${FOUND_ONE_NON_ACTIVE}; then
RC_EXPORTER="Agents are down"
elif ${FOUND_ACTIVE}; then
RC_EXPORTER="All agents are up"
else
RC_EXPORTER="Unknown"
fi
done
echo "{"
if [[ $(is_product_active) -eq 1 ]]; then
echo -e "\t\"active_after_reboot\":\"true\","
else
echo -e "\t\"active_after_reboot\":\"false\","
fi
echo -e "\t\"status\":\"${RC_EXPORTER}\""
echo "}"
}
However, the state variables get set to default values inside the for loop (instead of before), and the evaluation logic setting RC_EXPORTER also runs inside the loop (instead of after). I wonder if this is really intended?
As a consequence, the final result only depends on the VS with the highest number, not on any of the other VSs; and "Agents are partially up" will never be a result.
At least, that is my interpretation... I might also have misunderstood this functions intent or working.
In our setup, the highest-numbered VS is a virtual switch for which the test in line 3 of product_status_json()
otlp_wd.bash -o stat ${VS})
returns "not running", so the above /opt/CPotelcol/REST.py will always fail.
After that lengthy prologue, I wonder:
- Is the above behaviour correct in CPviewExporterCli.sh?
- Can/should we activate the CpviewExporter agent in the virtual switches?
- If so, how?
- or is it safe to modify "CPviewExporterCli.sh show" to always return "All agents are up"?
Many thanks,
Bernhard