Hi,
I was trying to underestand custom telemetry configuration according to this documentation: Custom Metrics (checkpoint.com)
I have lab, using r81.20, jhf 84, skyline metrics working correctly...
In general, we are interested in routing metrics, so according to information, those metrics are not in skyline metric availible for now. I tried to create easy one by myself, just underestand how does it work, and do bigger stuff later.
Idea: checking routing table, print count Static, Connected, BGP routes and print IP of def gw.
I started with the simple bash skritp, follow checkpoint doc:
-------
#!/bin/bash
. /opt/CPotlAgent/cs_data_handler_is.bash
routing_info=$(clish -c "show route")
static_routes=$(echo "$routing_info" | grep -c "^S")
connected_routes=$(echo "$routing_info" | grep -c "^C")
bgp_routes=$(echo "$routing_info" | grep -c "^B" )
default_gateway=$(echo "$routing_info" | grep -e "^S.*0.0.0.0/0" -e "^C.*0.0.0.0/0" | awk '{print $4}')
set_ot_object new value "$static_routes"
set_ot_object last label route_type static
set_ot_object new value "$connected_routes"
set_ot_object last label route_type connected
set_ot_object new value "$bgp_routes"
set_ot_object last label route_type bgp
if [ -n "$default_gateway" ]; then
set_ot_object new value 1
set_ot_object last label metric_name default_gw
set_ot_object last label gateway_ip "$default_gateway"
else
set_ot_object- new value 0
set_ot_object last label metric_name default_gw
fi
verbose_print "Static routes: %d, Connected routes: %d, BGP routes: %d, Default GW:" "$static_routes" "$connected_routes" "$bgp_routes" "$default_gateway"
script_exit "Show route metrics are collected" 0
-------
output: if you comment ot values:
Static routes: 1
Connected routes: 3
BGP routes: 0
Default Gateway: 198.30.192.1,
------
So I am sure that bash is correct, and I follow next step:
"sklnctl otlp add –name /home/admin/script_with_custom_metrics.sh --path /home/admin/payload_with_custom_metrics.json"
1. probably typo in documentaion "-name" -> "--name"
2. probably typo in documentation ".sh" -> cli output: Error: Script name should not contain '.',
my correct scenario: "sklnctl otlp add --name /home/admin/show_route_metric_custom --path /home/admin/show_route_metric_custom_payload.json"
when I sucessfully run "sklnctl", I got message:
"Your script file will be moved and removed from its directory to /var/log/CPotlpAgent/backup/scripts/, Do you want to proceed before adding this script [y | n | yes | no]?"
I am not scared and hit yes, but surprisingly I am facing this error:
"Error: Couldn't open source file: open bash /home/admin/show_route_metric_custom.sh: no such file or directory"
and definitely I am in trap, because not sure what does it mean in this scenario, because:
cli: ls -al show_route_metric_custom.sh
output: -rwxrwxr-x 1 admin root 1537 Dec 19 00:09 show_route_metric_custom.sh
I boost permission, expecting that it not help, but never know:D
How I mention before, bash is wirtten corectly , facing issue with combination of the telemtry, some how, some way... Which I dont underestand
Have someone same issue with something similar? Or I should ignore it and hit "no" and continue with configuration? Or maybe I missed step? Did typo?
here is json playod:
{
"state": "enabled",
"command": "bash /home/admin/show_route_metric_custom.sh",
"desc": "Route info and default gw info",
"name": "network.routing.table.custom",
"type": "Gauge",
"unit": "routes",
"interval": 60,
"Secured": "true"
}
I add Secured, according to documentation if you work with sensitive info like IPs, it is necessary.
I would like to kindly ask if someone could give me hint, opinion.
Thank you
Adam