<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Lux4rd0 Labs</title>
	<atom:link href="https://labs.lux4rd0.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://labs.lux4rd0.com</link>
	<description>Create. Experience. Share. Do.</description>
	<lastBuildDate>Sat, 18 Nov 2023 22:17:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://labs.lux4rd0.com/wp-content/uploads/2021/01/lulx4rd0labs-favicon-150x150.png</url>
	<title>Lux4rd0 Labs</title>
	<link>https://labs.lux4rd0.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">185588299</site>	<item>
		<title>Mind The Gap: SmartThings Exporter, Grafana Loki, and a Pi-hole REFUSED Response</title>
		<link>https://labs.lux4rd0.com/2021/02/mind-the-gap-smartthings-exporter-grafana-loki-and-a-pi-hole-refused-response/</link>
					<comments>https://labs.lux4rd0.com/2021/02/mind-the-gap-smartthings-exporter-grafana-loki-and-a-pi-hole-refused-response/#respond</comments>
		
		<dc:creator><![CDATA[Dave Schmid]]></dc:creator>
		<pubDate>Wed, 24 Feb 2021 16:11:18 +0000</pubDate>
				<category><![CDATA[DNS]]></category>
		<category><![CDATA[Grafana]]></category>
		<category><![CDATA[Loki]]></category>
		<category><![CDATA[Pi-hole]]></category>
		<guid isPermaLink="false">https://labs.lux4rd0.com/?p=257</guid>

					<description><![CDATA[I started noticing some gaps in my home-lab monitoring solutions this week, but I didn&#8217;t pay much attention until I looked at it over time. My SmartThings Prometheus exporter reaches out to the SmartThings API every 60 seconds and populates the status and metrics for each of my devices. I can make some nice Grafana [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I started noticing some gaps in my home-lab monitoring solutions this week, but I didn&#8217;t pay much attention until I looked at it over time.</p>
<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-258" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps.jpg" alt="" width="2150" height="750" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps.jpg 2150w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps-300x105.jpg 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps-1024x357.jpg 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps-768x268.jpg 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps-1536x536.jpg 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/teamperatues_gaps-2048x714.jpg 2048w" sizes="(max-width: 2150px) 100vw, 2150px" /></p>
<p>My <a href="https://github.com/moikot/smartthings-metrics" target="_blank" rel="noopener">SmartThings Prometheus exporter</a> reaches out to the SmartThings API every 60 seconds and populates the status and metrics for each of my devices. I can make some nice <a href="https://grafana.com/oss/grafana/" target="_blank" rel="noopener">Grafana</a> dashboards that show <a href="https://grafana.com/grafana/dashboards/13550" target="_blank" rel="noopener">battery levels</a>, <a href="https://grafana.com/grafana/dashboards/13551" target="_blank" rel="noopener">contact, motion, &amp; switch status</a>, <a href="https://grafana.com/grafana/dashboards/13552" target="_blank" rel="noopener">power usage</a>, <a href="https://grafana.com/grafana/dashboards/13553" target="_blank" rel="noopener">temperature</a>, and <a href="https://grafana.com/grafana/dashboards/13554" target="_blank" rel="noopener">thermostats</a>. But there&#8217;s nothing worse than seeing null values in my data!! UGH!!! <em>(It makes for some seriously ugly graphs and missed alerts &#8211; unless you&#8217;re connecting null values&#8230;)</em></p>
<p>Because I also use Grafana&#8217;s Loki <a href="https://grafana.com/docs/loki/latest/clients/docker-driver/" target="_blank" rel="noopener">Docker Driver Client</a>, I could quickly take a current and historical view of the logs from my SmartThings exporter. It wasn&#8217;t looking good:</p>
<p><img decoding="async" class="alignnone size-full wp-image-259" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/loki_error_logs.jpg" alt="" width="1116" height="250" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/loki_error_logs.jpg 1116w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/loki_error_logs-300x67.jpg 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/loki_error_logs-1024x229.jpg 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/loki_error_logs-768x172.jpg 768w" sizes="(max-width: 1116px) 100vw, 1116px" /></p>
<p>Something started kicking off a lot of errors around the 19th of February. And what are all these messages?</p>
<pre>dial tcp: lookup api.smartthings.com on 127.0.0.11:53: server misbehaving" source="loop.go:59"</pre>
<p>Specifically &#8211; looking up a server name on port 53 points to my local DNS server. To start troubleshooting &#8211; I tried doing some command line DNS lookups first:</p>
<pre># nslookup api.smartthings.com
Server: 10.10.3.80
Address: 10.10.3.80#53

Non-authoritative answer:
Name: api.smartthings.com
Address: 3.131.74.134
Name: api.smartthings.com
Address: 13.59.226.110
Name: api.smartthings.com
Address: 3.137.134.173
Name: api.smartthings.com
Address: 3.131.168.20
Name: api.smartthings.com
Address: 18.220.168.164
Name: api.smartthings.com
Address: 3.140.46.118
Name: api.smartthings.com
Address: 3.13.133.255
Name: api.smartthings.com
Address: 3.131.79.130</pre>
<p>That looked fine. So I tried running it a few more times just to be sure, and I quickly received a different response:</p>
<pre># nslookup api.smartthings.com
Server: 10.10.3.80
Address: 10.10.3.80#53

** server can't find api.smartthings.com: REFUSED</pre>
<p>Refused huh? <em>(I shall not be REFUSED!!)</em></p>
<p>Let me try a local network server:</p>
<pre># nslookup grafana01.tylephony.com
Server: 10.10.3.80
Address: 10.10.3.80#53

** server can't find grafana01.tylephony.com: REFUSED</pre>
<p>Since I use and love <a href="https://pi-hole.net/" target="_blank" rel="noopener">Pi-hole</a> as my local DNS and DHCP server, I quickly searched their forums and found <a href="https://discourse.pi-hole.net/t/dns-query-refused/22367" target="_blank" rel="noopener">a similar issue</a>. But the response didn&#8217;t make sense in my case: <em>&#8220;Pi-hole is not refusing it, your upstream is refusing to provide an answer.&#8221;</em></p>
<p>Pi-hole <em>IS</em> my upstream server!!</p>
<p>More digging in the forums revealed the most recent release notes for <a href="https://discourse.pi-hole.net/t/pi-hole-ftl-v5-7-and-web-v5-4-released/44449" target="_blank" rel="noopener">Pi-hole FTL v5.7 and Web v5.4</a>. This caught my eye:</p>
<blockquote><p><strong>Inbuilt enhanced Denial-of-Service (DoS) protection</strong></p>
<p>Hence, we decided to implement a customizable rate-limiting into FTL itself. It defaults to the rather conservative limit of allowing no more than 1000 queries in a 60 seconds window for each client. Afterwards, any further queries are replied to with empty replies with the status set to REFUSED. Both the number of queries within the window as well as the window size can be configured by the user. It is important to note that rate-limiting is happening on a per-client basis. Other clients can continue to use FTL while rate-limited clients are short-circuited at the same time.</p></blockquote>
<p>Because I monitor many of my servers with <a href="https://grafana.com/oss/grafana/" target="_blank" rel="noopener">Grafana</a>, <a href="https://grafana.com/oss/prometheus/" target="_blank" rel="noopener">Prometheus</a>, and <a href="https://www.influxdata.com/products/influxdb/" target="_blank" rel="noopener">InfluxDB</a>, I often ping DNS. It&#8217;s around 5 million times a day. <em>And I did just update my Pi-hole servers</em>. A look back at my Pi-hole DNS stats shows more of this trend over time, both before and after this update.</p>
<p><img decoding="async" class="alignnone size-full wp-image-260" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/pihole_requests.jpg" alt="" width="1263" height="296" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/pihole_requests.jpg 1263w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/pihole_requests-300x70.jpg 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/pihole_requests-1024x240.jpg 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/pihole_requests-768x180.jpg 768w" sizes="(max-width: 1263px) 100vw, 1263px" /></p>
<p>Since the server I have running my SmartThings exporter also runs a lot of other exporters and metrics collectors, Pi-hole <em>was</em> rate-limiting that client.</p>
<p><img decoding="async" class="size-full wp-image-261 aligncenter" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/top_clients.jpg" alt="" width="459" height="116" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/top_clients.jpg 459w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/top_clients-300x76.jpg 300w" sizes="(max-width: 459px) 100vw, 459px" /></p>
<p>Thankfully, an easy fix:</p>
<blockquote><p>Rate-limiting can easily be disabled by setting RATE_LIMIT=0/0 in /etc/pihole/pihole-FTL.conf. If I want, say, to set a rate limit of 1 query per hour, the option should look like RATE_LIMIT=1/3600.</p></blockquote>
<p>So &#8211; any lessons learned?</p>
<ul>
<li>Read the release notes before deploying any updates. (Nope!)</li>
<li>Limit the rate interval or the number of metrics and exporters to ease the number of DNS queries. (Nope!)</li>
<li>Set up default error alerting to catch problems sooner. (Soon!!)</li>
</ul>
<p>Happily &#8211; no more gaps&#8230;</p>
<p><img decoding="async" class="size-full wp-image-265 aligncenter" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/mind_the_gap.png" alt="" width="998" height="168" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/mind_the_gap.png 998w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/mind_the_gap-300x51.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/mind_the_gap-768x129.png 768w" sizes="(max-width: 998px) 100vw, 998px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://labs.lux4rd0.com/2021/02/mind-the-gap-smartthings-exporter-grafana-loki-and-a-pi-hole-refused-response/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">257</post-id>	</item>
		<item>
		<title>WeatherFlow Tempest Log Collector</title>
		<link>https://labs.lux4rd0.com/2021/02/weatherflow-tempest-log-collector/</link>
					<comments>https://labs.lux4rd0.com/2021/02/weatherflow-tempest-log-collector/#comments</comments>
		
		<dc:creator><![CDATA[Dave Schmid]]></dc:creator>
		<pubDate>Sun, 21 Feb 2021 20:28:50 +0000</pubDate>
				<category><![CDATA[Grafana]]></category>
		<category><![CDATA[Loki]]></category>
		<category><![CDATA[Weather]]></category>
		<category><![CDATA[WeatherFlow]]></category>
		<guid isPermaLink="false">https://labs.lux4rd0.com/?p=197</guid>

					<description><![CDATA[This started as a straightforward story with three simple things: I love IoT gadgets. I love weather gadgets. I love charts and graphs. While perusing online, it&#8217;s possible that I stumbled upon a social media advertisement for the WeatherFlow Tempest Weather System (and a 15% off coupon). It&#8217;s also entirely possible that I made a [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>This started as a straightforward story with three simple things:</p>
<ol>
<li>I love IoT gadgets.</li>
<li>I love weather gadgets.</li>
<li>I love charts and graphs.</li>
</ol>
<p><img decoding="async" class="alignnone wp-image-254 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog.png" alt="" width="2452" height="1279" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog.png 2452w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-300x156.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-1024x534.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-768x401.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-1536x801.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-overview_blog-2048x1068.png 2048w" sizes="(max-width: 2452px) 100vw, 2452px" /></p>
<p>While perusing online, it&#8217;s possible that I stumbled upon a social media advertisement for the <a href="https://weatherflow.com/tempest-weather-system/" target="_blank" rel="noopener">WeatherFlow Tempest Weather System</a> (and a 15% off coupon). It&#8217;s also entirely possible that I made a quick purchase.</p>
<p><img decoding="async" class="size-full wp-image-201 aligncenter" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/149946ea408fc2d692ba79174e9f8889_original.png" alt="" width="680" height="500" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/149946ea408fc2d692ba79174e9f8889_original.png 680w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/149946ea408fc2d692ba79174e9f8889_original-300x221.png 300w" sizes="(max-width: 680px) 100vw, 680px" /></p>
<p>WeatherFlow Tempest started as a <a href="https://www.kickstarter.com/projects/weatherflow/tempest-a-revolutionary-personal-weather-system" target="_blank" rel="noopener">Kickstarter project</a> but is now shipping directly outside of just the backers. The WeatherFlow Tempest is a solar-powered weather station that collects measurements of wind, rain, lightning, temperature, humidity, pressure, and sunlight. It has a wireless hub collects these data points, pushes them up to the WeatherFlow cloud for processing and weather forecasting, and then provides a personalized weather app. Data can be collected with a <a href="https://weatherflow.github.io/Tempest/api/" target="_blank" rel="noopener">few different APIs</a> &#8211; one from WeatherFlow&#8217;s processed stream of events and metrics (<a href="https://weatherflow.github.io/Tempest/api/swagger/" target="_blank" rel="noopener">REST API</a>) or locally via my network with <a href="https://weatherflow.github.io/Tempest/api/udp.html" target="_blank" rel="noopener">UDP listener API</a>.</p>
<p>Yes. Now we&#8217;re talking. APIs. Raw data. Wireless. Weather data. All that means &#8220;How can I use my data to make charts and graphs!&#8221;</p>
<h2>Logs Into Metrics</h2>
<p>With any new project &#8211; it&#8217;s always best to start and see what other great work has already been shared with the <a href="https://community.weatherflow.com/" target="_blank" rel="noopener">community</a>. I found a great InfluxDB listener from Vince Skahan called <a href="https://github.com/vinceskahan/weatherflow-udp-listener" target="_blank" rel="noopener">weatherflow-udp-listener</a>. I made the first set of <a href="https://grafana.com/grafana/dashboards?search=weatherflow&amp;dataSource=influxdb" target="_blank" rel="noopener">Grafana dashboards</a> that used his system, which worked well. But as much as I loved Vince&#8217;s efforts &#8211; the project isn&#8217;t currently supported (but should work just fine for the foreseeable future&#8230;)</p>
<p>I wanted to work with the raw JSON logs being streamed over UDP from the Tempest to the WeatherFlow hub. I needed a way to collect those JSON logs and push them into a logging system that provides long-term storage AND a way to turn <strong>logs into metrics</strong>. What better solution than <a href="https://grafana.com/oss/loki/" target="_blank" rel="noopener">Grafana&#8217;s Loki</a> log aggregation system?</p>
<h2>JSON Logs</h2>
<p>The WeatherFlow hub sends JSON logs broadcast over UDP port 50222 on my local network. Based on the <a href="https://weatherflow.github.io/Tempest/api/udp.html" target="_blank" rel="noopener">WeatherFlow Tempest UDP Reference</a>, these logs can be broken out by type (among a few other measurements):</p>
<p><strong>obs_st (Observation &#8211; Tempest)</strong></p>
<pre>{"serial_number":"ST-00028209","type":"obs_st","hub_sn":"HB-00038302","obs":[[1613934241,0.00,1.34,5.45,93,3,988.74,9.39,28.68,7761,0.23,65,0.000000,0,0,0,2.808,1]],"firmware_revision":134}</pre>
<p><strong>device_status</strong></p>
<pre>{"serial_number":"ST-00028209","type":"device_status","hub_sn":"HB-00038302","timestamp":1613934241,"uptime":1478650,"voltage":2.81,"firmware_revision":134,"rssi":-69,"hub_rssi":-66,"sensor_status":0,"debug":0}</pre>
<p><strong>hub_status</strong></p>
<pre>{"serial_number":"HB-00038302","type":"hub_status","firmware_revision":"160","uptime":895935,"rssi":-39,"timestamp":1613934260,"reset_flags":"PIN,SFT","seq":89486,"fs":[1,0,15675411,524288],"radio_stats":[25,1,0,3,4248],"mqtt_stats":[119,29]}</pre>
<p><strong>rapid_wind</strong></p>
<pre>{"serial_number":"ST-00028209","type":"rapid_wind","hub_sn":"HB-00038302","ob":[1613934245,0.67,152]}</pre>
<p>Using a slightly modified weatherflow-listener.py script (from P-Doyle&#8217;s <a href="https://github.com/p-doyle/Simple-WeatherFlow-Python-Listener" target="_blank" rel="noopener">Simple-WeatherFlow-Python-Listener</a>), I could use the following command to send the broadcast JSON logs into Loki via Promtail.</p>
<pre>/usr/bin/stdbuf -oL /usr/bin/python weatherflow-listener.py <span class="pl-k">|</span> /usr/bin/promtail --stdin --client.url http://loki:3100/loki/api/v1/push --client.external-labels=app=weatherflow,hostname=weatherflow</pre>
<p><em>(Using stdbuf here to reduce the STDOUT/STDIN buffer wait&#8230;)</em></p>
<p>Once the logs are in Grafana Loki &#8211; I used Loki&#8217;s LogQL to crack open some of the JSON arrays into useful metrics:</p>
<pre>max(max_over_time({app="weatherflow"} |= "obs_st" | json obs_Air_Temperature="obs[0][7]" | unwrap obs_Air_Temperature | __error__="" [$__interval])) * 9/5 + 32</pre>
<p><img decoding="async" class="alignnone wp-image-248 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query.png" alt="" width="1162" height="674" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query.png 1162w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query-300x174.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query-1024x594.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-loki_query-768x445.png 768w" sizes="(max-width: 1162px) 100vw, 1162px" /></p>
<p>Using the WeatherFlow UDP API as a guide, I made metrics from each of the index values:</p>
<div class="doc-section">
<h4>Observation Value Layout</h4>
<table>
<tbody>
<tr>
<th>Index</th>
<th>Field</th>
<th>Units</th>
</tr>
<tr>
<td>0</td>
<td>Time Epoch</td>
<td>Seconds</td>
</tr>
<tr>
<td>1</td>
<td>Wind Lull (minimum 3 second sample)</td>
<td>m/s</td>
</tr>
<tr>
<td>2</td>
<td>Wind Avg (average over report interval)</td>
<td>m/s</td>
</tr>
<tr>
<td>3</td>
<td>Wind Gust (maximum 3 second sample)</td>
<td>m/s</td>
</tr>
<tr>
<td>4</td>
<td>Wind Direction</td>
<td>Degrees</td>
</tr>
<tr>
<td>5</td>
<td>Wind Sample Interval</td>
<td>seconds</td>
</tr>
<tr>
<td>6</td>
<td>Station Pressure</td>
<td>MB</td>
</tr>
<tr>
<td>7</td>
<td>Air Temperature</td>
<td>C</td>
</tr>
<tr>
<td>8</td>
<td>Relative Humidity</td>
<td>%</td>
</tr>
<tr>
<td>9</td>
<td>Illuminance</td>
<td>Lux</td>
</tr>
<tr>
<td>10</td>
<td>UV</td>
<td>Index</td>
</tr>
<tr>
<td>11</td>
<td>Solar Radiation</td>
<td>W/m^2</td>
</tr>
<tr>
<td>12</td>
<td>Precip Accumulated</td>
<td>mm</td>
</tr>
<tr>
<td>13</td>
<td>Precipitation Type</td>
<td>0 = none, 1 = rain, 2 = hail</td>
</tr>
<tr>
<td>14</td>
<td>Lightning Strike Avg Distance</td>
<td>km</td>
</tr>
<tr>
<td>15</td>
<td>Lightning Strike Count</td>
<td></td>
</tr>
<tr>
<td>16</td>
<td>Battery</td>
<td>Volts</td>
</tr>
<tr>
<td>17</td>
<td>Report Interval</td>
<td>Minutes</td>
</tr>
</tbody>
</table>
</div>
<h2>Grafana Dashboards</h2>
<p><img decoding="async" class="alignnone wp-image-255 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog.png" alt="" width="2452" height="860" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog.png 2452w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-300x105.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-1024x359.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-768x269.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-1536x539.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-today_so_far_blog-2048x718.png 2048w" sizes="(max-width: 2452px) 100vw, 2452px" /></p>
<p><img decoding="async" class="alignnone wp-image-253 size-full" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog.png" alt="" width="4904" height="1266" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog.png 4904w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-300x77.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-1024x264.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-768x198.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-1536x397.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-weatherflow-device_details_blog-2048x529.png 2048w" sizes="(max-width: 4904px) 100vw, 4904px" /></p>
<p>The rest of my efforts were turning those metrics into usable information &#8211; coming up with an Overview, Today So Far, and a Device Details set of Grafana dashboards.</p>
<p><img decoding="async" class="alignnone size-full wp-image-211" src="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title.png" alt="" width="874" height="456" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title.png 874w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title-300x157.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/02/weatherflow-dashboards-aio-title-768x401.png 768w" sizes="(max-width: 874px) 100vw, 874px" /></p>
<p>Like my previous <a href="https://labs.lux4rd0.com/2021/01/oldskool-syslog-meets-newskool-loki/">Loki Syslog All-In-One project</a> &#8211; I created an All-In-One project for this WeatherFlow collector. Details on installing your own collector, including all the files needed to download, are over at my <a href="https://github.com/lux4rd0/weatherflow-dashboards-aio" target="_blank" rel="noopener">WeatherFlow Dashboards AIO</a> Github repository. These dashboards are also available in Grafana&#8217;s Community <a href="https://grafana.com/grafana/dashboards?search=weatherflow&amp;dataSource=loki" target="_blank" rel="noopener">Dashboards</a>. With some help from P-Doyle&#8217;s <a href="https://github.com/p-doyle/Simple-WeatherFlow-Python-Listener" target="_blank" rel="noopener">Simple-WeatherFlow-Python-Listener</a> and <a href="https://grafana.com/docs/loki/latest/clients/promtail/" target="_blank" rel="noopener">Promtail</a> &#8211; you too can deploy a quick and easy WeatherFlow log collector with Grafana Loki and Grafana dashboards.</p>
<p>If you&#8217;re a WeatherFlow fan, I&#8217;d love any feedback on how this works. If you&#8217;d like to share your dashboards, I&#8217;d happily include them here to share with the community!</p>
<p><a href="https://grafana.lux4rd0.com/d/lux4rd0labs_weatherflow_loki_01/weatherflow-overview" target="_blank" rel="noopener">These dashboards</a> are also part of my Internet-facing set of current <a href="https://labs.lux4rd0.com/grafana/" target="_blank" rel="noopener">Grafana</a> dashboards. Enjoy!!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://labs.lux4rd0.com/2021/02/weatherflow-tempest-log-collector/feed/</wfw:commentRss>
			<slash:comments>22</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">197</post-id>	</item>
		<item>
		<title>Oldskool (Syslog) Meets Newskool (Loki)</title>
		<link>https://labs.lux4rd0.com/2021/01/oldskool-syslog-meets-newskool-loki/</link>
					<comments>https://labs.lux4rd0.com/2021/01/oldskool-syslog-meets-newskool-loki/#comments</comments>
		
		<dc:creator><![CDATA[Dave Schmid]]></dc:creator>
		<pubDate>Mon, 25 Jan 2021 15:00:45 +0000</pubDate>
				<category><![CDATA[Grafana]]></category>
		<category><![CDATA[Loki]]></category>
		<guid isPermaLink="false">https://labs.lux4rd0.com/?p=151</guid>

					<description><![CDATA[I&#8217;ll be the first to admit I&#8217;ve always been a metrics person. Charts and graphs through and through. Almost to a fault &#8211; I largely ignored logs. That&#8217;s not to say I haven&#8217;t combed through my fair share of application logs across hundreds of endpoints. Do you remember the days of creating shared NAS exports [&#8230;]]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignnone size-large wp-image-160" src="https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_overview-1024x595.png" alt="Loki Syslog Overview" width="720" height="418" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_overview-1024x595.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_overview-300x174.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_overview-768x446.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_overview-1536x893.png 1536w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_overview-2048x1190.png 2048w" sizes="(max-width: 720px) 100vw, 720px" /></p>
<p>I&#8217;ll be the first to admit I&#8217;ve always been a metrics person. Charts and graphs through and through. Almost to a fault &#8211; I largely ignored logs. That&#8217;s not to say I haven&#8217;t combed through my fair share of application logs across hundreds of endpoints. Do you remember the days of creating shared NAS exports and just writing out logs until they filled up? (Yeah &#8211; me neither… ahem…) But recently, two things have come to light in the last few months that make this hopefully an exciting story to tell. One, I discovered <a href="https://grafana.com/oss/loki/" target="_blank" rel="noopener">Loki</a>, Grafana&#8217;s log aggregation system. And two, I have a handful of home lab servers, an increasingly complex network, and storage devices that are hard to see what they&#8217;re doing all the time. My initial challenge involved understanding why my wireless devices had intermittent network instability and which (if any) of my wireless access points had the most issues. But all I had to work with was Syslog.</p>
<p>A search on Google for &#8220;Syslog Collector&#8221; presented me with 342,000 results to start my effort. Most of the attention-grabbing &#8220;6 Free Syslog Servers&#8221; links turned into a fair number of Windows utilities, but each is still pretty limited to just a few hosts at a time. I needed to collect data from over a dozen systems and run on Linux and MacOS. What I needed was some Open Source goodness.</p>
<h2>This now becomes a tale of how I came to love logs.</h2>
<h2>And Loki. &lt;3</h2>
<p>My first exposure to <a href="https://grafana.com/oss/loki/" target="_blank" rel="noopener">Loki</a> came recently during my <a href="https://labs.lux4rd0.com/2020/11/journey-into-grafana/">first days</a> at <a href="https://grafana.com/" target="_blank" rel="noopener">Grafana Labs</a>. Presented with a fantastic way to discover and consume logs in relationship to <a href="https://grafana.com/oss/prometheus/" target="_blank" rel="noopener">Prometheus</a> and <a href="https://kubernetes.io/" target="_blank" rel="noopener">Kubernetes</a> with microservices &#8211; it didn&#8217;t immediately occur to me to capture standalone network logs with Loki in this same fashion. And so I set out to see what I could accomplish.</p>
<p>Loki is <em>relatively easy to deploy</em> as a single binary via the command line or <a href="https://grafana.com/docs/loki/latest/installation/docker/" target="_blank" rel="noopener">Docker</a>. One of the primary ways to get logs into Loki is using Promtail, which is also easily deployed the same way. I jumped into docker-compose (even with Loki&#8217;s roots coming from Prometheus and Kubernetes &#8211; I&#8217;m looking to build out essentially a quick start standalone Syslog ingester.)</p>
<p>A look through some of the <a href="https://grafana.com/docs/loki/latest/clients/promtail/configuration/#syslog" target="_blank" rel="noopener">Loki documentation</a> on configuring Promtail with Syslog had me realize that Promtail only works with IETF Syslog (RFC5424) &#8211; which is how I also found out my devices were limited to only RFC3164. Time to look at <a href="https://www.syslog-ng.com/" target="_blank" rel="noopener">syslog-ng</a>!!</p>
<p>What&#8217;s valuable about syslog-ng in my situation is that it can be spun up to listen for RFC3164 (UDP port 514) and then forward it to Promtail RFC5424 on port 1514. (Many of my devices only output the older style of Syslog&#8230;) I needed to do a few quick configurations to get syslog-ng and Promtail talking to each other!</p>
<h3>syslog-ng Configuration</h3>
<pre><strong># syslog-ng.conf</strong>

source s_local {
    internal();
};

source s_network {
    default-network-drivers(
    );
};

destination d_loki {
    syslog("promtail" transport("tcp") port("1514"));
};

log {
        source(s_local);
        source(s_network);
        destination(d_loki);
};
</pre>
<h3>Promtail Configuration</h3>
<pre><strong>
# promtail-config.yml</strong>

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://loki:3100/loki/api/v1/push

scrape_configs:

- job_name: syslog
  syslog:
    listen_address: 0.0.0.0:1514
    idle_timeout: 60s
    label_structured_data: yes
    labels:
      job: "syslog"
  relabel_configs:
    - source_labels: ['__syslog_message_hostname']
      target_label: 'host'
</pre>
<p>The relabeling in Promtail takes the hostname of the sending device into syslog-ng and turns it into a host label for Loki to index. Within a few minutes, all of my hosts were streaming Syslog from my network into Loki and explorable within <a href="https://grafana.com/oss/grafana/" target="_blank" rel="noopener">Grafana</a>!</p>
<p>Now &#8211; around this same time, Loki 2.0 was released. Ward Bekker had just presented to our team some of the launch efforts and dashboard examples he worked on when I heard him say to me&#8230;</p>
<blockquote><p><em>&#8220;Dave &#8211; look how easy it is to turn logs into metrics!&#8221; ~ <a href="https://grafana.com/author/ward/" target="_blank" rel="noopener">Ward Bekker</a></em></p></blockquote>
<p>Ward &#8211; you have my attention!! At this point, I expedited my efforts to build a dashboard that combined how easy it was to gather my logs into an even easier way to sort, search, filter, and present helpful information with dashboards showing all device logs.</p>
<p>Within a few minutes, I had a working dashboard to configure a drop-down of pre-defined search terms or use a free-form search for items in my logs. Then, I applied the &#8220;logs to metrics&#8221; magic and presented group summaries of counts by wireless access points!</p>
<p><img decoding="async" class="alignnone size-large wp-image-165" src="https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_first_dashboard-1024x601.png" alt="Loki First Dashboard" width="720" height="423" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_first_dashboard-1024x601.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_first_dashboard-300x176.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_first_dashboard-768x450.png 768w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_first_dashboard.png 1064w" sizes="(max-width: 720px) 100vw, 720px" /></p>
<p><em>Oh yeah &#8211; my first LogQL query!! Showing the number of logs over time filtered by hostname (host= &#8220;$hostname&#8221;), coming from my Syslog Promtail job (job= &#8220;syslog&#8221;), with a free-form search query string from my Grafana variable ($filter).</em></p>
<pre>count_over_time({host=~"$hostname", job="syslog"}[$__interval] |="$filter”)</pre>
<p>With a bit more dashboard usability tweaking, I could visualize other types of logging from my gateway devices, server IPMI stats, and NAS details &#8211; all available to scroll back through time. And finally &#8211; building out alerting for threshold breaching (yes… logs into metrics!! More on alerting in a follow-up post.)</p>
<p>So, while a pretty simple example of how I got started with Loki and my logging journey &#8211; I believe it represents how quick and easy it is to connect Open Source solutions to solve immediate problems &#8211; even in a home lab situation.</p>
<p>I also wanted to share these configurations, and what better way to do that than with a kind of &#8220;All In One&#8221; docker-compose project? So, I present to you the following:</p>
<h2>Grafana Loki Syslog All-In-One Project</h2>
<p><img decoding="async" class="alignnone size-full wp-image-168" src="https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_aio.png" alt="Loki Syslog AIO" width="1270" height="298" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_aio.png 1270w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_aio-300x70.png 300w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_aio-1024x240.png 1024w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/loki_syslog_aio-768x180.png 768w" sizes="(max-width: 1270px) 100vw, 1270px" /></p>
<p>This quick example project allows you to run these services with docker-compose on a Linux server. Point your network devices at (hostname:514) and log into Grafana (hostname:3000) and you&#8217;ll be presented with the &#8220;Loki Syslog AIO &#8211; Overview&#8221; dashboard. For those of you who want to see some of the behind-the-scenes details, I&#8217;ve included some prebuilt performance overview dashboards for each of the primary services (Grafana, Loki, MinIO, Docker, and host metrics.) You&#8217;ll see dropdown links to the &#8220;Performance Overview&#8221; at the top of the Loki Syslog AIO &#8211; Overview dashboard, including links to get you back to the starting dashboard. If you don&#8217;t have Syslog devices immediately available but want to try the dashboard out &#8211; I also built an optional Syslog Generator container.</p>
<p>Check out my <a href="https://github.com/lux4rd0/grafana-loki-syslog-aio" target="_blank" rel="noopener">Grafana Loki Syslog AIO GitHub</a> repository for more setup details and downloads. My example, Loki Dashboard, is available in Grafana&#8217;s <a href="https://grafana.com/grafana/dashboards/13766" target="_blank" rel="noopener">Community Dashboards</a>.</p>
<p>And yes &#8211; I did figure out that my dropped connections were related to high DHCP retries and too aggressive of settings on my minimum data rate controls. Now I know! Thanks, Loki!!</p>
<p><img decoding="async" class="size-medium wp-image-177 aligncenter" src="https://labs.lux4rd0.com/wp-content/uploads/2021/01/Grafana_Loki_Icon-258x300.png" alt="Grafana Loki Icon" width="258" height="300" srcset="https://labs.lux4rd0.com/wp-content/uploads/2021/01/Grafana_Loki_Icon-258x300.png 258w, https://labs.lux4rd0.com/wp-content/uploads/2021/01/Grafana_Loki_Icon.png 427w" sizes="(max-width: 258px) 100vw, 258px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://labs.lux4rd0.com/2021/01/oldskool-syslog-meets-newskool-loki/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">151</post-id>	</item>
		<item>
		<title>Journey Into Grafana</title>
		<link>https://labs.lux4rd0.com/2020/11/journey-into-grafana/</link>
					<comments>https://labs.lux4rd0.com/2020/11/journey-into-grafana/#comments</comments>
		
		<dc:creator><![CDATA[Dave Schmid]]></dc:creator>
		<pubDate>Mon, 30 Nov 2020 15:42:05 +0000</pubDate>
				<category><![CDATA[Grafana]]></category>
		<category><![CDATA[Video]]></category>
		<guid isPermaLink="false">https://labs.lux4rd0.com/?p=98</guid>

					<description><![CDATA[For me, joining the Solutions Engineering team at Grafana is a continuation of embracing change and enjoying my professional journey. As I look back over my first several months here, I wanted to share a bit of my own journey and a few thoughts on what I’m most looking forward to.]]></description>
										<content:encoded><![CDATA[<blockquote><p>“You cannot step into the same river twice, for other waters are continually flowing on.” ~ Heraclitus</p></blockquote>
<p>I stumbled upon that analogy some time back, and I think it&#8217;s a good way of talking about change. For me, joining the Solutions Engineering team at Grafana is a continuation of embracing change and enjoying my professional journey. As I look back over my first several months here, I wanted to share some of my journey and a few thoughts on what I&#8217;m most looking forward to.</p>
<h1>How My Journey Started</h1>
<ul>
<li>I&#8217;ve been running metrics since the days of Perl scripts and RRD Graphs (Hats off to <a href="https://cacti.net/">Cacti</a>). I started in Enterprise IT when I worked at Citigroup and started accelerating with building a fantastic APM team using BMC Patrol and Precise APM.</li>
<li>Opportunity to launch my Sales Engineering career by joining HP Software with solutions from their Mercury Interactive acquisition with HP Business Service Management.</li>
<li>Some time with <a href="https://www.bmc.com/">BMC Software</a> with their ITSM and Cloud solutions. <em>(Always Remedy Green!)</em></li>
<li>Last three years deep into APM with <a href="https://www.appdynamics.com/">Cisco AppDynamics</a>.</li>
<li>This led to the opportunity to join <a href="https://grafana.com/">Grafana Labs</a> this year and help drive the adoption of Grafana&#8217;s Observability Stack of metrics, logs, and tracing.</li>
</ul>
<h1>Since Arriving At Grafana</h1>
<p>Everybody at Grafana deeply believes that data and its visualization should be easy to use, understand, and act upon by all. As an open-source software startup company, Grafana delivers on sharing opening and transparently.</p>
<p>Our team is the most energized, thoughtful, and empowered stewards of &#8220;All Things Grafana.&#8221; But it extends beyond our namesake. It&#8217;s compelling open-source solutions to big problems facing today&#8217;s Observability efforts, and we lead our community and customers with consultative guidance on solving real visibility issues.</p>
<h1>We Love Visualizing Data!!</h1>
<div class="audiotheme-embed"><iframe title="Journey Into Grafana" width="720" height="405" src="https://www.youtube.com/embed/XUPRqn7fLm8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe></div>
<p>I published a <a href="https://youtu.be/XUPRqn7fLm8" target="_blank" rel="noopener noreferrer">quick video</a> showcasing some of the Grafana Dashboards I built along my Journey Into Grafana. (With a great excuse to write some new music as well!!) The dashboards include:</p>
<ul>
<li>IoT Temperature Sensors</li>
<li>Real-Time Energy Usage</li>
<li><a href="https://pi-hole.net/">Pi-hole DNS Sinkhole</a></li>
<li>Financial Markets</li>
<li>Per IP Internet Bandwidth Usage</li>
<li>NTP Offset</li>
<li><a href="https://grafana.com/oss/loki/">Loki Metrics From Logs</a> (Thanks <a href="https://grafana.com/author/ward/">Ward</a>!!)</li>
<li><a href="https://grafana.com/grafana/plugins/grafana-synthetic-monitoring-app">Synthetic Blackbox Monitoring</a></li>
</ul>
<p><em>(I&#8217;ll publish some follow-up blog posts on these dashboards and data exporters shortly&#8230;)</em></p>
<h1>What Does the Future of Grafana Look Like?</h1>
<p>First, it&#8217;s the continuing acceleration of compelling and valuable adoption across all our solutions, <a href="https://grafana.com/oss/grafana/" target="_blank" rel="noopener noreferrer">Grafana</a>, <a href="https://grafana.com/oss/loki/" target="_blank" rel="noopener noreferrer">Loki</a>, and our recently released <a href="https://grafana.com/oss/tempo/" target="_blank" rel="noopener noreferrer">Tempo</a>. Grafana releases every few months, and I can tell you that we cover all parts of our community open-source platforms and our Enterprise products.</p>
<p>Cloud-native is accelerating at a ferocious pace. That means delivering platforms that scale to collect and visualize high velocity, fine-grained observability that is a critical underpinning for everything we do. It&#8217;s about thinking differently and having diverse and inclusive relationships with our teams, community, and customers.</p>
<p>Growth. My journey to Grafana was based on great culture and the ability to deliver amazing and collaborative outcomes across our organization personally. From Engineering and Marketing to Sales and Solutions Engineering &#8211; Grafana has incredible opportunities for great candidates worldwide. Please reach out and be part of our great team!</p>
<h1>Thanks!</h1>
<p>I&#8217;m fortunate to have many great friends, family, colleagues, and customers who have joined me along my incredible journey. I look forward to sharing with the community what makes Grafana such a respected and loved solution.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://labs.lux4rd0.com/2020/11/journey-into-grafana/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">98</post-id>	</item>
	</channel>
</rss>
