<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Posts | sgala.com . website</title><link>https://staging.sgala.com/post/</link><atom:link href="https://staging.sgala.com/post/index.xml" rel="self" type="application/rss+xml"/><description>Posts</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Tue, 02 Apr 2024 12:30:06 +0100</lastBuildDate><image><url>https://staging.sgala.com/media/icon_hu_fc753c5997041613.png</url><title>Posts</title><link>https://staging.sgala.com/post/</link></image><item><title>IPv6 come abbiamo fatto in Ehiweb - 6lottino 2022 - MIX-it</title><link>https://staging.sgala.com/post/ipv6-come-abbiamo-fatto-6lottino-mix-it/</link><pubDate>Wed, 05 Apr 2023 21:17:06 +0100</pubDate><guid>https://staging.sgala.com/post/ipv6-come-abbiamo-fatto-6lottino-mix-it/</guid><description>&lt;p&gt;A Ottobre 2022 sono stato ospite del 6lottino di MIX-it (&lt;a href="https://mix-it.net/" target="_blank" rel="noopener"&gt;https://mix-it.net/&lt;/a&gt;) dove ho presentato come abbiamo adottato IPv6 sulla nostra rete d&amp;rsquo;accesso nazionale (ADSL/FTTC/FTTH) di Ehiweb(&lt;a href="https://www.ehiweb.it" target="_blank" rel="noopener"&gt;https://www.ehiweb.it&lt;/a&gt;) a livello massivo su tutta la clientela.&lt;/p&gt;
&lt;p&gt;Ho descritto il nostro piano di adozione, l&amp;rsquo;approccio e alcune sfide che abbiamo dovuto affrontare e risolvere.&lt;/p&gt;
&lt;h2 id="hahahugoshortcode12s0hbhb"&gt;&lt;div style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;"&gt;
&lt;iframe allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen" loading="eager" referrerpolicy="strict-origin-when-cross-origin" src="https://www.youtube.com/embed/MA_ylRUGcDE?autoplay=0&amp;amp;controls=1&amp;amp;end=0&amp;amp;loop=0&amp;amp;mute=0&amp;amp;start=0" style="position: absolute; top: 0; left: 0; width: 100%; height: 100%; border:0;" title="YouTube video"&gt;&lt;/iframe&gt;
&lt;/div&gt;
&lt;/h2&gt;
&lt;div class="callout flex px-4 py-3 mb-6 rounded-md border-l-4 bg-blue-100 dark:bg-blue-900 border-blue-500"
data-callout="note"
data-callout-metadata=""&gt;
&lt;span class="callout-icon pr-3 pt-1 text-blue-600 dark:text-blue-300"&gt;
&lt;svg height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"&gt;&lt;path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m16.862 4.487l1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L6.832 19.82a4.5 4.5 0 0 1-1.897 1.13l-2.685.8l.8-2.685a4.5 4.5 0 0 1 1.13-1.897zm0 0L19.5 7.125"/&gt;&lt;/svg&gt;
&lt;/span&gt;
&lt;div class="callout-content dark:text-neutral-300"&gt;
&lt;div class="callout-title font-semibold mb-1"&gt;Note&lt;/div&gt;
&lt;div class="callout-body"&gt;&lt;p&gt;TL;DR Link al &lt;a href="Presentazione.pdf"&gt;pdf della presentazione&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</description></item><item><title>Fetch a service status detail via CheckMk REST API</title><link>https://staging.sgala.com/post/checkmk-api-get-service/</link><pubDate>Mon, 27 Mar 2023 21:17:06 +0100</pubDate><guid>https://staging.sgala.com/post/checkmk-api-get-service/</guid><description>&lt;p&gt;I had to write a script that fetch from a &lt;a href="https://checkmk.com/" target="_blank" rel="noopener"&gt;CheckMk&lt;/a&gt; monitored service the status of that service and do something.&lt;/p&gt;
&lt;p&gt;I tried to ask how to do this to several friends that are using CheckMk&amp;hellip; no one had ever do this before ;(&lt;/p&gt;
&lt;p&gt;In my real scenario I need to fetch a specific service status:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Critical&lt;/li&gt;
&lt;li&gt;Contains some specific text matching in the perf data field.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="tldr"&gt;TL;DR;&lt;/h2&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;USERNAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$USERNAME&lt;/span&gt;$
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;PASSWORD&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$PASSWORD&lt;/span&gt;$
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;curl -s -G &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --header &lt;span class="s2"&gt;&amp;#34;Accept: */*&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; -H &lt;span class="s2"&gt;&amp;#34;Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$USERNAME&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$PASSWORD&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --data-urlencode &lt;span class="s1"&gt;&amp;#39;columns=host_name&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --data-urlencode &lt;span class="s1"&gt;&amp;#39;columns=perf_data&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; --data-urlencode &lt;span class="s1"&gt;&amp;#39;query= \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; { &amp;#34;op&amp;#34;: &amp;#34;and&amp;#34;, &amp;#34;expr&amp;#34;:[{&amp;#34;op&amp;#34;: &amp;#34;=&amp;#34;, &amp;#34;left&amp;#34;: &amp;#34;host_name&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;$HOSTNAME$&amp;#34;}, \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; { &amp;#34;op&amp;#34;: &amp;#34;=&amp;#34;, &amp;#34;left&amp;#34;: &amp;#34;description&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;$SERVICE_NAME$&amp;#34;}, \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; { &amp;#34;op&amp;#34;: &amp;#34;=&amp;#34;, &amp;#34;left&amp;#34;: &amp;#34;state&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;2&amp;#34; }, \
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="s1"&gt; { &amp;#34;op&amp;#34;: &amp;#34;~~&amp;#34;, &amp;#34;left&amp;#34;: &amp;#34;perf_data&amp;#34;, &amp;#34;right&amp;#34;: &amp;#34;$SOMETHING_TO_FILTER&amp;#34; } ]}&amp;#39;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$CHECKMK_URL&lt;/span&gt;$&lt;span class="s2"&gt;/&lt;/span&gt;&lt;span class="nv"&gt;$SITE_NAME&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;/check_mk/api/1.0/domain-types/service/collections/all
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In this example the shell lines do a CURL request to the CheckMk REST API and fetch only the status of the service $SERVICE_NAME$ that are in a Critical status and contains the word $SOMETHING_TO_FILTER$.
The query it&amp;rsquo;s very useful as you can fine match what do you want without write any code outside.
The query is wrote in the &lt;a href="https://docs.checkmk.com/latest/en/livestatus_references.html#filter" target="_blank" rel="noopener"&gt;livestatus &amp;ldquo;language&amp;rdquo;&lt;/a&gt;.
As you can see there are multiple columns added, these are not provided by default in the results, so I added them because were needed in my scenario.&lt;/p&gt;
&lt;h1 id="some-links"&gt;Some links&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;a post I did on checkmk forum about some issues resolving this &lt;a href="https://forum.checkmk.com/t/rest-api-fetch-service-status-missing-details-summary/37613" target="_blank" rel="noopener"&gt;https://forum.checkmk.com/t/rest-api-fetch-service-status-missing-details-summary/37613&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;more example/docs &lt;a href="https://kb.checkmk.com/display/KB/REST-API&amp;#43;Code&amp;#43;Examples" target="_blank" rel="noopener"&gt;https://kb.checkmk.com/display/KB/REST-API+Code+Examples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>IPv6 RADIUS Accounting</title><link>https://staging.sgala.com/post/ipv6-radius-accounting/</link><pubDate>Wed, 29 Jun 2022 12:48:06 +0100</pubDate><guid>https://staging.sgala.com/post/ipv6-radius-accounting/</guid><description>&lt;p&gt;I&amp;rsquo;m struggling to understand why on accounting packets of my Cisco ASR1001-X with a dual stack configuration, the Delegated-IPv6-Prefix is not present at all.&lt;/p&gt;
&lt;p&gt;In my configuration I&amp;rsquo;m using DHCPv6 PD and Delegated-IPv6-Prefix sent from the RADIUS server in Access-Accept response in every request.&lt;/p&gt;
&lt;p&gt;I found that interesting article of
and found the reason about it.&lt;/p&gt;
&lt;p&gt;Basically you have to enable the feature with this command, keep in mind that it&amp;rsquo;s only supported from IOS 15.1.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;aaa accounting include auth-profile delegated-ipv6-prefix
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here a screenshot of the Cisco documentation and
to the official documentation about that command.&lt;/p&gt;
&lt;div style="border: 2px solid #555;"&gt;
&lt;p&gt;
&lt;figure &gt;
&lt;div class="flex justify-center "&gt;
&lt;div class="w-full" &gt;
&lt;img alt="Image"
srcset="https://staging.sgala.com/post/ipv6-radius-accounting/cisco_documentation_hu_2d4bcb9eb1a13166.webp 320w, https://staging.sgala.com/post/ipv6-radius-accounting/cisco_documentation_hu_47c915b2a775ddab.webp 480w, https://staging.sgala.com/post/ipv6-radius-accounting/cisco_documentation_hu_1bc3a1537b182b16.webp 760w"
sizes="(max-width: 480px) 100vw, (max-width: 768px) 90vw, (max-width: 1024px) 80vw, 760px"
src="https://staging.sgala.com/post/ipv6-radius-accounting/cisco_documentation_hu_2d4bcb9eb1a13166.webp"
width="760"
height="586"
loading="lazy" data-zoomable /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;/div&gt;</description></item><item><title>IPv6 subnetting in command line with sipcalc</title><link>https://staging.sgala.com/post/ipv6-command-line-subnetting/</link><pubDate>Mon, 30 May 2022 09:17:06 +0100</pubDate><guid>https://staging.sgala.com/post/ipv6-command-line-subnetting/</guid><description>&lt;p&gt;I had to put my hands on my IPv6 network after lots of years&amp;hellip; my memories are not so good&amp;hellip;how to subnet a IPv6 network in command line?&lt;/p&gt;
&lt;h1 id="what-to-do"&gt;What to do&lt;/h1&gt;
&lt;p&gt;I need to generate a pool of network /64, /60, /56 and /48 to assign to new customers from larger CIDR. Quickly and without painass.&lt;/p&gt;
&lt;h1 id="sipcalc"&gt;Sipcalc&lt;/h1&gt;
&lt;p&gt;
it&amp;rsquo;s an amazing tool for IPv4 and IPv6 calculations.&lt;/p&gt;
&lt;p&gt;From the
I found a perfect option to do this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;* -S, --v6split=MASK (IPv6)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; Split the current network into subnets of MASK size. MASK must be given in
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; CIDR form, either with or with the &amp;#39;/&amp;#39; character.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h1 id="problem"&gt;Problem&lt;/h1&gt;
&lt;p&gt;For example, I have a /48 network and I want to split into /56&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;gt; sipcalc -u 2a01:b600:4000::/48 -S &lt;span class="m"&gt;56&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt;head -n &lt;span class="m"&gt;50&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-&lt;span class="o"&gt;[&lt;/span&gt;ipv6 : 2a01:b600:4000::/48&lt;span class="o"&gt;]&lt;/span&gt; - &lt;span class="m"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;Split network - verbose&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-&lt;span class="o"&gt;[&lt;/span&gt;ipv6 : 2a01:b600:4000::/48&lt;span class="o"&gt;]&lt;/span&gt; - &lt;span class="m"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;IPV6 INFO&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Expanded Address - 2a01:b600:4000:0000:0000:0000:0000:0000
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Compressed address - 2a01:b600:4000::
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:0:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address ID &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 0:0:0:0:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Prefix address - ffff:ffff:ffff:ff00:0:0:0:0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Prefix length - &lt;span class="m"&gt;56&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address &lt;span class="nb"&gt;type&lt;/span&gt; - Aggregatable Global Unicast Addresses
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Network range - 2a01:b600:4000:0000:0000:0000:0000:0000 -
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 2a01:b600:4000:00ff:ffff:ffff:ffff:ffff
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-&lt;span class="o"&gt;[&lt;/span&gt;ipv6 : 2a01:b600:4000::/48&lt;span class="o"&gt;]&lt;/span&gt; - &lt;span class="m"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;IPV6 INFO&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Expanded Address - 2a01:b600:4000:0100:0000:0000:0000:0000
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Compressed address - 2a01:b600:4000:100::
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:100:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address ID &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 0:0:0:0:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Prefix address - ffff:ffff:ffff:ff00:0:0:0:0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Prefix length - &lt;span class="m"&gt;56&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address &lt;span class="nb"&gt;type&lt;/span&gt; - Aggregatable Global Unicast Addresses
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Network range - 2a01:b600:4000:0100:0000:0000:0000:0000 -
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 2a01:b600:4000:01ff:ffff:ffff:ffff:ffff
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;-&lt;span class="o"&gt;[&lt;/span&gt;ipv6 : 2a01:b600:4000::/48&lt;span class="o"&gt;]&lt;/span&gt; - &lt;span class="m"&gt;0&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="o"&gt;[&lt;/span&gt;IPV6 INFO&lt;span class="o"&gt;]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Expanded Address - 2a01:b600:4000:0200:0000:0000:0000:0000
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Compressed address - 2a01:b600:4000:200::
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:200:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address ID &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 0:0:0:0:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Prefix address - ffff:ffff:ffff:ff00:0:0:0:0
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Prefix length - &lt;span class="m"&gt;56&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Address &lt;span class="nb"&gt;type&lt;/span&gt; - Aggregatable Global Unicast Addresses
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Network range - 2a01:b600:4000:0200:0000:0000:0000:0000 -
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; 2a01:b600:4000:02ff:ffff:ffff:ffff:ffff
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see the result are the /48 network splitted with lots of info that can be useful or not.&lt;/p&gt;
&lt;p&gt;As i need only the IPv6 address generated with the CIDR this is a output more useful (in this example the first 10 nets):&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;gt; sipcalc -u 2a01:b600:4000::/48 -S 56&lt;span class="p"&gt;|&lt;/span&gt;grep &lt;span class="s1"&gt;&amp;#39;prefix&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;head -n &lt;span class="m"&gt;10&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:0:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:100:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:200:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:300:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:400:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:500:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:600:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:700:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:800:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Subnet prefix &lt;span class="o"&gt;(&lt;/span&gt;masked&lt;span class="o"&gt;)&lt;/span&gt; - 2a01:b600:4000:900:0:0:0:0/56
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;It&amp;rsquo;s done. You can generate all type of network split you want modifying the network size and split size.&lt;/p&gt;
&lt;p&gt;Thanks for reading!&lt;/p&gt;</description></item><item><title>Java process &gt;100%cpu, find the guilty thread</title><link>https://staging.sgala.com/post/java-thread-huge-cpu/</link><pubDate>Sun, 09 Jan 2022 09:17:06 +0100</pubDate><guid>https://staging.sgala.com/post/java-thread-huge-cpu/</guid><description>&lt;p&gt;It&amp;rsquo;s a rainy friday&amp;hellip; and my checkmk monitoring alert me about this:
&lt;figure &gt;
&lt;div class="flex justify-center "&gt;
&lt;div class="w-full" &gt;
&lt;img alt="Image"
srcset="https://staging.sgala.com/post/java-thread-huge-cpu/cpu_load_hu_48e68af8a2488bf7.webp 320w, https://staging.sgala.com/post/java-thread-huge-cpu/cpu_load_hu_570b78ffa0920ef0.webp 480w, https://staging.sgala.com/post/java-thread-huge-cpu/cpu_load_hu_d34d4e09a276908b.webp 760w"
sizes="(max-width: 480px) 100vw, (max-width: 768px) 90vw, (max-width: 1024px) 80vw, 760px"
src="https://staging.sgala.com/post/java-thread-huge-cpu/cpu_load_hu_48e68af8a2488bf7.webp"
width="760"
height="217"
loading="lazy" data-zoomable /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a application server VM where are running several Python and Java softwares belonging to an our product.
Seeems that something happened and now the CPU load is very high than normal. It&amp;rsquo;s not normal and seems not temporarly.&lt;/p&gt;
&lt;h1 id="first-dig"&gt;First dig&lt;/h1&gt;
&lt;p&gt;Found via top/htop that the responsible is as single Java process&amp;hellip;
It&amp;rsquo;s an our legacy and very consolidated software that is not modified ealier. We need to find what is causing this strange usage and find the root cause in order to mitigate.
That Java process have hundreds of threads and is very complicated&amp;hellip;&lt;/p&gt;
&lt;h2 id="telemetry"&gt;Telemetry&lt;/h2&gt;
&lt;p&gt;All the telemetry data of the application are under the normal limits. No abuses or peaks.&lt;/p&gt;
&lt;h2 id="logs--debug"&gt;Logs / Debug&lt;/h2&gt;
&lt;p&gt;Normal logs give us no useful information. All is working fine.
Enabled the debug mode: no useful info, we see normal traffic belonging correctly to the application and all is working fine.&lt;/p&gt;
&lt;p&gt;So?&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s time to trace the Java process&amp;hellip; who ever do it? It&amp;rsquo;s the time for the first time&amp;hellip;&lt;/p&gt;
&lt;h2 id="how-to-trace-a-java-process"&gt;How to trace a java process?&lt;/h2&gt;
&lt;p&gt;I really don&amp;rsquo;t know. I need to found the thread responsible of the abnormal CPU usage.
Does exist a TOP like command for a Java process? Asking to Google I found this
.&lt;/p&gt;
&lt;p&gt;Is very simple:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;jvmtop $PID&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Executed on my system and the output is very similar to top/htop command. Unfortunately all top consuming CPU threads are named Receiver-179, Receiver-190, etc&amp;hellip;
The good news is that now we know the Thread name&amp;hellip; the bad news is that these thread names does not belong to our codebase but are thread named by a third parties library&amp;hellip;&lt;/p&gt;
&lt;p&gt;We need more info&amp;hellip;how?&lt;/p&gt;
&lt;p&gt;Googling&amp;hellip; found the tool
already bundled in the JDK by default.&lt;/p&gt;
&lt;h2 id="jstacking-my-java-app"&gt;Jstacking my Java app&lt;/h2&gt;
&lt;p&gt;It&amp;rsquo;s time to jstacking my java app. This tool give your as output the full stack trace of the java process with a output like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;Thread-514&amp;#34; #538 prio=5 os_prio=0 tid=0x00007ffab06c5800 nid=0x5db0 runnable [0x00007ffa81758000]
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; java.lang.Thread.State: RUNNABLE
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.lang.Thread.yield(Native Method)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.util.ProcessingThread.stop(ProcessingThread.java:162)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.Receiver.stop(Receiver.java:219)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at it.besms.server.SMSCSession.run(SMSCSession.java:142)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; - locked &amp;lt;0x00000000ee6efcd0&amp;gt; (a it.besms.server.SMSCSession)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.lang.Thread.run(Thread.java:748)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&amp;#34;Receiver-179&amp;#34; #532 prio=5 os_prio=0 tid=0x00007ffacc048800 nid=0x5dac runnable [0x00007ffa81354000]
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; java.lang.Thread.State: RUNNABLE
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.net.SocketInputStream.socketRead0(Native Method)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.net.SocketInputStream.socketRead(SocketInputStream.java:116)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.net.SocketInputStream.read(SocketInputStream.java:171)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.net.SocketInputStream.read(SocketInputStream.java:141)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.io.BufferedInputStream.read1(BufferedInputStream.java:284)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.io.BufferedInputStream.read(BufferedInputStream.java:345)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; - locked &amp;lt;0x00000000ee71f1d8&amp;gt; (a java.io.BufferedInputStream)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.TCPIPConnection.receive(TCPIPConnection.java:413)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.ReceiverBase.receivePDUFromConnection(ReceiverBase.java:197)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.Receiver.receiveAsync(Receiver.java:358)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.ReceiverBase.process(ReceiverBase.java:96)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at org.smpp.util.ProcessingThread.run(ProcessingThread.java:191)
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; at java.lang.Thread.run(Thread.java:748)
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;With the information got from &lt;code&gt;jvmtop&lt;/code&gt;, I know the thead names and with this output I can find the classes involved on these threads and debug more deeply on the source code.&lt;/p&gt;
&lt;p&gt;These threads are belonging to a Java SMPP library. The classes involved are regarding the inbound SMPP traffic.&lt;/p&gt;
&lt;h1 id="root-cause"&gt;Root cause&lt;/h1&gt;
&lt;p&gt;Now we can point the attention to the right direction: Inbound SMPP traffic.&lt;/p&gt;
&lt;p&gt;We checked more deeeply the logs of that specific part and found a single host that is trying to authenticate about 20 times/sec and it was refused by the application for a internal reason.
Analyzing the source code we found the root cause of the issue and was a bug on the library that cause a abnormal usage of CPU of theese threads if they are closed too quickly.&lt;/p&gt;
&lt;h2 id="mitigation"&gt;Mitigation&lt;/h2&gt;
&lt;p&gt;In order to mitigate the issue we dropped the host traffic.
&lt;figure &gt;
&lt;div class="flex justify-center "&gt;
&lt;div class="w-full" &gt;
&lt;img alt="Image"
srcset="https://staging.sgala.com/post/java-thread-huge-cpu/cpu_normal_hu_90f6a2dea6bb11fb.webp 320w, https://staging.sgala.com/post/java-thread-huge-cpu/cpu_normal_hu_4bf08e0133f60d2d.webp 480w, https://staging.sgala.com/post/java-thread-huge-cpu/cpu_normal_hu_11c407207c900d40.webp 760w"
sizes="(max-width: 480px) 100vw, (max-width: 768px) 90vw, (max-width: 1024px) 80vw, 760px"
src="https://staging.sgala.com/post/java-thread-huge-cpu/cpu_normal_hu_90f6a2dea6bb11fb.webp"
width="760"
height="208"
loading="lazy" data-zoomable /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/figure&gt;
&lt;/p&gt;
&lt;p&gt;Afterthat we fixed the issue on the source code and deployed a final fix.&lt;/p&gt;
&lt;p&gt;Debug/trace a Java process is not a so trivial issue! ;)&lt;/p&gt;
&lt;p&gt;Thanks for reading!&lt;/p&gt;</description></item><item><title>NTP out of sync each night on ESXi</title><link>https://staging.sgala.com/post/ntp-time-vmware-veeam-drift/</link><pubDate>Tue, 14 Dec 2021 23:17:06 +0100</pubDate><guid>https://staging.sgala.com/post/ntp-time-vmware-veeam-drift/</guid><description>&lt;p&gt;In the last weeks I installed &lt;a href="https://checkmk.com/" target="_blank" rel="noopener"&gt;CheckMk&lt;/a&gt; to try it. I already added to CheckMK monitoring several hosts, mainly VM with its &lt;a href="https://docs.checkmk.com/latest/en/agent_linux.html" target="_blank" rel="noopener"&gt;Linux Agent&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Since I&amp;rsquo;m trying it, I&amp;rsquo;m not giving it so much attention, right now. Yesterday, some late alarms got my attention.
Seems that some servers are with the clock drifted, also if they have NTP installed and (I hope)configured correctly.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s time to dig.&lt;/p&gt;
&lt;h1 id="first"&gt;First&lt;/h1&gt;
&lt;h2 id="pattern"&gt;Pattern&lt;/h2&gt;
&lt;p&gt;During digging I found a strange pattern. While I was on ssh on a VM, another one had the same NTP alert. Very very strange. This is an alarm bell. Shouldn&amp;rsquo;t a specific VM issue but a quite large one.
It&amp;rsquo;s time to use the powerful of CheckMK. I did a search for the service alert NTP and found a very interesting behavior on it.
This is an example of the output
&lt;figure &gt;
&lt;div class="flex justify-center "&gt;
&lt;div class="w-full" &gt;
&lt;img alt="Image"
srcset="https://staging.sgala.com/post/ntp-time-vmware-veeam-drift/screenshot-allarmi_hu_aa23b8df8b38f652.webp 320w, https://staging.sgala.com/post/ntp-time-vmware-veeam-drift/screenshot-allarmi_hu_92f93f8a20e9de62.webp 480w, https://staging.sgala.com/post/ntp-time-vmware-veeam-drift/screenshot-allarmi_hu_c8549e29f57a9f68.webp 760w"
sizes="(max-width: 480px) 100vw, (max-width: 768px) 90vw, (max-width: 1024px) 80vw, 760px"
src="https://staging.sgala.com/post/ntp-time-vmware-veeam-drift/screenshot-allarmi_hu_aa23b8df8b38f652.webp"
width="760"
height="358"
loading="lazy" data-zoomable /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/figure&gt;
I can see:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;every ~24h it happens&lt;/li&gt;
&lt;li&gt;it has been resolved automatically after sometime&lt;/li&gt;
&lt;li&gt;it happens in a lot of VM
But why?!&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id="matching-ideas"&gt;Matching ideas&lt;/h2&gt;
&lt;p&gt;It cannot be a NTP issue on a specific VM as several VM have the same issue.
It cannot be a Debian version specific issue or systemd issue as it happens also on Devuan and on several different VM with different Debian releases.
So?
Idea: Backups! The Veeam backup jobs run exactly on these hours&amp;hellip; but does not make sense&amp;hellip;on the basis of the knowledge that already I have&amp;hellip;
Googled and&amp;hellip;found!&lt;/p&gt;
&lt;h2 id="vmware-ntp-sync-during-snapshots"&gt;VMWare NTP sync during snapshots&lt;/h2&gt;
&lt;p&gt;I discovered that by design vMware when take snapshots (and Veeam take snapshots for doing its backup) it sync the time of the ESXI hosts to the VM via vMware Tools.
This is correctly &lt;a href="https://kb.vmware.com/s/article/1189" target="_blank" rel="noopener"&gt;documented here&lt;/a&gt;, the interesting part is:&lt;/p&gt;
&lt;blockquote class="border-l-4 border-neutral-300 dark:border-neutral-600 pl-4 italic text-neutral-600 dark:text-neutral-400 my-6"&gt;
&lt;p&gt;One-off time sync: Guest system clock is synchronized to host time upon specific VM life-cycle events that can cause guest &amp;gt; clock to become incorrect, such as resuming from vMotion or a &lt;strong&gt;snapshot&lt;/strong&gt;. This capability is recommended for use and turned &amp;gt; on by default.
VMware Tools does not set time backwards (when guest time is ahead of the host), except once when periodic time &amp;gt; synchronization is turned on.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="clock-assessment-on-the-vmware-infrastructure"&gt;Clock assessment on the VMWare infrastructure&lt;/h2&gt;
&lt;p&gt;Checked the config on each ESXi hosts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;NTP is configured on each ESXi;&lt;/li&gt;
&lt;li&gt;the clock is wrong on all ESXi;
&amp;hellip;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Checking more deeply on each ESXi hosts, I found that the NTP servers configured on them are belonging to a my temporary infrastructure decommissioned. These NTP servers are definitively not working&amp;hellip; and this is the reason why all clocks are wrong.&lt;/p&gt;
&lt;h1 id="final-timeline-of-the-events"&gt;Final timeline of the events&lt;/h1&gt;
&lt;p&gt;What&amp;rsquo;s happening:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;all ESXi servers have bad NTP servers&lt;/li&gt;
&lt;li&gt;all ESXi clocks drifted&lt;/li&gt;
&lt;li&gt;at every Veeam backup, VMWare synchronize the ESXi clock to the VM (with a wrong clock)&lt;/li&gt;
&lt;li&gt;checkmk discover the drift and catch an alert&lt;/li&gt;
&lt;li&gt;after some minutes NTPd servers running on each VM correct the clock of the VM&lt;/li&gt;
&lt;li&gt;checkmk alert are cleared&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This was happening cyclically each night, each, backup window&amp;hellip; the mystery has been found.&lt;/p&gt;
&lt;p&gt;I fixed the NTP servers with valid ones on each ESXi, the clock has been corrected and the issue has been resolved definitively.&lt;/p&gt;</description></item></channel></rss>