<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Custom Metrics - Failed to execute script - /bin/bashexceededtheCPUthreshold in OpenTelemetry/Skyline</title>
    <link>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/254569#M672</link>
    <description>&lt;P&gt;AI generated bash scripts?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;My brain &lt;span class="lia-unicode-emoji" title=":graduation_cap:"&gt;🎓&lt;/span&gt; generated this oneliner you might want to check out and modify for your own needs:&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/Scripts/Maestro-MHO-Ports-Dump-Sorted-amp-Colored/m-p/126663#M806" target="_blank" rel="noopener"&gt;Maestro MHO Ports Dump - Sorted &amp;amp; Colored&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;By looking at this part of your script:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    orch_stat -p | awk '
    BEGIN {FS="|"}
    /^\+/ { next }                              # Skip separator lines
    /^\|[ ]*Physical Port/ { next }             # Skip header line
    /^\|/ {
        if (NF != 14) next                      # Only process lines with 14 fields (12 data fields)
        row=""
        for(i=2; i&amp;lt;=13; i++) {                  # Extract fields 2 to 13 (data columns)
            f=$i
            gsub(/^[ \t]+|[ \t]+$/, "", f)      # Trim leading/trailing whitespace
            row = row f "\t"
        }
        sub(/\t$/, "", row)                     # Remove trailing tab
        print row
    }
    '&lt;/LI-CODE&gt;
&lt;P&gt;I instantly had to shrink and optimize it into this oneliner:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;orch_stat -p|awk '/\// {gsub(/\s*\|\s*/, "\t"); sub(/^\t|\t$/, ""); print}'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;As you'll see, it runs slightly faster.&lt;BR /&gt;&lt;BR /&gt;It's generally a good practice to avoid &lt;SPAN&gt;unnecessary&amp;nbsp;&lt;/SPAN&gt;subshells, therefore I suggest to continue with &lt;CODE&gt;|while read line; do&lt;/CODE&gt;, just as Sven&amp;nbsp;did &lt;A href="https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metric-Behaves-different-CLI-vs-sklnctl-Fixed-Logging/m-p/248763/highlight/true#M608" target="_self"&gt;here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Aug 2025 11:04:31 GMT</pubDate>
    <dc:creator>Danny</dc:creator>
    <dc:date>2025-08-14T11:04:31Z</dc:date>
    <item>
      <title>Custom Metrics - Failed to execute script - /bin/bashexceededtheCPUthreshold</title>
      <link>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/251290#M644</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I created a script (or AI did it) to get the information from "orch_stat -p" of my MHO 140.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the script:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;#!/bin/bash

# =========================
# RX Metrics Script for MHO
# =========================

# Load Maestro environment profiles (required for Maestro scripts)
source /opt/CPshrd-R81.20/tmp/.CPprofile.sh
. /opt/CPotlpAgent/cs_data_handler_is.bash

# Check if this is an MHO system; exit if not
if [[ ! -f /etc/.scalable_platform_mho ]]; then
    script_exit "system is no MHO" 0
fi

# Use process substitution to avoid subshells
while IFS= read -r line; do
    # Read the 12 tab-separated fields into named variables
    IFS=$'\t' read -r Physical_Port Interface_Name Type SG QSFP_Mode Admin_State Link_State Transceiver_State Operating_Speed MTU RX_Frames TX_Frames &amp;lt;&amp;lt;&amp;lt; "$line"

    # Skip lines with missing critical fields (should not happen, but for safety)
    if [[ -z "$Physical_Port" || -z "$RX_Frames" ]]; then
        continue
    fi

    # Set RX_Frames as the metric value
    set_ot_object new value "${RX_Frames}"

    # Set all other columns as labels (explicitly, order is guaranteed)
    set_ot_object last label "Physical_Port"      "${Physical_Port}"
    set_ot_object last label "Interface_Name"     "${Interface_Name}"
    set_ot_object last label "Type"               "${Type}"
    set_ot_object last label "SG"                 "${SG}"
    set_ot_object last label "QSFP_Mode"          "${QSFP_Mode}"
    set_ot_object last label "Admin_State"        "${Admin_State}"
    set_ot_object last label "Link_State"         "${Link_State}"
    set_ot_object last label "Transceiver_State"  "${Transceiver_State}"
    set_ot_object last label "Operating_Speed"    "${Operating_Speed}"
    set_ot_object last label "MTU"                "${MTU}"
done &amp;lt; &amp;lt;(
    orch_stat -p | awk '
    BEGIN {FS="|"}
    /^\+/ { next }                              # Skip separator lines
    /^\|[ ]*Physical Port/ { next }             # Skip header line
    /^\|/ {
        if (NF != 14) next                      # Only process lines with 14 fields (12 data fields)
        row=""
        for(i=2; i&amp;lt;=13; i++) {                  # Extract fields 2 to 13 (data columns)
            f=$i
            gsub(/^[ \t]+|[ \t]+$/, "", f)      # Trim leading/trailing whitespace
            row = row f "\t"
        }
        sub(/\t$/, "", row)                     # Remove trailing tab
        print row
    }
    '
)

# Exit successfully
script_exit "Finished running" 0&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Running it manually in the shell is working. it takes approximately 10 seconds to finish. This is long time - however I am testing and maybe it can be improved - maybe not.&lt;/P&gt;
&lt;P&gt;However if I add it to the "sklnctl otlp add" and it is running after service restart (it should run evry 60s) I get this error:&lt;BR /&gt;&lt;BR /&gt;[Expert@yyyy-mho1_01:0]# tail -n 1 /opt/CPotlpAgent/otlp_agent.log&lt;BR /&gt;ts=2025-06-16T00:07:43.461+02:00 caller=level.go:63 ts=2025-06-16T00:07:43.461+02:00 caller=level.go:63 level=info msg="Collector: /config/skyline_custom_metrics/skyline_custom_orch_stat_p_rxhas disabled due to: " Script:/var/log/CPotlpAgent/backup/scripts/skyline_custom_orch_stat_p_rx.shchangethestatetodisableddueto:TheCommand:/bin/bashexceededtheCPUthreshold=(MISSING)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Looks like a CPU limit in place. where to check? how to adjust? how to disable? Alternatives?&lt;/P&gt;</description>
      <pubDate>Sun, 15 Jun 2025 22:22:19 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/251290#M644</guid>
      <dc:creator>Alexander_Wilke</dc:creator>
      <dc:date>2025-06-15T22:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Metrics - Failed to execute script - /bin/bashexceededtheCPUthreshold</title>
      <link>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/254569#M672</link>
      <description>&lt;P&gt;AI generated bash scripts?&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;My brain &lt;span class="lia-unicode-emoji" title=":graduation_cap:"&gt;🎓&lt;/span&gt; generated this oneliner you might want to check out and modify for your own needs:&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/Scripts/Maestro-MHO-Ports-Dump-Sorted-amp-Colored/m-p/126663#M806" target="_blank" rel="noopener"&gt;Maestro MHO Ports Dump - Sorted &amp;amp; Colored&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;By looking at this part of your script:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;    orch_stat -p | awk '
    BEGIN {FS="|"}
    /^\+/ { next }                              # Skip separator lines
    /^\|[ ]*Physical Port/ { next }             # Skip header line
    /^\|/ {
        if (NF != 14) next                      # Only process lines with 14 fields (12 data fields)
        row=""
        for(i=2; i&amp;lt;=13; i++) {                  # Extract fields 2 to 13 (data columns)
            f=$i
            gsub(/^[ \t]+|[ \t]+$/, "", f)      # Trim leading/trailing whitespace
            row = row f "\t"
        }
        sub(/\t$/, "", row)                     # Remove trailing tab
        print row
    }
    '&lt;/LI-CODE&gt;
&lt;P&gt;I instantly had to shrink and optimize it into this oneliner:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;orch_stat -p|awk '/\// {gsub(/\s*\|\s*/, "\t"); sub(/^\t|\t$/, ""); print}'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;As you'll see, it runs slightly faster.&lt;BR /&gt;&lt;BR /&gt;It's generally a good practice to avoid &lt;SPAN&gt;unnecessary&amp;nbsp;&lt;/SPAN&gt;subshells, therefore I suggest to continue with &lt;CODE&gt;|while read line; do&lt;/CODE&gt;, just as Sven&amp;nbsp;did &lt;A href="https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metric-Behaves-different-CLI-vs-sklnctl-Fixed-Logging/m-p/248763/highlight/true#M608" target="_self"&gt;here&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 11:04:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/254569#M672</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2025-08-14T11:04:31Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Metrics - Failed to execute script - /bin/bashexceededtheCPUthreshold</title>
      <link>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/254675#M673</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/687"&gt;@Danny&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you are on the wrong road. This is the skyline sub forum. The idea is to create open telemetry / prometheus metrics based ond this output what "orch_stat -p" provides. I do not talk about running this command manually on the MHO. I want a 24/7/365 monitoring of these stats via OpenTelemetry Agent.&lt;/P&gt;
&lt;P&gt;And for that reason I need to parse every single line, add every column as a label value and the rx/tx as the metric value. this will generate one metric for RX and one for TX with the column headers as label names and the label values per port/each line. This is how metrics work and should look like.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your comments about unnecessary subshells etc - I am not familar with that so I used the AI but following this comment your suggestions to not use&amp;nbsp;&lt;SPAN&gt;&amp;lt; &amp;lt;(...) is maybe wrong.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metric-Behaves-different-CLI-vs-sklnctl-Fixed-Logging/m-p/248992/highlight/true#M613" target="_blank"&gt;https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metric-Behaves-different-CLI-vs-sklnctl-Fixed-Logging/m-p/248992/highlight/true#M613&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;So I do not see what your oneliner could help here. Hopefukly I miss some important thing or you miss the point which skyline custom metrics and not colored shell scripts.&lt;/P&gt;
&lt;P&gt;However, maybe you may provide an efficient skyline custom metrics script which is faster than the one I provided with the same amount of information. This would be valuable for this thread. Otherwise not.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Aug 2025 20:20:05 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/254675#M673</guid>
      <dc:creator>Alexander_Wilke</dc:creator>
      <dc:date>2025-08-06T20:20:05Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Metrics - Failed to execute script - /bin/bashexceededtheCPUthreshold</title>
      <link>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/255151#M674</link>
      <description>&lt;P&gt;Regarding the updated &lt;A href="https://sc1.checkpoint.com/documents/Appliances/Skyline/CP_Skyline_AdminGuide.pdf" target="_self"&gt;Skyline Admin Guide&lt;/A&gt;&amp;nbsp;Check Point R82 supports built-in metrics for Maestro Orchestrator, so you don't need to work on your own custom metrics anymore. Just upgrade to &lt;A href="https://support.checkpoint.com/results/sk/sk95746" target="_self"&gt;R82, as it's widely recommended for all deployments&lt;/A&gt;. Also there is a new OpenTelemetry Collector build #192&amp;nbsp;available l&lt;A href="https://support.checkpoint.com/results/sk/sk180522" target="_self"&gt;sk180522&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 11:33:31 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/255151#M674</guid>
      <dc:creator>Danny</dc:creator>
      <dc:date>2025-08-14T11:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Metrics - Failed to execute script - /bin/bashexceededtheCPUthreshold</title>
      <link>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/255159#M675</link>
      <description>&lt;P&gt;I love the new metrics for orchestrators.&lt;BR /&gt;It would be nice from Check Point if you could provide some sample dashboards for the new metrics.&lt;BR /&gt;&lt;A href="https://support.checkpoint.com/results/sk/sk178566" target="_self"&gt;SK178566&lt;/A&gt; provides some nice samples, but those are still working with R81.10 metrics.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.checkpoint.com/t5/user/viewprofilepage/user-id/5970"&gt;@Elad_Chomsky&lt;/a&gt;&amp;nbsp;would it be possible to take this inside CP? A seperate orchestrator dashboard would be nice.&lt;BR /&gt;&lt;BR /&gt;Thanks in advace!&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;Sven&lt;/P&gt;</description>
      <pubDate>Thu, 14 Aug 2025 13:05:13 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/OpenTelemetry-Skyline/Custom-Metrics-Failed-to-execute-script-bin/m-p/255159#M675</guid>
      <dc:creator>Sven_Glock</dc:creator>
      <dc:date>2025-08-14T13:05:13Z</dc:date>
    </item>
  </channel>
</rss>

