<?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 ONELINER: cpview 2  prometheus in Scripts</title>
    <link>https://community.checkpoint.com/t5/Scripts/ONELINER-cpview-2-prometheus/m-p/270025#M1457</link>
    <description>&lt;P&gt;Hi CheckMates,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;This one-liner script converts the output of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;cpview -m&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(monitoring metrics) into standardized Prometheus format.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Use Case:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;When integrating Skyline with SIEM systems like Prometheus, troubleshooting may require comparing the data that Skyline receives from cpview with what's actually queryable in Prometheus using PromQL. This script transforms the cpview JSON output into Prometheus metrics with labels and values.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How it works:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Reads cpview monitoring data in JSON format&lt;/LI&gt;
&lt;LI&gt;Converts metric IDs to Prometheus-compatible names (dots to underscores)&lt;/LI&gt;
&lt;LI&gt;Extracts labels and formats them as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;metric_name{label1="value1",label2="value2"} value&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Filters out empty datasets&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Usage:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV class="code" data-code="id#24"&gt;
&lt;DIV class="interactive-result-code-block no-vulns" data-keybinding-context="43"&gt;
&lt;DIV class="interactive-result-editor" data-keybinding-context="44" data-mode-id="shellscript"&gt;
&lt;DIV class="monaco-editor no-user-select  showUnused showDeprecated vs-dark" role="code" data-uri="vscode-chat-code-block://dnnjb2rllwnoyxqtc2vzc2lvbjovl2xvy2fsl09uttnaakzpwwpjde5etmlnatawwkdznexuzznovfv0wtjvmll6smhar0k1wlrbdw/response_00d9ca7e-2989-421e-a324-576508f42342/0#%7B%22references%22%3A%5B%5D%7D"&gt;
&lt;DIV class="overflow-guard" data-mprt="3"&gt;
&lt;DIV class="margin" role="presentation" aria-hidden="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;LI-CODE lang="markup"&gt;cpview -m | jq -r '.metrics[] | .["metric-id"] as $metric | ($metric | split(".") | join("_")) as $metric_name | if (.data | length) &amp;gt; 0 then .data[] | (to_entries | map(select(.key != "value")) | map("\(.key)=\"\(.value)\"") | join(",")) as $labels | if $labels != "" then "\($metric_name){\($labels)} \(.value)" else "\($metric_name) \(.value)" end else empty end'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Examples:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;cpview -m | jq -r '.metrics[] | .["metric-id"] as $metric | ($metric | split(".") | join("_")) as $metric_name | if (.data | length) &amp;gt; 0 then .data[] | (to_entries | map(select(.key != "value")) | map("\(.key)=\"\(.value)\"") | join(",")) as $labels | if $labels != "" then "\($metric_name){\($labels)} \(.value)" else "\($metric_name) \(.value)" end else empty end' | grep system_cpu_count
system_cpu_count 42
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; cpview -m | jq -r '.metrics[] | .["metric-id"] as $metric | ($metric | split(".") | join("_")) as $metric_name | if (.data | length) &amp;gt; 0 then .data[] | (to_entries | map(select(.key != "value")) | map("\(.key)=\"\(.value)\"") | join(",")) as $labels | if $labels != "" then "\($metric_name){\($labels)} \(.value)" else "\($metric_name) \(.value)" end else empty end' | grep system_cpu_utilization
system_cpu_utilization{cpu="0",state="idle",type="OTHER"} 69
system_cpu_utilization{cpu="1",state="idle",type="OTHER"} 70
system_cpu_utilization{cpu="2",state="idle",type="OTHER"} 72
system_cpu_utilization{cpu="3",state="idle",type="OTHER"} 67
system_cpu_utilization{cpu="4",state="idle",type="OTHER"} 69
system_cpu_utilization{cpu="5",state="idle",type="OTHER"} 68
system_cpu_utilization{cpu="6",state="idle",type="OTHER"} 68
system_cpu_utilization{cpu="7",state="idle",type="OTHER"} 73
system_cpu_utilization{cpu="8",state="idle",type="OTHER"} 70
system_cpu_utilization{cpu="9",state="idle",type="OTHER"} 70
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Feb 2026 07:48:26 GMT</pubDate>
    <dc:creator>Vincent_Bacher</dc:creator>
    <dc:date>2026-02-09T07:48:26Z</dc:date>
    <item>
      <title>ONELINER: cpview 2  prometheus</title>
      <link>https://community.checkpoint.com/t5/Scripts/ONELINER-cpview-2-prometheus/m-p/270025#M1457</link>
      <description>&lt;P&gt;Hi CheckMates,&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;This one-liner script converts the output of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;cpview -m&lt;/CODE&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;(monitoring metrics) into standardized Prometheus format.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Use Case:&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;When integrating Skyline with SIEM systems like Prometheus, troubleshooting may require comparing the data that Skyline receives from cpview with what's actually queryable in Prometheus using PromQL. This script transforms the cpview JSON output into Prometheus metrics with labels and values.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;How it works:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Reads cpview monitoring data in JSON format&lt;/LI&gt;
&lt;LI&gt;Converts metric IDs to Prometheus-compatible names (dots to underscores)&lt;/LI&gt;
&lt;LI&gt;Extracts labels and formats them as&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE&gt;metric_name{label1="value1",label2="value2"} value&lt;/CODE&gt;&lt;/LI&gt;
&lt;LI&gt;Filters out empty datasets&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;STRONG&gt;Usage:&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV class="code" data-code="id#24"&gt;
&lt;DIV class="interactive-result-code-block no-vulns" data-keybinding-context="43"&gt;
&lt;DIV class="interactive-result-editor" data-keybinding-context="44" data-mode-id="shellscript"&gt;
&lt;DIV class="monaco-editor no-user-select  showUnused showDeprecated vs-dark" role="code" data-uri="vscode-chat-code-block://dnnjb2rllwnoyxqtc2vzc2lvbjovl2xvy2fsl09uttnaakzpwwpjde5etmlnatawwkdznexuzznovfv0wtjvmll6smhar0k1wlrbdw/response_00d9ca7e-2989-421e-a324-576508f42342/0#%7B%22references%22%3A%5B%5D%7D"&gt;
&lt;DIV class="overflow-guard" data-mprt="3"&gt;
&lt;DIV class="margin" role="presentation" aria-hidden="true"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;LI-CODE lang="markup"&gt;cpview -m | jq -r '.metrics[] | .["metric-id"] as $metric | ($metric | split(".") | join("_")) as $metric_name | if (.data | length) &amp;gt; 0 then .data[] | (to_entries | map(select(.key != "value")) | map("\(.key)=\"\(.value)\"") | join(",")) as $labels | if $labels != "" then "\($metric_name){\($labels)} \(.value)" else "\($metric_name) \(.value)" end else empty end'&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;Examples:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;cpview -m | jq -r '.metrics[] | .["metric-id"] as $metric | ($metric | split(".") | join("_")) as $metric_name | if (.data | length) &amp;gt; 0 then .data[] | (to_entries | map(select(.key != "value")) | map("\(.key)=\"\(.value)\"") | join(",")) as $labels | if $labels != "" then "\($metric_name){\($labels)} \(.value)" else "\($metric_name) \(.value)" end else empty end' | grep system_cpu_count
system_cpu_count 42
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt; cpview -m | jq -r '.metrics[] | .["metric-id"] as $metric | ($metric | split(".") | join("_")) as $metric_name | if (.data | length) &amp;gt; 0 then .data[] | (to_entries | map(select(.key != "value")) | map("\(.key)=\"\(.value)\"") | join(",")) as $labels | if $labels != "" then "\($metric_name){\($labels)} \(.value)" else "\($metric_name) \(.value)" end else empty end' | grep system_cpu_utilization
system_cpu_utilization{cpu="0",state="idle",type="OTHER"} 69
system_cpu_utilization{cpu="1",state="idle",type="OTHER"} 70
system_cpu_utilization{cpu="2",state="idle",type="OTHER"} 72
system_cpu_utilization{cpu="3",state="idle",type="OTHER"} 67
system_cpu_utilization{cpu="4",state="idle",type="OTHER"} 69
system_cpu_utilization{cpu="5",state="idle",type="OTHER"} 68
system_cpu_utilization{cpu="6",state="idle",type="OTHER"} 68
system_cpu_utilization{cpu="7",state="idle",type="OTHER"} 73
system_cpu_utilization{cpu="8",state="idle",type="OTHER"} 70
system_cpu_utilization{cpu="9",state="idle",type="OTHER"} 70
&lt;/LI-CODE&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Feb 2026 07:48:26 GMT</pubDate>
      <guid>https://community.checkpoint.com/t5/Scripts/ONELINER-cpview-2-prometheus/m-p/270025#M1457</guid>
      <dc:creator>Vincent_Bacher</dc:creator>
      <dc:date>2026-02-09T07:48:26Z</dc:date>
    </item>
  </channel>
</rss>

