<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: sqshq</title>
    <description>The latest articles on Forem by sqshq (@sqshq).</description>
    <link>https://forem.com/sqshq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F204230%2Fbf3b2c6d-8705-4f26-9128-048ac5327442.png</url>
      <title>Forem: sqshq</title>
      <link>https://forem.com/sqshq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sqshq"/>
    <language>en</language>
    <item>
      <title>Sampler. Dashboards, monitoring and alerting — right from your terminal</title>
      <dc:creator>sqshq</dc:creator>
      <pubDate>Mon, 19 Aug 2019 14:35:30 +0000</pubDate>
      <link>https://forem.com/sqshq/sampler-dashboards-monitoring-and-alerting-right-from-your-terminal-5h5e</link>
      <guid>https://forem.com/sqshq/sampler-dashboards-monitoring-and-alerting-right-from-your-terminal-5h5e</guid>
      <description>&lt;p&gt;As a backend developer, I always need to monitor something. State machine in the database, records count, message queue lag, custom application metrics, system performance, progress of my deployment scripts. Tons of stuff!&lt;/p&gt;

&lt;p&gt;For a long time I was trying to find a tool which can save me time — will be able to keep everything in one place, and notify me when needed. Heavy production monitoring systems can't help with the development tasks, I needed a swiss army knife - something that can be configured in a minute and give me the results right away.&lt;/p&gt;

&lt;p&gt;There were no such thing, so I wrote my own. Meet &lt;a href="https://github.com/sqshq/sampler" rel="noopener noreferrer"&gt;Sampler&lt;/a&gt; - command-line UI for any shell commands, written in pure Go.&lt;/p&gt;

&lt;p&gt;To install, follow the &lt;a href="https://github.com/sqshq/sampler#installation" rel="noopener noreferrer"&gt;instructions for macOS, Linux or Windows&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  How does it work?
&lt;/h1&gt;

&lt;p&gt;The idea is very simple - almost all metrics you might want to monitor and visualize are available via CLI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The basics: CPU, memory, disk space, network&lt;/li&gt;
&lt;li&gt;Telemetry from a remote machine via SSH&lt;/li&gt;
&lt;li&gt;Any database metrics and results of your custom queries&lt;/li&gt;
&lt;li&gt;Kafka, RabbitMQ, ActiveMQ&lt;/li&gt;
&lt;li&gt;K8s RAM/CPU/events&lt;/li&gt;
&lt;li&gt;Everything available via http, e.g. Spring Boot Actuator metrics&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;JMX&lt;/li&gt;
&lt;li&gt;Logs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That means we can create our dashboards without complex integrations, drivers and dependencies. We can do it right from the terminal.&lt;/p&gt;

&lt;p&gt;Using Sampler is basically a 3-step process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define your configuration in a YAML file&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;sampler -c your-config-file.yml&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Adjust components size and location on UI&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Examples
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;Visualizations and their YAML configuration&lt;/em&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Runcharts
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0vbpe1lcxbio8d9aopg6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F0vbpe1lcxbio8d9aopg6.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;runcharts:
  - title: Search engine response time
    rate-ms: 500        # sampling rate, default = 1000
    scale: 2            # number of digits after sample decimal point, default = 1
    legend:
      enabled: true     # enables item labels, default = true
      details: false    # enables item statistics: cur/min/max/dlt values, default = true
    items:
      - label: GOOGLE
        sample: curl -o /dev/null -s -w '%{time_total}'  https://www.google.com
        color: 178      # 8-bit color number, default one is chosen from a pre-defined palette
      - label: YAHOO
        sample: curl -o /dev/null -s -w '%{time_total}'  https://search.yahoo.com
      - label: BING
        sample: curl -o /dev/null -s -w '%{time_total}'  https://www.bing.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Sparklines
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fjr8uhug26vfko7wh9oum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fjr8uhug26vfko7wh9oum.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sparklines:
  - title: CPU usage
    rate-ms: 200
    scale: 0
    sample: ps -A -o %cpu | awk '{s+=$1} END {print s}'
  - title: Free memory pages
    rate-ms: 200
    scale: 0
    sample: memory_pressure | grep 'Pages free' | awk '{print $3}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Barcharts
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1x1208djpokcx7eio3gq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F1x1208djpokcx7eio3gq.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;barcharts:
  - title: Local network activity
    rate-ms: 500        # sampling rate, default = 1000
    scale: 0            # number of digits after sample decimal point, default = 1
    items:
      - label: UDP bytes in
        sample: nettop -J bytes_in -l 1 -m udp | awk '{sum += $4} END {print sum}'
      - label: UDP bytes out
        sample: nettop -J bytes_out -l 1 -m udp | awk '{sum += $4} END {print sum}'
      - label: TCP bytes in
        sample: nettop -J bytes_in -l 1 -m tcp | awk '{sum += $4} END {print sum}'
      - label: TCP bytes out
        sample: nettop -J bytes_out -l 1 -m tcp | awk '{sum += $4} END {print sum}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Gauges
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6a0chaxep5cr80a4rwqg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F6a0chaxep5cr80a4rwqg.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gauges:
  - title: Minute progress
    rate-ms: 500        # sampling rate, default = 1000
    scale: 2            # number of digits after sample decimal point, default = 1
    percent-only: false # toggle display of the current value, default = false
    color: 178          # 8-bit color number, default one is chosen from a pre-defined palette
    cur:
      sample: date +%S  # sample script for current value
    max:
      sample: echo 60   # sample script for max value
    min:
      sample: echo 0    # sample script for min value
  - title: Year progress
    cur:
      sample: date +%j
    max:
      sample: echo 365
    min:
      sample: echo 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Textboxes
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F05fs3bqpy8b0yxplt6le.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F05fs3bqpy8b0yxplt6le.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;textboxes:
  - title: Local weather
    rate-ms: 10000      # sampling rate, default = 1000
    sample: curl wttr.in?0ATQF
    border: false       # border around the item, default = true
    color: 178          # 8-bit color number, default is white
  - title: Docker containers stats
    rate-ms: 500
    sample: docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}\t{{.PIDs}}"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Asciiboxes
&lt;/h5&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3gpa8yoiuyw54b385ck3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3gpa8yoiuyw54b385ck3.png"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;asciiboxes:
  - title: UTC time
    rate-ms: 500        # sampling rate, default = 1000
    font: 3d            # font type, default = 2d
    border: false       # border around the item, default = true    
    color: 43           # 8-bit color number, default is white
    sample: env TZ=UTC date +%r
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  There is more!
&lt;/h1&gt;

&lt;p&gt;Interactive shell support, PTY mode, triggers, alerts and variables. Real-world  recipes to work with MySQL, PostgreSQL, MongoDB, Neo4J, Kafka, SSH and JMX. You can read about advanced capabilities &lt;a href="https://github.com/sqshq/sampler" rel="noopener noreferrer"&gt;in the documentation&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Don't hesitate to ask questions, contribute and ⭐ star ⭐ the project &lt;a href="https://github.com/sqshq/sampler" rel="noopener noreferrer"&gt;on Github&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>bash</category>
      <category>productivity</category>
      <category>go</category>
    </item>
  </channel>
</rss>
