<?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>mnemonic technology &#187; bsd</title>
	<atom:link href="http://blog.mnology.com/tags/bsd/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mnology.com</link>
	<description>technology assisting grey matter</description>
	<lastBuildDate>Tue, 05 Aug 2008 22:07:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unix System Monitoring with Symon, Symux and Syweb</title>
		<link>http://blog.mnology.com/20080630/unix-system-monitoring-with-symon-symux-and-syweb/</link>
		<comments>http://blog.mnology.com/20080630/unix-system-monitoring-with-symon-symux-and-syweb/#comments</comments>
		<pubDate>Mon, 30 Jun 2008 22:27:23 +0000</pubDate>
		<dc:creator>mnology</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bsd]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[openbsd]]></category>
		<category><![CDATA[symon]]></category>
		<category><![CDATA[symux]]></category>
		<category><![CDATA[sysadmin]]></category>
		<category><![CDATA[syweb]]></category>

		<guid isPermaLink="false">http://blog.mnology.com/?p=9</guid>
		<description><![CDATA[Syweb is an all in one package for displaying RRDtool data collected via Symon and Symux. These tools collect helpful data such has CPU usage, disk I/O usage and process resource usage. The screenshot shows the various devices and processes that I've decided I would like to monitor. As you can see it provides an [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.mnology.com/wp-content/uploads/2008/06/symon-statistics_1214862725959.png"><img class="alignleft size-medium wp-image-10" title="symon-statistics_1214862725959" src="http://blog.mnology.com/wp-content/uploads/2008/06/symon-statistics_1214862725959-156x300.png" alt="" width="156" height="300" /></a><a title="system monitor for FreeBSD, NetBSD, OpenBSD and Linux" href="http://www.xs4all.nl/~wpd/symon/index.html">Syweb </a>is an all in one package for displaying <a title="Wikipedia: RRDtool" href="http://en.wikipedia.org/wiki/RRDtool">RRDtool </a>data collected via Symon and Symux. These tools collect helpful data such has CPU usage, disk I/O usage and process resource usage. The screenshot shows the various devices and processes that I've decided I would like to monitor. As you can see it provides an at a glance view of resource usage on your server.</p>
<p>Let's start off by building and installing all three(Symon, Symux &amp; Syweb). You can do this using your systems package manager or <a title="Symon download" href="http://www.xs4all.nl/~wpd/symon/download.html">building from source</a>. I'll be installing from <a title="The OpenBSD packages and ports system" href="http://www.openbsd.org/faq/faq15.html">OpenBSD's ports</a> system.</p>
<p>Symux is the collection agent for the data generated by Symon and needs to be configured and running before we start Symon. However, Symon includes a script for scanning your system for devices to generate data on and creates a Symon configuration file. It's a bit of <a title="Wikipedia: Chicken or the Egg" href="http://en.wikipedia.org/wiki/Chicken_and_egg">chicken-and-egg</a> issue.</p>
<p>Now we'll execute the script for the Symon config so we have a basis of what our Symux config is going to look like. Locate <code>c_config.sh</code> script installed by the Symon package. In my installation it is located at <code>/usr/local/share/symon/c_config.sh</code>. Redirect the output from this script to <code>/etc/symon.conf</code> to start with. Modify this file to fine-tune what to generate data on depending on your system and monitoring requirements.</p>
<p>Example <code>/etc/symon.conf</code>:</p>
<pre class="autoit">monitor <span style="color: #FF0000; font-weight: bold;">&#123;</span>
   cpu<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, cpu<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, mem,
   io<span style="color: #FF0000; font-weight: bold;">&#40;</span>wd0<span style="color: #FF0000; font-weight: bold;">&#41;</span>,
   <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">if</span></a><span style="color: #FF0000; font-weight: bold;">&#40;</span>lo0<span style="color: #FF0000; font-weight: bold;">&#41;</span>, <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">if</span></a><span style="color: #FF0000; font-weight: bold;">&#40;</span>dc0<span style="color: #FF0000; font-weight: bold;">&#41;</span>, <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">if</span></a><span style="color: #FF0000; font-weight: bold;">&#40;</span>dc1<span style="color: #FF0000; font-weight: bold;">&#41;</span>,
   mbuf,
   pf,
   proc<span style="color: #FF0000; font-weight: bold;">&#40;</span>httpd2<span style="color: #FF0000; font-weight: bold;">&#41;</span>, proc<span style="color: #FF0000; font-weight: bold;">&#40;</span>mysqld<span style="color: #FF0000; font-weight: bold;">&#41;</span>, proc<span style="color: #FF0000; font-weight: bold;">&#40;</span>squid<span style="color: #FF0000; font-weight: bold;">&#41;</span>,
   sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>acpitz0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">temp0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>admtemp0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">temp0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>,
   sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>it0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">fan0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>it0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">fan1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
<span style="color: #FF0000; font-weight: bold;">&#125;</span>
&nbsp;
stream <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">to</span></a> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">127.0</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">.0</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">.1</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2100</span></pre>
<p>Now that we know what devices we're going to be generating data for, we can configure the Symux collection service. The main difference to note here is where the collected data is going to end up and what IP address and port the service is going to be listening on.</p>
<p>Example: <code>/etc/symux.conf</code></p>
<pre class="autoit">mux <span style="color: #AC00A9; font-style: italic; font-weight: bold;">127.0</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">.0</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">.1</span> <span style="color: #AC00A9; font-style: italic; font-weight: bold;">2100</span>
source <span style="color: #AC00A9; font-style: italic; font-weight: bold;">127.0</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">.0</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">.1</span> <span style="color: #FF0000; font-weight: bold;">&#123;</span>
  accept <span style="color: #FF0000; font-weight: bold;">&#123;</span>
    cpu<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, cpu<span style="color: #FF0000; font-weight: bold;">&#40;</span><span style="color: #AC00A9; font-style: italic; font-weight: bold;">1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, mem,
    io<span style="color: #FF0000; font-weight: bold;">&#40;</span>wd0<span style="color: #FF0000; font-weight: bold;">&#41;</span>,
    <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">if</span></a><span style="color: #FF0000; font-weight: bold;">&#40;</span>lo0<span style="color: #FF0000; font-weight: bold;">&#41;</span>, <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">if</span></a><span style="color: #FF0000; font-weight: bold;">&#40;</span>dc0<span style="color: #FF0000; font-weight: bold;">&#41;</span>, <a href="http://www.autoitscript.com/autoit3/docs/keywords.htm"><span style="color: #0000FF; font-weight: bold;">if</span></a><span style="color: #FF0000; font-weight: bold;">&#40;</span>dc1<span style="color: #FF0000; font-weight: bold;">&#41;</span>,
    mbuf,
    pf,
    proc<span style="color: #FF0000; font-weight: bold;">&#40;</span>httpd2<span style="color: #FF0000; font-weight: bold;">&#41;</span>, proc<span style="color: #FF0000; font-weight: bold;">&#40;</span>mysqld<span style="color: #FF0000; font-weight: bold;">&#41;</span>, proc<span style="color: #FF0000; font-weight: bold;">&#40;</span>squid<span style="color: #FF0000; font-weight: bold;">&#41;</span>,
    sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>acpitz0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">temp0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>admtemp0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">temp0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>,
    sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>it0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">fan0</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>, sensor<span style="color: #FF0000; font-weight: bold;">&#40;</span>it0.<span style="color: #0000FF; font-style: italic; font-weight: bold;">fan1</span><span style="color: #FF0000; font-weight: bold;">&#41;</span>
  <span style="color: #FF0000; font-weight: bold;">&#125;</span>
&nbsp;
  datadir <span style="font-weight: bold; color: #008080;">&quot;/var/data/symon/rrds/localhost&quot;</span>
<span style="color: #FF0000; font-weight: bold;">&#125;</span></pre>
<p>Great! Now the data collection and reporting services are configured. Now that we have Symux configured we can use the provided <code>/usr/local/share/symon/c_smrrds.sh</code> (OpenBSD) script to generate the RRD files for the devices &amp; processes we configured in Symux. Without generating the RRDs <strong><em>no data will be collected and starting the services will fail</em></strong>.</p>
<p>We are now ready to start the Symux &amp; Symon services. You must start Symux first so Symon has a place to send data to. This should be as simple as:</p>
<p><code># /usr/local/libexec/symux<br />
# /usr/local/libexec/symon</code></p>
<p>Don't forget to add these to your platforms start-up scripts. On OpenBSD we use <code>/etc/rc.local</code></p>
<pre class="bash"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -x /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/libexec/symux <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> -n <span style="color: #ff0000;">' symux'</span>;
  /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/libexec/symux
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> -x /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/libexec/symon <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> -n <span style="color: #ff0000;">' symon'</span>;
  /usr/<span style="color: #7a0874; font-weight: bold;">local</span>/libexec/symon
<span style="color: #000000; font-weight: bold;">fi</span></pre>
<p>Perfect! Okay, now that we're collecting all this data let's look at it with Syweb. Syweb installation can be as easy as unpacking the tarball from the download directory and moving the <code>syweb/htdocs/syweb</code> directory to your web servers DocumentRoot. You will also need to move the <code>.layout</code> files located under the extracted directory <code>syweb/symon</code> to the <code>layout_dir</code> directory you specify in the Syweb setup file below.</p>
<p>After extracting and moving Syweb to your web servers document root(<code>/var/apache2/htdocs/syweb</code>) we'll want to modify Syweb's configuration to tell it where our RRDs(created by Symon &amp; Symux) are located and where the <code>rrdtool</code> binary is located. This is done by modifying the <code>setup.inc</code> file included in the Syweb directory.</p>
<p>Example <code>/var/apache2/htdocs/syweb/setup.inc</code>:</p>
<pre class="php"><span style="color: #808080; font-style: italic;">/* running OpenBSD, apache not chrooted: */</span>
<span style="color: #0000ff;">$symon</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'rrdtool_path'</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">'/usr/local/bin/rrdtool'</span>;
<span style="color: #0000ff;">$symon</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'cache_dir'</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">'/var/data/symon/cache'</span>;
<span style="color: #0000ff;">$symon</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'host_tree'</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">'/var/data/symon/rrds'</span>;
<span style="color: #0000ff;">$symon</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'layout_dir'</span><span style="color: #66cc66;">&#93;</span>=<span style="color: #ff0000;">'/var/data/symon'</span>;</pre>
<p>Congratulations! You should now be seeing graphs for collected Symon data by browsing to <code>http://localhost/syweb</code>. If you wish to modify the reports look at the <code>.layout</code> files in the <code>layout_dir</code>.</p>
<p>For my configuration I have a virtual host(<code>http://syweb.domain.com</code>) configured for this service. Whether or not you can do this depends on what type of access you have to your webservers configuration.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.mnology.com/20080630/unix-system-monitoring-with-symon-symux-and-syweb/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
