<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Morgan Nametbd</title>
  <link>https://stormerider.dreamwidth.org/</link>
  <description>Morgan Nametbd - Dreamwidth Studios</description>
  <lastBuildDate>Wed, 03 Jul 2013 06:46:53 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>stormerider</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/6411330/573632</url>
    <title>Morgan Nametbd</title>
    <link>https://stormerider.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://stormerider.dreamwidth.org/189576.html</guid>
  <pubDate>Wed, 03 Jul 2013 06:46:53 GMT</pubDate>
  <title>[Tech] Running the cacti cookbook under Ubuntu</title>
  <link>https://stormerider.dreamwidth.org/189576.html</link>
  <description>&lt;p&gt;So something I&amp;#8217;ve been loving lately as I dive into the world of DevOps is the large community that Opscode has built up around &lt;a href=&quot;http://www.opscode.com/chef/&quot;&gt;Chef&lt;/a&gt;. While &lt;a href=&quot;https://puppetlabs.com/puppet/what-is-puppet/&quot;&gt;Puppet&lt;/a&gt; and Chef aim towards solving the same problem, and have many similarities in thought towards solutions (and many differences, of course), one of the swaying factors for many people like myself is the community. Puppet mostly gave me the tools to reinvent the wheel for my infrastructure; Chef gives me the tools to make a wheel and a shop full of &lt;a href=&quot;http://community.opscode.com/cookbooks&quot;&gt;free wheels already made&lt;/a&gt;. Sometimes you need to do a bit of work to make it fit, but sometimes you can just hook it up and go. That&amp;#8217;s an invaluable thing in today&amp;#8217;s fast paced IT world.&lt;/p&gt;
&lt;p&gt;My &amp;#8220;itch&amp;#8221; to scratch of today was &lt;a href=&quot;http://www.cacti.net/&quot;&gt;Cacti&lt;/a&gt;. I&amp;#8217;ve been having some problems with the local Comcast connection, and the temperature has been rising here in the PNW, and as a result my mind has returned towards getting my local network monitoring set back up. And indeed, this is a great chance to set up a local testbed for Chef work unrelated to my day job. So I got &lt;a href=&quot;http://www.nagios.org/&quot;&gt;Nagios&lt;/a&gt; and rsyslog bootstrapped with Chef here at home yesterday and worked on Cacti today. &lt;/p&gt;
&lt;p&gt;(I got a little derailed when I found out that for some reason my Linux box&amp;#8217;s swap partition had an incorrect entry in /etc/fstab. After fixing that, I got an error when trying to turn swap back on:&lt;br /&gt;
&lt;code&gt;swapon: /dev/sda5: read swap header failed: Invalid argument&lt;/code&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.linuxquestions.org/questions/linux-newbie-8/swapon-dev-sda2-read-swap-header-failed-invalid-argument-4175429683/&quot;&gt;This&lt;/a&gt; article pointed me to the solution:&lt;br /&gt;
&lt;code&gt;mkswap /dev/sda5; swapon -a&lt;/code&gt;&lt;br /&gt;
That recreated the swap header and then I was able to enable it and have a stable system again.)&lt;/p&gt;
&lt;p&gt;There was &lt;a href=&quot;https://github.com/bflad/chef-cacti&quot;&gt;already a cookbook&lt;/a&gt; for Cacti, but it looks like it was designed for Redhat package names and file paths. I spent some time stepping through things and making it work with Ubuntu. For the most part, it was a matter of taking some hard-coded settings, replacing them with attributes, and setting the default values for those attributes to be the same as the old hard-coded values. This allows me to then override them locally, and anyone else already using the cookbook will see no change. I did add a few platform-specific checks, for things like the Ubuntu package names. &lt;/p&gt;
&lt;p&gt;In all likelihood, anyone running a Debian system can probably change the spots I added Ubuntu support and extend them for Debian support as well (since most of the core Ubuntu packages either come from or get merged upstream into Debian). However, I don&amp;#8217;t have a Debian test environment yet, so I didn&amp;#8217;t want to make assumptions. It&amp;#8217;s on the list of things to get up and running in a VM&amp;#8230; CentOS, Oracle Linux, and Debian.&lt;/p&gt;
&lt;p&gt;Here&amp;#8217;s the role that I ended up with, when all was said and done. In my case, this server is only available over the internal network, so I didn&amp;#8217;t need SSL support.&lt;/p&gt;

&lt;div class=&quot;wp_syntax&quot;&gt;&lt;table&gt;&lt;tr&gt;&lt;td class=&quot;code&quot;&gt;&lt;pre class=&quot;json&quot; style=&quot;font-family:monospace;&quot;&gt;{
  &amp;quot;name&amp;quot;: &amp;quot;cacti-server&amp;quot;,
  &amp;quot;description&amp;quot;: &amp;quot;Role to configure Cacti server.&amp;quot;,
  &amp;quot;json_class&amp;quot;: &amp;quot;Chef::Role&amp;quot;,
  &amp;quot;chef_type&amp;quot;: &amp;quot;role&amp;quot;,
  &amp;quot;default_attributes&amp;quot;: {
  },
  &amp;quot;override_attributes&amp;quot;: {
    &amp;quot;cacti&amp;quot;: {
      &amp;quot;user&amp;quot;: &amp;quot;www-data&amp;quot;,
      &amp;quot;group&amp;quot;: &amp;quot;www-data&amp;quot;,
      &amp;quot;cron_minute&amp;quot;: &amp;quot;*&amp;quot;,
      &amp;quot;apache2&amp;quot;: {
        &amp;quot;conf_dir&amp;quot;: &amp;quot;/etc/apache2/conf.d&amp;quot;,
        &amp;quot;doc_root&amp;quot;: &amp;quot;/var/www&amp;quot;,
        &amp;quot;ssl&amp;quot;: {
          &amp;quot;force&amp;quot;: false,
          &amp;quot;enabled&amp;quot;: false
        }
      }
    }
  },
  &amp;quot;run_list&amp;quot;: [
    &amp;quot;recipe[cacti::server]&amp;quot;,
    &amp;quot;recipe[cacti::spine]&amp;quot;
  ],
  &amp;quot;env_run_lists&amp;quot;: {
  }
}&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I sent over a &lt;a href=&quot;https://github.com/bflad/chef-cacti/pull/2&quot;&gt;pull request&lt;/a&gt; to get the changes merged in, but until then feel free to grab the cookbook from &lt;a href=&quot;https://github.com/stormerider/chef-cacti/tree/ubuntu&quot;&gt;github&lt;/a&gt; (note that you&amp;#8217;ll want the ubuntu branch). If you&amp;#8217;re using &lt;a href=&quot;http://berkshelf.com/&quot;&gt;Berkshelf&lt;/a&gt;, you can add this to your Berksfile:&lt;br /&gt;&lt;br /&gt;
&lt;code&gt;cookbook &apos;cacti&apos;, github: &apos;stormerider/chef-cacti&apos;, branch: &apos;ubuntu&apos;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I hope this helps someone else!&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=stormerider&amp;ditemid=189576&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://stormerider.dreamwidth.org/189576.html</comments>
  <category>chef</category>
  <category>monitoring</category>
  <category>cacti</category>
  <category>ubuntu</category>
  <category>devops</category>
  <category>nagios</category>
  <category>swap</category>
  <category>puppet</category>
  <category>cookbooks</category>
  <lj:mood>accomplished</lj:mood>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
</channel>
</rss>
