Sophie

Sophie

distrib > Fedora > 17 > i386 > media > updates > by-pkgid > b50d8ee6d7871fcc13c0677a9364ed59 > files > 463

bcfg2-doc-1.3.0-1.fc17.noarch.rpm



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>NagiosGen &mdash; Bcfg2 1.3.0 documentation</title>
    
    <link rel="stylesheet" href="../../../_static/default.css" type="text/css" />
    <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../../../',
        VERSION:     '1.3.0',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../../../_static/jquery.js"></script>
    <script type="text/javascript" src="../../../_static/underscore.js"></script>
    <script type="text/javascript" src="../../../_static/doctools.js"></script>
    <script type="text/javascript" src="../../../_static/sidebar.js"></script>
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
    <link rel="top" title="Bcfg2 1.3.0 documentation" href="../../../index.html" />
    <link rel="up" title="Plugins" href="../index.html" />
    <link rel="next" title="Packages" href="packages.html" />
    <link rel="prev" title="Hostbase" href="hostbase.html" />
 
<link rel="stylesheet" href="../../../_static/bcfg2.css" type=""/>

  </head>
  <body>

<div style="text-align: left; padding: 10px 10px 15px 15px">
<a href="../../../index.html"><img src="../../../_static/bcfg2_logo.png" border="0" alt="sampledoc"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="packages.html" title="Packages"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="hostbase.html" title="Hostbase"
             accesskey="P">previous</a> |</li>
	<li><a href="../../../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../../../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../../../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../../../contents.html">documentation </a> &raquo;</li>

          <li><a href="../../../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="../../index.html" >The Bcfg2 Server</a> &raquo;</li>
          <li><a href="../index.html" accesskey="U">Plugins</a> &raquo;</li> 
      </ul>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="nagiosgen">
<span id="server-plugins-generators-nagiosgen"></span><h1>NagiosGen<a class="headerlink" href="#nagiosgen" title="Permalink to this headline">¶</a></h1>
<p>This page describes the installation and use of the <a class="reference external" href="http://trac.mcs.anl.gov/projects/bcfg2/browser/src/lib/Server/Plugins/NagiosGen.py">NagiosGen</a> plugin.</p>
<p>Update <tt class="docutils literal"><span class="pre">/etc/bcfg2.conf</span></tt>, adding NagiosGen to plugins:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">plugins</span> <span class="o">=</span> <span class="n">Base</span><span class="p">,</span><span class="n">Bundler</span><span class="p">,</span><span class="n">Cfg</span><span class="p">,</span><span class="o">...</span><span class="p">,</span><span class="n">NagiosGen</span>
</pre></div>
</div>
<p>Create the NagiosGen directory:</p>
<div class="highlight-python"><pre>$ mkdir /var/lib/bcfg2/NagiosGen</pre>
</div>
<p>Create default host, and group specs in:</p>
<p><tt class="docutils literal"><span class="pre">/var/lib/bcfg2/NagiosGen/default-host.cfg</span></tt>:</p>
<div class="highlight-python"><pre>define host{
        name                            default
        check_command                   check-host-alive
        check_interval                  5
        check_period                    24x7
        contact_groups                  admins
        event_handler_enabled           1
        failure_prediction_enabled      1
        flap_detection_enabled          1
        initial_state                   o
        max_check_attempts              10
        notification_interval           0
        notification_options            d,u,r
        notification_period             workhours
        notifications_enabled           1
        process_perf_data               0
        register                        0
        retain_nonstatus_information    1
        retain_status_information       1
        retry_interval                  1
        }</pre>
</div>
<p><tt class="docutils literal"><span class="pre">/var/lib/bcfg2/NagiosGen/default-group.cfg</span></tt>:</p>
<div class="highlight-python"><pre>define service{
        name                            default-service
        active_checks_enabled           1
        passive_checks_enabled          1
        obsess_over_service             0
        check_freshness                 0
        notifications_enabled           1
        event_handler_enabled           1
        flap_detection_enabled          1
        process_perf_data               0
        retain_status_information       1
        retain_nonstatus_information    1
        is_volatile                     0

        check_period                    24x7
        max_check_attempts              4
        check_interval                  5
        retry_interval                  1
        contact_groups                  admins
        notification_options            w,u,c,r
        notification_interval           0
        notification_period             workhours
        }</pre>
</div>
<p>Create group configuration files (Named identical to Bcfg2 groups) and
add services, and commands specific to the hostgroup (Bcfg2 group) in</p>
<p><tt class="docutils literal"><span class="pre">/var/lib/bcfg2/NagiosGen/base-group.cfg</span></tt>:</p>
<div class="highlight-python"><pre>define hostgroup{
        hostgroup_name  base
        alias           base
        notes           Notes
}

define service{
        service_description             NTP
        check_command                   check_ntp!
        use                             default-service
        hostgroup_name                  base
        }

define command{
        command_name    check_ssh
        command_line    $USER1$/check_ssh $ARG1$ $HOSTADDRESS$
        }

define service{
        service_description             SSH
        check_command                   check_ssh!
        use                             default-service
        hostgroup_name                  base
        }</pre>
</div>
<p><tt class="docutils literal"><span class="pre">/var/lib/bcfg2/NagiosGen/web-server-group.cfg</span></tt>:</p>
<div class="highlight-python"><pre>define hostgroup{
        hostgroup_name  web-server
        alias           Port 80 Web Servers
        notes           UC/ANL Teragrid Web Servers Running on Port 80
}

define command{
        command_name    check_http_80
        command_line    $USER1$/check_http $HOSTADDRESS$
        }

define service{
        service_description             HTTP:80
        check_command                   check_http_80!
        use                             default-service
        hostgroup_name                  web-server
        }</pre>
</div>
<p>Create a nagios Bcfg2 bundle <tt class="docutils literal"><span class="pre">/var/lib/bcfg2/Bundler/nagios.xml</span></tt></p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;nagios&#39;</span> <span class="na">version=</span><span class="s">&#39;2.0&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/nagiosgen.status&#39;</span><span class="nt">/&gt;</span>
  <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;rh&#39;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;nagios-server&#39;</span><span class="nt">&gt;</span>
      <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/nagios/nagiosgen.cfg&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;libtool-libs&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;nagios&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;nagios-www&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&#39;nagios&#39;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;debian-lenny&#39;</span><span class="nt">&gt;</span>
    <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;nagios-server&#39;</span><span class="nt">&gt;</span>
      <span class="nt">&lt;Path</span> <span class="na">name=</span><span class="s">&#39;/etc/nagios3/nagiosgen.cfg&#39;</span>
                  <span class="na">altsrc=</span><span class="s">&#39;/etc/nagios/nagiosgen.cfg&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;nagios3&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;nagios3-common&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;nagios3-doc&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Package</span> <span class="na">name=</span><span class="s">&#39;nagios-images&#39;</span><span class="nt">/&gt;</span>
      <span class="nt">&lt;Service</span> <span class="na">name=</span><span class="s">&#39;nagios3&#39;</span><span class="nt">/&gt;</span>
    <span class="nt">&lt;/Group&gt;</span>
  <span class="nt">&lt;/Group&gt;</span>
<span class="nt">&lt;/Bundle&gt;</span>
</pre></div>
</div>
<p>Assign clients to nagios groups in
<tt class="docutils literal"><span class="pre">/var/lib/bcfg2/Metadata/groups.xml</span></tt></p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;nagios&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;nagios&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Group&gt;</span>

<span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&#39;nagios-server&#39;</span><span class="nt">&gt;</span>
  <span class="nt">&lt;Bundle</span> <span class="na">name=</span><span class="s">&#39;nagios&#39;</span><span class="nt">/&gt;</span>
<span class="nt">&lt;/Group&gt;</span>
</pre></div>
</div>
<p>Update nagios configuration file to use <tt class="docutils literal"><span class="pre">nagiosgen.cfg</span></tt>:</p>
<div class="highlight-python"><pre>cfg_file=/etc/nagios/nagiosgen.cfg</pre>
</div>
<p>Note that some of these files are built on demand, each time a client
in group &#8220;nagios-server&#8221; checks in with the Bcfg2 server. Local nagios
instances can be configured to use the NagiosGen directory in the Bcfg2
repository directly.</p>
<div class="section" id="fine-grained-configuration">
<h2>Fine-Grained Configuration<a class="headerlink" href="#fine-grained-configuration" title="Permalink to this headline">¶</a></h2>
<p>NagiosGen can be configured in excruciating detail by editing
<tt class="docutils literal"><span class="pre">NagiosGen/config.xml</span></tt>, which will let you set individual Nagios
options for hosts or groups.  E.g.:</p>
<div class="highlight-xml"><div class="highlight"><pre><span class="nt">&lt;NagiosGen&gt;</span>
   <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&quot;datacenter-2&quot;</span><span class="nt">&gt;</span>
      <span class="nt">&lt;Option</span> <span class="na">name=</span><span class="s">&quot;parents&quot;</span><span class="nt">&gt;</span>dc-2-switch<span class="nt">&lt;/Option&gt;</span>
   <span class="nt">&lt;/Group&gt;</span>
   <span class="nt">&lt;Group</span> <span class="na">name=</span><span class="s">&quot;non-production&quot;</span><span class="nt">&gt;</span>
      <span class="nt">&lt;Option</span> <span class="na">name=</span><span class="s">&quot;notification_period&quot;</span><span class="nt">&gt;</span>workhours<span class="nt">&lt;/Option&gt;</span>
      <span class="nt">&lt;Option</span> <span class="na">name=</span><span class="s">&quot;notification_options&quot;</span><span class="nt">&gt;</span>d<span class="nt">&lt;/Option&gt;</span>
   <span class="nt">&lt;/Group&gt;</span>
   <span class="nt">&lt;Client</span> <span class="na">name=</span><span class="s">&quot;foo.example.com&quot;</span><span class="nt">&gt;</span>
      <span class="nt">&lt;Option</span> <span class="na">name=</span><span class="s">&quot;max_check_attempts&quot;</span><span class="nt">&gt;</span>10<span class="nt">&lt;/Option&gt;</span>
   <span class="nt">&lt;/Client&gt;</span>
<span class="nt">&lt;/NagiosGen&gt;</span>
</pre></div>
</div>
<p>Obviously the sort of fine-grained control you get from this overlaps
to some degree with Nagios&#8217; own templating, so use it wisely and in
moderation.</p>
<p><tt class="docutils literal"><span class="pre">NagiosGen/config.xml</span></tt> replaces the files
<tt class="docutils literal"><span class="pre">Properties/NagiosGen.xml</span></tt> and <tt class="docutils literal"><span class="pre">NagiosGen/parents.xml</span></tt> in older
versions of Bcfg2; your old configs can be migrated using the
<tt class="docutils literal"><span class="pre">nagiosgen-convert.py</span></tt> tool.  The plugin does contain a
backwards-compatibility layer for those older config files, but
<tt class="docutils literal"><span class="pre">NagiosGen/config.xml</span></tt> must exist (even if empty) for the plugin to
function.</p>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../../index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">NagiosGen</a><ul>
<li><a class="reference internal" href="#fine-grained-configuration">Fine-Grained Configuration</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="hostbase.html"
                        title="previous chapter">Hostbase</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="packages.html"
                        title="next chapter">Packages</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="../../../_sources/server/plugins/generators/nagiosgen.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="../../../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="../../../py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="packages.html" title="Packages"
             >next</a> |</li>
        <li class="right" >
          <a href="hostbase.html" title="Hostbase"
             >previous</a> |</li>
	<li><a href="../../../index.html">home</a> |&nbsp;</li>
	<!--<li><a href="../../../search.html">search</a> |&nbsp;</li>-->
	<li><a href="../../../help/index.html">help</a> |&nbsp;</li>
	<li><a href="../../../contents.html">documentation </a> &raquo;</li>

          <li><a href="../../../contents.html" >Bcfg2 documentation 1.3.0</a> &raquo;</li>
          <li><a href="../../index.html" >The Bcfg2 Server</a> &raquo;</li>
          <li><a href="../index.html" >Plugins</a> &raquo;</li> 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2009-2013, Narayan Desai.
      Last updated on Mar 20, 2013.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
    </div>
  </body>
</html>