<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Munin – Yeri Tiete</title>
    <link>https://yeri.be/tag/munin/</link>
    <description>Yeri Tiete&#39;s blog</description>
    <language>en</language>
    <copyright>© Yeri Tiete</copyright>
    <lastBuildDate>Sun, 09 Feb 2014 14:13:32 +0100</lastBuildDate>
    <atom:link href="https://yeri.be/tag/munin/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Munin &#43; Raspberry Pi &#43; temperature: updated</title>
      <link>https://yeri.be/munin-raspberry-pi-temperature-updated/</link>
      <pubDate>Sun, 09 Feb 2014 14:13:32 +0100</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/munin-raspberry-pi-temperature-updated/</guid>
      <description>&lt;p&gt;I got a mail in my inbox about a week ago from &lt;a href=&#34;https://web.archive.org/web/20130817065743/http://blog.glag.la/&#34; target=&#34;_blank&#34; rel=&#34;noopener noreferrer&#34;&gt;Anthony&lt;/a&gt;, telling me how to improve my &lt;a href=&#34;https://yeri.be/munin-raspberry-pi-temperature&#34;&gt;Munin &amp;amp; temp&lt;/a&gt; script for a RPi:&lt;/p&gt;&#xA;&lt;blockquote&gt;Hi,&#xA;&lt;p&gt;I just read your (old) blog post about monitoring the temperature of the Raspberry Pi with munin[1].&lt;/p&gt;&#xA;&lt;p&gt;I had the exact same error as you did when I was trying to let munin do the job all by himself:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;temp.value VCHI initialization failed)&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;It turns out the solution was quite easy: in&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>I got a mail in my inbox about a week ago from <a href="https://web.archive.org/web/20130817065743/http://blog.glag.la/" target="_blank" rel="noopener noreferrer">Anthony</a>, telling me how to improve my <a href="https://yeri.be/munin-raspberry-pi-temperature">Munin &amp; temp</a> script for a RPi:</p>
<blockquote>Hi,
<p>I just read your (old) blog post about monitoring the temperature of the Raspberry Pi with munin[1].</p>
<p>I had the exact same error as you did when I was trying to let munin do the job all by himself:</p>
<blockquote>
<p>temp.value VCHI initialization failed)</p>
</blockquote>
<p>It turns out the solution was quite easy: in</p>
<p>/etc/munin/plugin-conf.d/munin-node</p>
<p>You simply need to tell munin that it needs to run as root for this specific plugin:</p>
<blockquote>
<p>[pisense_]</p>
</blockquote>
<blockquote>
<p>user root</p>
</blockquote>
<p>(the plugins also tracks clock speeds and voltages but any other will work just fine as long as the &ldquo;user root&rdquo; is set in the munin-node plugin config file : [2]). Probably the easiest way to check if it&rsquo;s working is to use munin-run command before and after the change.</p>
<p>&ldquo;Demo&rdquo;: [3]</p>
<p>By the way, &ldquo;Connect different LANs over openVPN&rdquo; is pretty tempting, I always wondered what the performances would be like through a USB-to-ethernet adapter.</p>
<p>Have a nice one !</p>
<p>Apteno</p>
<p>[1] <a href="https://yeri.be/munin-raspberry-pi-temperature"><a href="https://yeri.be/munin-raspberry-pi-temperature">https://yeri.be/munin-raspberry-pi-temperature</a></a>
[2] <a href="https://github.com/perception101/pisense/blob/master/pisense_"><a href="https://github.com/perception101/pisense/blob/master/pisense" target="_blank" rel="noopener noreferrer">https://github.com/perception101/pisense/blob/master/pisense</a>_</a>
[3] <a href="http://ronon.jefter.com/jefter.com/adama.jefter.com/index.html#sensors"><a href="http://ronon.jefter.com/jefter.com/adama.jefter.com/index.html#sensors" target="_blank" rel="noopener noreferrer">http://ronon.jefter.com/jefter.com/adama.jefter.com/index.html#sensors</a></a></blockquote></p>
<p>And indeed, I knew it was a permission issue, but instead of running this script as root, I tried adding Munin to a group that was supposed to be able to run  <code>vcgencmd</code> (which didn&rsquo;t work out).</p>
<p>But, let&rsquo;s look at a simpler solution:</p>
<ol>
    <li>Go to <code>/etc/munin/plugins</code> and create a file <code>temp</code> with this content (and some indentation yourself):
<pre>#!/bin/sh
case $1 in
config)
<span style="line-height: 1.5em;">cat &lt;&lt;'EOM'
</span><span style="line-height: 1.5em;">graph_category system
</span><span style="line-height: 1.5em;">graph_title Temperature
</span>graph_vlabel temp
<span style="line-height: 1.5em;">temp.label Celsius
</span><span style="line-height: 1.5em;">EOM
</span>exit 0;;
esac
echo -n "temp.value "
/opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f2 | cut -d "'" -f1</pre>
</li>
    <li>As you noticed, this doesn't require any more scripts to run from cron (and thus, in case you used my <a href="https://yeri.be/munin-raspberry-pi-temperature">previous script</a>, remove it from cron)</li>
    <li>
<pre>chmod +x temp</pre>
</li>
    <li>Make sure it runs as root; in <code>/etc/munin/plugin-conf.d</code> create the file <code>temp.conf</code> with this content:
<pre>[temp]
user root</pre>
</li>
    <li><span style="line-height: 1.5em;">Test it:</span>
<pre><span style="line-height: 1.5em;"># munin-run temp
</span><span style="line-height: 1.5em;">temp.value 59.5</span></pre>
</li>
</ol>
<p>Tadaaaa. Simpler.</p>
<p>Thanks Anthony :)</p>
]]></content:encoded>
      <category>hardware</category><category>linux</category><category>software</category>
      <category>munin</category><category>raspberrypi</category>
    </item>
    
    <item>
      <title>Graph amount of OpenVPN users to Munin</title>
      <link>https://yeri.be/graph-amount-of-openvpn-users-to-munin/</link>
      <pubDate>Wed, 24 Jul 2013 11:08:20 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/graph-amount-of-openvpn-users-to-munin/</guid>
      <description>&lt;p&gt;Rather simple script. Using log file instead of management interface.&lt;/p&gt;&#xA;&lt;p style=&#34;text-align: center;&#34;&gt;&lt;a href=&#34;https://static.yeri.be/2013/07/vpnusers-day.png&#34;&gt;&lt;/a&gt;&lt;a href=&#34;https://static.yeri.be/2013/07/vpnusers-day.png&#34;&gt;&lt;img class=&#34;alignnone size-full wp-image-5160&#34; alt=&#34;vpnusers-day&#34; src=&#34;https://static.yeri.be/2013/07/vpnusers-day.png&#34; width=&#34;497&#34; height=&#34;292&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;Part has to run as Root (due to Munin most likely not having access to read the log files. Working with the management interface could solve this.&#xA;&lt;p&gt;Create &lt;strong&gt;/usr/local/bin/getVpnUsers.sh&lt;/strong&gt;:&lt;/p&gt;&#xA;&lt;pre&gt;#!/bin/bash&#xA;echo &#34;VPN.value `cat /var/log/openvpn-status.log | sed -e &#39;1,/Common Name/d&#39; | &#xA;sed -e &#39;/ROUTING TABLE/,$d&#39; | wc -l`&#34; &amp;gt; /tmp/.vpn_munin.txt&lt;/pre&gt;&#xA;&lt;p&gt;You can change the name of VPN.value to the VPN name and/or add multiple lines (each with a different NAME.value if you&amp;rsquo;re running more than one VPN user. Be sure to cat the right log file).&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Rather simple script. Using log file instead of management interface.</p>
<p style="text-align: center;"><a href="https://static.yeri.be/2013/07/vpnusers-day.png"></a><a href="https://static.yeri.be/2013/07/vpnusers-day.png"><img class="alignnone size-full wp-image-5160" alt="vpnusers-day" src="https://static.yeri.be/2013/07/vpnusers-day.png" width="497" height="292" /></a></p>
Part has to run as Root (due to Munin most likely not having access to read the log files. Working with the management interface could solve this.
<p>Create <strong>/usr/local/bin/getVpnUsers.sh</strong>:</p>
<pre>#!/bin/bash
echo "VPN.value `cat /var/log/openvpn-status.log | sed -e '1,/Common Name/d' | 
sed -e '/ROUTING TABLE/,$d' | wc -l`" &gt; /tmp/.vpn_munin.txt</pre>
<p>You can change the name of VPN.value to the VPN name and/or add multiple lines (each with a different NAME.value if you&rsquo;re running more than one VPN user. Be sure to cat the right log file).</p>
<p>And:</p>
<pre>chmod +x /usr/local/bin/getVpnUsers.sh</pre>
<p>Add this to root cron:</p>
<pre>*/5 * * * * /usr/local/bin/getVpnUsers.sh &gt;/dev/null 2&gt;&amp;1</pre>
<p>Now create<strong> /etc/munin/plugins/vpnusers</strong>:</p>
<pre>#!/bin/sh

case $1 in
 config)
 cat &lt;&lt;'EOM'
graph_category network
graph_title oVPN users
graph_vlabel users
VPN.label My oVPN
# add more labels like this:
#isazi.label Isazi VPN
EOM
 exit 0;;
esac

cat /tmp/.vpn_munin.txt</pre>
<p>And:</p>
<pre>chmod +x /etc/munin/plugins/vpnusers</pre>
<p>You&rsquo;ll need the correct NAME.label in the plugin depending on the name you choose in part one.</p>
<p>And restart munin-node:</p>
<pre>/etc/init.d/munin-node restart</pre>
<p>That&rsquo;s it.</p>
<p>Check your Munin under &ldquo;network&rdquo;. It might take ~15+ minutes before the graph is generated.</p>
<p><a href="https://static.yeri.be/2013/07/vpnusers-day-1.png"><img class="alignnone size-full wp-image-5161 aligncenter" alt="vpnusers-day-1" src="https://static.yeri.be/2013/07/vpnusers-day-1.png" width="497" height="280" /></a></p>
]]></content:encoded>
      <category>linux</category>
      <category>munin</category><category>openvpn</category>
    </item>
    
    <item>
      <title>Munin &#43; Raspberry Pi &#43; temperature</title>
      <link>https://yeri.be/munin-raspberry-pi-temperature/</link>
      <pubDate>Sun, 26 May 2013 17:18:09 +0200</pubDate>
      <author>Yeri Tiete</author>
      <guid isPermaLink="true">https://yeri.be/munin-raspberry-pi-temperature/</guid>
      <description>&lt;p&gt;Quick hack to get Munin to graph the cpu temperature.&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://static.yeri.be/2013/05/temp-day.png&#34;&gt;&lt;img class=&#34;alignnone size-full wp-image-5081 aligncenter&#34; alt=&#34;temp-day&#34; src=&#34;https://static.yeri.be/2013/05/temp-day.png&#34; width=&#34;497&#34; height=&#34;280&#34; /&gt;&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;First of all, install Munin and make sure it&amp;rsquo;s working.&lt;/p&gt;&#xA;&lt;p&gt;Then follow these steps:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;We&amp;rsquo;ll use cron to write the current temp to a log file. We do this because I wasn&amp;rsquo;t able to get Munin to directly execute the command (error: &lt;code&gt;temp.value VCHI initialization failed&lt;/code&gt;)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;Execute &lt;code&gt;crontab -e&lt;/code&gt; and add this line (this has to be on one line):&lt;/p&gt;</description>
      <content:encoded><![CDATA[<p>Quick hack to get Munin to graph the cpu temperature.</p>
<p><a href="https://static.yeri.be/2013/05/temp-day.png"><img class="alignnone size-full wp-image-5081 aligncenter" alt="temp-day" src="https://static.yeri.be/2013/05/temp-day.png" width="497" height="280" /></a></p>
<p>First of all, install Munin and make sure it&rsquo;s working.</p>
<p>Then follow these steps:</p>
<ol>
<li>We&rsquo;ll use cron to write the current temp to a log file. We do this because I wasn&rsquo;t able to get Munin to directly execute the command (error: <code>temp.value VCHI initialization failed</code>)</li>
</ol>
<p>Execute <code>crontab -e</code> and add this line (this has to be on one line):</p>
<p><code>*/5 * * * * /opt/vc/bin/vcgencmd measure_temp | cut -d &ldquo;=&rdquo; -f2 | cut -d &ldquo;&rsquo;&rdquo; -f1 &gt; /tmp/.temp</code></p>
<ol start="2">
<li>Go to <code>/etc/munin/plugins/</code>, and create a file <code>temp</code>, and add this content:</li>
</ol>
<p><code>#!/bin/sh
case $1 in
config)
cat &lt;&lt;&lsquo;EOM&rsquo;
graph_category system
graph_title Temperature
graph_vlabel temp
temp.label Celsius
EOM
exit 0;;
esac
echo -n &ldquo;temp.value &quot;
cat /tmp/.temp</code></p>
<p>Save and exit the editor.</p>
<p>I&rsquo;m not sure this is needed, but better do it: <code>chmod +x temp</code></p>
<ol start="3">
<li>
<p>restart munin-node (<code>/etc/init.d/munin-node restart</code>)</p>
</li>
<li>
<p>test if it&rsquo;s working:</p>
</li>
</ol>
<p><code># telnet localhost 4949
Trying 127.0.0.1&hellip;
Connected to localhost.
Escape character is &lsquo;^]&rsquo;.</p>
<h1 id="munin-node-at-industryyeribe">munin node at industry.yeri.be</h1>
<p>fetch temp
temp.value 57.3
.</code></p>
<p>That&rsquo;s it. Your munin daemon/host should now correctly graph the temperature.</p>
<p><span style="text-decoration: underline;">Edit</span> (8/2/2014): updated script can be found <a href="https://yeri.be/munin-raspberry-pi-temperature-updated">here</a>.</p>
]]></content:encoded>
      <category>hardware</category><category>linux</category><category>software</category>
      <category>munin</category><category>raspberrypi</category>
    </item>
    
  </channel>
</rss>
