Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

move yard docs to dmytro.github.com

  • Loading branch information...
commit 47499a5453f908c2eae08a6c8a9647220a511e99 1 parent c250d93
Dmytro Kovalov authored
1  .yardopts
View
@@ -1,3 +1,4 @@
+--output-dir ../dmytro.github.com/nagira/doc
app.rb
lib/**/*.rb
-
21 LICENSE
View
@@ -0,0 +1,21 @@
+(The MIT License)
+
+Copyright (c) 2012 Dmytro Kovalov
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the 'Software'), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
110 doc/Nagios.html
View
@@ -1,110 +0,0 @@
-<!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" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>
- Module: Nagios
-
- &mdash; Documentation by YARD 0.7.4
-
-</title>
-
- <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
-
- <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
-
-<script type="text/javascript" charset="utf-8">
- relpath = '';
- if (relpath != '') relpath += '/';
-</script>
-
- <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="js/app.js"></script>
-
-
- </head>
- <body>
- <script type="text/javascript" charset="utf-8">
- if (window.top.frames.main) document.body.className = 'frames';
- </script>
-
- <div id="header">
- <div id="menu">
-
- <a href="_index.html">Index (N)</a> &raquo;
-
-
- <span class="title">Nagios</span>
-
-
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
-</div>
-
- <div id="search">
-
- <a id="class_list_link" href="#">Class List</a>
-
- <a id="method_list_link" href="#">Method List</a>
-
- <a id="file_list_link" href="#">File List</a>
-
-</div>
- <div class="clear"></div>
- </div>
-
- <iframe id="search_frame"></iframe>
-
- <div id="content"><h1>Module: Nagios
-
-
-
-</h1>
-
-<dl class="box">
-
-
-
-
-
-
-
-
- <dt class="r1 last">Defined in:</dt>
- <dd class="r1 last">lib/nagira/nagios.rb<span class="defines">,<br />
- lib/nagira/timed_parse.rb,<br /> lib/ruby-nagios/nagios/status.rb,<br /> lib/ruby-nagios/nagios/config.rb,<br /> lib/ruby-nagios/nagios/objects.rb</span>
-</dd>
-
-</dl>
-<div class="clear"></div>
-
-<h2>Defined Under Namespace</h2>
-<p class="children">
-
-
- <strong class="modules">Modules:</strong> <span class='object_link'><a href="Nagios/TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span>
-
-
-
- <strong class="classes">Classes:</strong> <span class='object_link'><a href="Nagios/Config.html" title="Nagios::Config (class)">Config</a></span>, <span class='object_link'><a href="Nagios/Objects.html" title="Nagios::Objects (class)">Objects</a></span>, <span class='object_link'><a href="Nagios/Status.html" title="Nagios::Status (class)">Status</a></span>
-
-
-</p>
-
-
-
-
-
-
-
-</div>
-
- <div id="footer">
- Generated on Fri Jan 13 10:23:35 2012 by
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.7.4 (ruby-1.9.3).
-</div>
-
- </body>
-</html>
460 doc/Nagios/Config.html
View
@@ -1,460 +0,0 @@
-<!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" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>
- Class: Nagios::Config
-
- &mdash; Documentation by YARD 0.7.4
-
-</title>
-
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
-
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
-
-<script type="text/javascript" charset="utf-8">
- relpath = '..';
- if (relpath != '') relpath += '/';
-</script>
-
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
-
-
- </head>
- <body>
- <script type="text/javascript" charset="utf-8">
- if (window.top.frames.main) document.body.className = 'frames';
- </script>
-
- <div id="header">
- <div id="menu">
-
- <a href="../_index.html">Index (C)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../Nagios.html" title="Nagios (module)">Nagios</a></span></span>
- &raquo;
- <span class="title">Config</span>
-
-
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
-</div>
-
- <div id="search">
-
- <a id="class_list_link" href="#">Class List</a>
-
- <a id="method_list_link" href="#">Method List</a>
-
- <a id="file_list_link" href="#">File List</a>
-
-</div>
- <div class="clear"></div>
- </div>
-
- <iframe id="search_frame"></iframe>
-
- <div id="content"><h1>Class: Nagios::Config
-
-
-
-</h1>
-
-<dl class="box">
-
- <dt class="r1">Inherits:</dt>
- <dd class="r1">
- <span class="inheritName">Object</span>
-
- <ul class="fullTree">
- <li>Object</li>
-
- <li class="next">Nagios::Config</li>
-
- </ul>
- <a href="#" class="inheritanceTree">show all</a>
-
- </dd>
-
-
-
-
-
-
-
-
-
- <dt class="r2 last">Defined in:</dt>
- <dd class="r2 last">lib/ruby-nagios/nagios/config.rb</dd>
-
-</dl>
-<div class="clear"></div>
-
-<h2>Overview</h2><div class="docstring">
- <div class="discussion">
-
-<p>Configuration parser for Nagios. Constructor parses Nagios' main config
-file and returns an object: each configuration option's value assigned to
-an instance variable and attribute reader method is created.</p>
-
-<p>Can be used as:</p>
-
-<pre class="code"> require 'nagios/config'
- nagios = Nagios::Config.new &quot;lib/ruby-nagios/test/data/nagios.cfg&quot;
-
- nagios.log_file
-=&gt; &quot;/var/log/nagios3/nagios.log&quot;
-
- nagios.status_file
-=&gt; &quot;/var/cache/nagios3/status.dat&quot;</pre>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div>
- <h2>Constant Summary</h2>
-
- <dl class="constants">
-
- <dt id="DEFAULT_CONFIG-constant" class="">DEFAULT_CONFIG =
-
- </dt>
- <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>/etc/nagios*/nagios.cfg</span><span class='tstring_end'>&quot;</span></span></pre></dd>
-
- </dl>
-
-
-
- <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#cfg_dir-instance_method" title="#cfg_dir (instance method)">- (Object) <strong>cfg_dir</strong> </a>
-
-
-
- </span>
-
-
- <span class="note title readonly">readonly</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Special case for cfg_file and cfg_dir: they are Arrays.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#cfg_file-instance_method" title="#cfg_file (instance method)">- (Object) <strong>cfg_file</strong> </a>
-
-
-
- </span>
-
-
- <span class="note title readonly">readonly</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Special case for cfg_file and cfg_dir: they are Arrays.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
-
-
-
-
- <h2>
- Instance Method Summary
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
- </h2>
-
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Config) <strong>initialize</strong>(config_file = nil) </a>
-
-
-
- </span>
-
- <span class="note title constructor">constructor</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Read and parse configuration file.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
-
-<div id="constructor_details" class="method_details_list">
- <h2>Constructor Details</h2>
-
- <div class="method_details first">
- <p class="signature first" id="initialize-instance_method">
-
- - (<tt><span class='object_link'><a href="" title="Nagios::Config (class)">Config</a></span></tt>) <strong>initialize</strong>(config_file = nil)
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
- <div class="note notetag">
- <strong>Note:</strong>
- <div class='inline'>
-<p>If you have more than one /etc/nagios* directories then only first one will
-be used. For example, Debian can have both Nagios 2 and 3 installed. In the
-latter case configuration file is <tt>/etc/nagios3/nagios.cfg</tt>.</p>
-</div>
- </div>
-
-
-<p>Read and parse configuration file.</p>
-
-
- </div>
-</div>
-<div class="tags">
- <h3>Parameters:</h3>
-<ul class="param">
-
- <li>
-
- <span class='name'>config_file</span>
-
-
- <span class='type'>(<tt>String</tt>)</span>
-
-
- <em class="default">(defaults to: <tt>nil</tt>)</em>
-
-
- &mdash;
- <div class='inline'>
-<p>PATH to the configuration file. If PATH is not provided method will look
-for configuration file <tt>nagios.cfg</tt> in <tt>/etc/nagios*</tt>
-directory.</p>
-</div>
-
- </li>
-
-</ul>
-
-<h3>Author:</h3>
-<ul class="author">
-
- <li>
-
-
-
-
-
- <div class='inline'>
-<p>Dmytro Kovalov, dmytro.kovalov@gmail.com</p>
-</div>
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-37
-38
-39
-40
-41
-42
-43
-44
-45
-46
-47
-48
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/config.rb', line 37</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_config_file'>config_file</span><span class='op'>=</span><span class='kw'>nil</span>
- <span class='ivar'>@config</span> <span class='op'>=</span> <span class='id identifier rubyid_config_file'>config_file</span> <span class='op'>||</span> <span class='const'>Dir</span><span class='period'>.</span><span class='id identifier rubyid_glob'>glob</span><span class='lparen'>(</span><span class='const'>DEFAULT_CONFIG</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_first'>first</span>
-
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No configuration file option and no files in </span><span class='embexpr_beg'>#{</span><span class='const'>DEFAULT_CONFIG</span><span class='rbrace'>}</span><span class='tstring_content'> </span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='ivar'>@config</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Configuration file </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='rbrace'>}</span><span class='tstring_content'> does not exist</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span> <span class='ivar'>@config</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Configuration file </span><span class='embexpr_beg'>#{</span><span class='ivar'>@config</span><span class='rbrace'>}</span><span class='tstring_content'> is not readable</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span> <span class='ivar'>@config</span>
-
- <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readlines'>readlines</span><span class='lparen'>(</span><span class='ivar'>@config</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span><span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_sub'>sub</span><span class='lparen'>(</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>#.*$</span><span class='regexp_end'>/</span></span><span class='comma'>,</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_delete_if'>delete_if</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span> <span class='id identifier rubyid_l'>l</span><span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^$</span><span class='regexp_end'>/</span></span><span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_l'>l</span><span class='op'>|</span>
- <span class='id identifier rubyid_key'>key</span><span class='comma'>,</span><span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='id identifier rubyid_l'>l</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span><span class='period'>.</span><span class='id identifier rubyid_split'>split</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>=</span><span class='tstring_end'>'</span></span><span class='comma'>,</span><span class='int'>2</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Incorrect configuration line </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_l'>l</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_key'>key</span> <span class='op'>&amp;&amp;</span> <span class='id identifier rubyid_val'>val</span>
-
- <span class='kw'>case</span> <span class='id identifier rubyid_key'>key</span>
- <span class='kw'>when</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>cfg_(file|dir)</span><span class='regexp_end'>/</span></span> <span class='comment'># There could be multiple entries for cfg_dir/file
-</span> <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='lparen'>(</span><span class='id identifier rubyid_instance_variable_get'>instance_variable_get</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_val'>val</span> <span class='rparen'>)</span>
- <span class='kw'>else</span>
- <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_instance_eval'>instance_eval</span> <span class='id identifier rubyid_val'>val</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^[\d\.-]+</span><span class='regexp_end'>/</span></span> <span class='op'>?</span>
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>def </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>; return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_val'>val</span><span class='rbrace'>}</span><span class='tstring_content'>; end</span><span class='tstring_end'>&quot;</span></span> <span class='op'>:</span>
- <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>def </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>; return %Q{</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_val'>val</span><span class='rbrace'>}</span><span class='tstring_content'>}; end</span><span class='tstring_end'>&quot;</span></span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-</div>
-
- <div id="instance_attr_details" class="attr_details">
- <h2>Instance Attribute Details</h2>
-
-
- <span id=""></span>
- <span id="cfg_dir-instance_method"></span>
- <div class="method_details first">
- <p class="signature first" id="cfg_dir-instance_method">
-
- - (<tt>Object</tt>) <strong>cfg_dir</strong> <span class="extras">(readonly)</span>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Special case for cfg_file and cfg_dir: they are Arrays</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-61
-62
-63</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/config.rb', line 61</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_cfg_dir'>cfg_dir</span>
- <span class='ivar'>@cfg_dir</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-
- <span id=""></span>
- <span id="cfg_file-instance_method"></span>
- <div class="method_details ">
- <p class="signature " id="cfg_file-instance_method">
-
- - (<tt>Object</tt>) <strong>cfg_file</strong> <span class="extras">(readonly)</span>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Special case for cfg_file and cfg_dir: they are Arrays</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-61
-62
-63</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/config.rb', line 61</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_cfg_file'>cfg_file</span>
- <span class='ivar'>@cfg_file</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
-
-</div>
-
- <div id="footer">
- Generated on Fri Jan 13 10:23:36 2012 by
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.7.4 (ruby-1.9.3).
-</div>
-
- </body>
-</html>
901 doc/Nagios/Objects.html
View
@@ -1,901 +0,0 @@
-<!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" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>
- Class: Nagios::Objects
-
- &mdash; Documentation by YARD 0.7.4
-
-</title>
-
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
-
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
-
-<script type="text/javascript" charset="utf-8">
- relpath = '..';
- if (relpath != '') relpath += '/';
-</script>
-
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
-
-
- </head>
- <body>
- <script type="text/javascript" charset="utf-8">
- if (window.top.frames.main) document.body.className = 'frames';
- </script>
-
- <div id="header">
- <div id="menu">
-
- <a href="../_index.html">Index (O)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../Nagios.html" title="Nagios (module)">Nagios</a></span></span>
- &raquo;
- <span class="title">Objects</span>
-
-
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
-</div>
-
- <div id="search">
-
- <a id="class_list_link" href="#">Class List</a>
-
- <a id="method_list_link" href="#">Method List</a>
-
- <a id="file_list_link" href="#">File List</a>
-
-</div>
- <div class="clear"></div>
- </div>
-
- <iframe id="search_frame"></iframe>
-
- <div id="content"><h1>Class: Nagios::Objects
-
-
-
-</h1>
-
-<dl class="box">
-
- <dt class="r1">Inherits:</dt>
- <dd class="r1">
- <span class="inheritName">Object</span>
-
- <ul class="fullTree">
- <li>Object</li>
-
- <li class="next">Nagios::Objects</li>
-
- </ul>
- <a href="#" class="inheritanceTree">show all</a>
-
- </dd>
-
-
-
-
-
-
- <dt class="r2">Includes:</dt>
- <dd class="r2"><span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></dd>
-
-
-
-
-
- <dt class="r1 last">Defined in:</dt>
- <dd class="r1 last">lib/ruby-nagios/nagios/objects.rb<span class="defines">,<br />
- lib/nagira/nagios.rb</span>
-</dd>
-
-</dl>
-<div class="clear"></div>
-
-<h2>Overview</h2><div class="docstring">
- <div class="discussion">
-
-<h1>DESCRIPTION</h1>
-
-<p>Nagios::Objects -- class for parsing Nagios' objects.cache file.
-Objects.cache file keeps information about lists of objects being monitored
-by Nagios. It is created by Nagios process on (re)start. Since it is
-machine-generated file syntax should not vary from file to file.</p>
-
-<p>Class implements 2 methods at the time of writing:</p>
-<ul><li>
-<p>constructor - that only creates an instance and</p>
-</li><li>
-<p>parse method - that does actual parsing and populates instance variable
-@objects</p>
-</li></ul>
-
-<h1>SYNOPSIS</h1>
-
-<pre class="code"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>nagios/objects</span><span class='tstring_end'>'</span></span>
-
- <span class='id identifier rubyid_nagios'>nagios</span> <span class='op'>=</span> <span class='const'>Nagios</span><span class='op'>::</span><span class='const'>Objects</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>test/objects.cache</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_parse'>parse</span>
- <span class='id identifier rubyid_print'>print</span> <span class='id identifier rubyid_nagios'>nagios</span><span class='period'>.</span><span class='id identifier rubyid_objects'>objects</span><span class='lbracket'>[</span><span class='symbol'>:contactgroup</span><span class='rbracket'>]</span></pre>
-
-<h2>Files</h2>
-
-<p>Location of objects.cache file depends on Nagios configuration (in many
-cases varies from one UNIX/Linux ditribution to another) and is defined by
-directive in nagios.cfg file.</p>
-
-<p>On Debian system objects.cache it is in /var/cache/nagios3/objects.cache:</p>
-
-<pre class="code"><span class='id identifier rubyid_object_cache_file'>object_cache_file</span><span class='op'>=</span><span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>var</span><span class='regexp_end'>/cache</span></span><span class='op'>/</span><span class='id identifier rubyid_nagios3'>nagios3</span><span class='op'>/</span><span class='id identifier rubyid_objects'>objects</span><span class='period'>.</span><span class='id identifier rubyid_cache'>cache</span></pre>
-
-<h2>Parsed data hash</h2>
-
-<pre class="code">irb(main):010:0&gt; pp nagios.objects
- {:timeperiod=&gt;
- {&quot;24x7&quot;=&gt;
- {:timeperiod_name=&gt;&quot;24x7&quot;,
- :alias=&gt;&quot;24 Hours A Day, 7 Days A Week&quot;,
- :sunday=&gt;&quot;00:00-24:00&quot;,
- :monday=&gt;&quot;00:00-24:00&quot;,
- :tuesday=&gt;&quot;00:00-24:00&quot;,
- :wednesday=&gt;&quot;00:00-24:00&quot;,
- :thursday=&gt;&quot;00:00-24:00&quot;,
- :friday=&gt;&quot;00:00-24:00&quot;,
- :saturday=&gt;&quot;00:00-24:00&quot;},
- &quot;never&quot;=&gt;{:timeperiod_name=&gt;&quot;never&quot;, :alias=&gt;&quot;Never&quot;},</pre>
-
-<h1>Author</h1>
-
-<p>Dmytro Kovalov, dmytro.kovalov@gmail.com 2011, Dec, 27 - First working
-version</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div>
- <h2>Constant Summary</h2>
-
-
-
-
-
-
-
- <h3 class="inherited">Constants included from <span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="TimedParse.html#MIN_PARSE_INTERVAL-constant" title="Nagios::TimedParse::MIN_PARSE_INTERVAL (constant)">MIN_PARSE_INTERVAL</a></span></p>
-
- <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#objects-instance_method" title="#objects (instance method)">- (Object) <strong>objects</strong> </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Parsed objects.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#objects_file-instance_method" title="#objects_file (instance method)">- (Object) <strong>objects_file</strong> </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>PATH to the objects.cache file.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
-
-
-
-
-
-
-
- <h3 class="inherited">Attributes included from <span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="TimedParse.html#last_changed-instance_method" title="Nagios::TimedParse#last_changed (method)">last_changed</a></span>, <span class='object_link'><a href="TimedParse.html#last_parsed-instance_method" title="Nagios::TimedParse#last_parsed (method)">last_parsed</a></span>, <span class='object_link'><a href="TimedParse.html#parse_interval-instance_method" title="Nagios::TimedParse#parse_interval (method)">parse_interval</a></span></p>
-
-
-
- <h2>
- Instance Method Summary
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
- </h2>
-
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#find-instance_method" title="#find (instance method)">- (Object) <strong>find</strong>(resource, message, attribute, pattern) </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Basic find function for resources.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Objects) <strong>initialize</strong>(path) </a>
-
-
-
- </span>
-
- <span class="note title constructor">constructor</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>A new instance of Objects.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#method_missing-instance_method" title="#method_missing (instance method)">- (Object) <strong>method_missing</strong>(sym, *args, &amp;block) </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Replace standard <tt>method_missing</tt> with dynamic search methods.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#parse-instance_method" title="#parse (instance method)">- (Object) <strong>parse</strong> </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Read objects.cache file and parse it.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
-
-
-
-
-
-
-
-
-
- <h3 class="inherited">Methods included from <span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="TimedParse.html#changed%3F-instance_method" title="Nagios::TimedParse#changed? (method)">#changed?</a></span>, <span class='object_link'><a href="TimedParse.html#included-class_method" title="Nagios::TimedParse.included (method)">included</a></span>, <span class='object_link'><a href="TimedParse.html#need_parsing%3F-instance_method" title="Nagios::TimedParse#need_parsing? (method)">#need_parsing?</a></span></p>
-<div id="constructor_details" class="method_details_list">
- <h2>Constructor Details</h2>
-
- <div class="method_details first">
- <p class="signature first" id="initialize-instance_method">
-
- - (<tt><span class='object_link'><a href="" title="Nagios::Objects (class)">Objects</a></span></tt>) <strong>initialize</strong>(path)
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>A new instance of Objects</p>
-
-
- </div>
-</div>
-<div class="tags">
- <h3>Parameters:</h3>
-<ul class="param">
-
- <li>
-
- <span class='name'>path</span>
-
-
- <span class='type'>(<tt>String</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>UNIX path to the objects.cache file</p>
-</div>
-
- </li>
-
-</ul>
-
-
- <h3>See Also:</h3>
- <ul class="see">
-
- <li>parse</li>
-
- </ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-62
-63
-64
-65
-66
-67</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/objects.rb', line 62</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span> <span class='id identifier rubyid_path'>path</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>File does not exist</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span> <span class='id identifier rubyid_path'>path</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>File is not readable</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span> <span class='id identifier rubyid_path'>path</span>
- <span class='ivar'>@objects_file</span> <span class='op'>=</span> <span class='id identifier rubyid_path'>path</span>
- <span class='ivar'>@objects</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-</div>
-<div id="method_missing_details" class="method_details_list">
- <h2>Dynamic Method Handling</h2>
- <p class="notice this">
- This class handles dynamic methods through the <tt>method_missing</tt> method
-
- </p>
-
- <div class="method_details first">
- <p class="signature first" id="method_missing-instance_method">
-
- - (<tt>Object</tt>) <strong>method_missing</strong>(sym, *args, &amp;block)
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Replace standard <tt>method_missing</tt> with dynamic search methods. Calls
-internally self.find.</p>
-
-<p>find_*_by and find_all_*. find_all returns Array of hashes.</p>
-
-
- </div>
-</div>
-<div class="tags">
- <h3>Parameters:</h3>
-<ul class="param">
-
- <li>
-
- <span class='name'>sym</span>
-
-
- <span class='type'>(<tt>Symbol</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>Should be in the form
-find(_all)?_&lt;resource&gt;<em>by</em>&lt;attribute&gt;. Similar to
-ActiveResource find_* dynamic methods. Depending on the name of the mthod
-called (find or find_all) will pass message to self.find method, that will
-call Array.find or Array.find_all accordingly.</p>
-</div>
-
- </li>
-
-</ul>
-
-<h3>Raises:</h3>
-<ul class="raise">
-
- <li>
-
-
- <span class='type'>(<tt>NoMethodError</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
- <h3>See Also:</h3>
- <ul class="see">
-
- <li>find</li>
-
- </ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-176
-177
-178
-179
-180
-181
-182
-183
-184
-185</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/objects.rb', line 176</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_method_missing'>method_missing</span> <span class='id identifier rubyid_sym'>sym</span><span class='comma'>,</span> <span class='op'>*</span><span class='id identifier rubyid_args'>args</span><span class='comma'>,</span> <span class='op'>&amp;</span><span class='id identifier rubyid_block'>block</span>
- <span class='id identifier rubyid_raise'>raise</span><span class='lparen'>(</span><span class='const'>NoMethodError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>No such method </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_sym'>sym</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'> for </span><span class='embexpr_beg'>#{</span><span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span> <span class='kw'>unless</span> <span class='id identifier rubyid_sym'>sym</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^(find(_all)?)_(.*)_by_(.*)$</span><span class='regexp_end'>/</span></span>
- <span class='comment'># message - either 'find' of 'find_all'
-</span> <span class='comment'># resource - type of objects to search: host, hostgroup etc.
-</span> <span class='comment'># attribute - name of the attribute to do search by: :host_name, :check_command
-</span> <span class='comment'># @param *args String or Regexp to search objects
-</span> <span class='id identifier rubyid_message'>message</span><span class='comma'>,</span><span class='id identifier rubyid_resource'>resource</span><span class='comma'>,</span><span class='id identifier rubyid_attribute'>attribute</span> <span class='op'>=</span> <span class='backref'>$1</span><span class='comma'>,</span> <span class='backref'>$3</span><span class='comma'>,</span> <span class='backref'>$4</span>
-
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_find'>find</span> <span class='id identifier rubyid_resource'>resource</span><span class='comma'>,</span><span class='id identifier rubyid_message'>message</span><span class='comma'>,</span><span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span><span class='id identifier rubyid_args'>args</span><span class='lbracket'>[</span><span class='int'>0</span><span class='rbracket'>]</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-</div>
-
- <div id="instance_attr_details" class="attr_details">
- <h2>Instance Attribute Details</h2>
-
-
- <span id="objects=-instance_method"></span>
- <span id="objects-instance_method"></span>
- <div class="method_details first">
- <p class="signature first" id="objects-instance_method">
-
- - (<tt>Object</tt>) <strong>objects</strong>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Parsed objects</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-73
-74
-75</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/objects.rb', line 73</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_objects'>objects</span>
- <span class='ivar'>@objects</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-
- <span id="objects_file=-instance_method"></span>
- <span id="objects_file-instance_method"></span>
- <div class="method_details ">
- <p class="signature " id="objects_file-instance_method">
-
- - (<tt>Object</tt>) <strong>objects_file</strong>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>PATH to the objects.cache file</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-70
-71
-72</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/objects.rb', line 70</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_objects_file'>objects_file</span>
- <span class='ivar'>@objects_file</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
-
- <div id="instance_method_details" class="method_details_list">
- <h2>Instance Method Details</h2>
-
-
- <div class="method_details first">
- <p class="signature first" id="find-instance_method">
-
- - (<tt>Object</tt>) <strong>find</strong>(resource, message, attribute, pattern)
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Basic find function for resources.</p>
-
-
- </div>
-</div>
-<div class="tags">
- <h3>Parameters:</h3>
-<ul class="param">
-
- <li>
-
- <span class='name'>resource</span>
-
-
- <span class='type'>(<tt>Symbol</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>Resource to search from: :host, :hostgroup, etc.</p>
-</div>
-
- </li>
-
- <li>
-
- <span class='name'>attribute</span>
-
-
- <span class='type'>(<tt>Symbol</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>Attribute to use in search. For example, find host by hostname or address,
-etc. anything that's defined for this resource</p>
-</div>
-
- </li>
-
- <li>
-
- <span class='name'>message</span>
-
-
- <span class='type'>(<tt>Symbol</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'>
-<p>Is either 'find' or 'find_all' passed from caller. In case of 'find'
-returns 1 hash, 'find_all' - Array of Hash'es.</p>
-</div>
-
- </li>
-
- <li>
-
- <span class='name'>or</span>
-
-
- <span class='type'>(<tt>String</tt>)</span>
-
-
-
- &mdash;
- <div class='inline'><dl class="rdoc-list"><dt>Regexp</dt>
-<dd>
-<p>pattern Search pattern</p>
-</dd></dl>
-</div>
-
- </li>
-
-</ul>
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-148
-149
-150
-151
-152
-153
-154
-155
-156
-157
-158
-159
-160</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/objects.rb', line 148</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_find'>find</span> <span class='id identifier rubyid_resource'>resource</span><span class='comma'>,</span> <span class='id identifier rubyid_message'>message</span><span class='comma'>,</span> <span class='id identifier rubyid_attribute'>attribute</span><span class='comma'>,</span> <span class='id identifier rubyid_pattern'>pattern</span>
- <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_resource'>resource</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rparen'>)</span><span class='period'>.</span><span class='id identifier rubyid_values'>values</span><span class='period'>.</span><span class='id identifier rubyid_send'>send</span><span class='lparen'>(</span><span class='id identifier rubyid_message'>message</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_a'>a</span><span class='op'>|</span>
- <span class='kw'>case</span> <span class='id identifier rubyid_pattern'>pattern</span>
- <span class='kw'>when</span> <span class='const'>String</span>
- <span class='id identifier rubyid_a'>a</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='id identifier rubyid_pattern'>pattern</span>
- <span class='kw'>when</span> <span class='const'>Regexp</span>
- <span class='id identifier rubyid_a'>a</span><span class='lbracket'>[</span><span class='id identifier rubyid_attribute'>attribute</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=~</span> <span class='id identifier rubyid_pattern'>pattern</span>
- <span class='kw'>else</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Unknown pattern for search</span><span class='tstring_end'>'</span></span>
- <span class='kw'>end</span>
-
- <span class='kw'>end</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <p class="signature " id="parse-instance_method">
-
- - (<tt>Object</tt>) <strong>parse</strong>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Read objects.cache file and parse it.</p>
-
-<p>Method reads file by blocks. Each block defines one object, definition
-starts with 'define &lt;type&gt; and ends with ''. Each block has a
-'&lt;type&gt;_name' line which defines name of the instance of the object.</p>
-
-<p>Code of the 'parse()' method assumes, that _name line is always first in
-the block! This can be not always the case.</p>
-
-<p>Example of a block:</p>
-
-<pre class="code"><span class='id identifier rubyid_define'>define</span> <span class='id identifier rubyid_contactgroup'>contactgroup</span> <span class='lbrace'>{</span>
- <span class='id identifier rubyid_contactgroup_name'>contactgroup_name</span> <span class='id identifier rubyid_admins'>admins</span>
- <span class='kw'>alias</span> <span class='const'>Nagios</span> <span class='const'>Administrators</span>
- <span class='id identifier rubyid_members'>members</span> <span class='id identifier rubyid_root'>root</span>
- <span class='rbrace'>}</span></pre>
-
-<p>Example of a parsed object:</p>
-
-<pre class="code">nagios.objects[:contactgroup]
-=&gt; {&quot;admins&quot;=&gt;{:contactgroup_name=&gt;&quot;admins&quot;, :alias=&gt;&quot;Nagios Administrators&quot;, :members=&gt;&quot;root&quot;}}
-
-nagios.contactgroup
-=&gt; {&quot;admins&quot;=&gt;{:contactgroup_name=&gt;&quot;admins&quot;, :alias=&gt;&quot;Nagios Administrators&quot;, :members=&gt;&quot;root&quot;}}</pre>
-
-<h3>Convenience methods</h3>
-
-<p>Method parse creates helper methods for every type of object after parsing.
-Same property can be accessed either using Hash @objects (i.e. <a
-href="http://:host">nagios.objects</a>) or convenience method: nagios.host.</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-111
-112
-113
-114
-115
-116
-117
-118
-119
-120
-121
-122
-123
-124
-125
-126
-127
-128
-129
-130
-131
-132
-133
-134
-135
-136
-137
-138
-139
-140</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/objects.rb', line 111</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_parse'>parse</span>
- <span class='id identifier rubyid_block'>block</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='id identifier rubyid_content'>content</span> <span class='op'>=</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readlines'>readlines</span> <span class='id identifier rubyid_objects_file'>objects_file</span>
- <span class='id identifier rubyid_handler'>handler</span> <span class='op'>=</span> <span class='kw'>nil</span>
- <span class='id identifier rubyid_content'>content</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_line'>line</span><span class='op'>|</span>
- <span class='kw'>case</span>
- <span class='kw'>when</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*$</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span> <span class='kw'>next</span> <span class='comment'># Skip empty lines
-</span> <span class='kw'>when</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*#</span><span class='regexp_end'>/</span></span> <span class='kw'>then</span> <span class='kw'>next</span> <span class='comment'># Skip comments
-</span> <span class='kw'>when</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>(\w+) \{</span><span class='regexp_end'>/</span></span> <span class='comment'># Block starts as &quot;define host {&quot;
-</span> <span class='id identifier rubyid_block'>block</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='id identifier rubyid_handler'>handler</span> <span class='op'>=</span> <span class='backref'>$1</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span>
- <span class='kw'>when</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>\}</span><span class='regexp_end'>/</span></span> <span class='comment'># End of block
-</span> <span class='comment'>#
-</span> <span class='comment'># Process it. Each block type has line &lt;type&gt;_name in the definition: host_name, command_name
-</span> <span class='comment'>#
-</span> <span class='ivar'>@objects</span><span class='lbracket'>[</span><span class='id identifier rubyid_handler'>handler</span><span class='rbracket'>]</span> <span class='op'>||=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='ivar'>@objects</span><span class='lbracket'>[</span><span class='id identifier rubyid_handler'>handler</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_handler'>handler</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span><span class='tstring_content'>_name</span><span class='tstring_end'>&quot;</span></span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='id identifier rubyid_block'>block</span>
- <span class='id identifier rubyid_block'>block</span> <span class='op'>=</span> <span class='lbrace'>{</span> <span class='rbrace'>}</span>
- <span class='kw'>when</span> <span class='id identifier rubyid_line'>line</span> <span class='op'>=~</span> <span class='tstring'><span class='regexp_beg'>/</span><span class='tstring_content'>^\s*(\w+)\s+([^\{\}]+)$</span><span class='regexp_end'>/</span></span> <span class='comment'># Build Hash from key-value pairs like: &quot;max_check_attempts 10&quot;
-</span> <span class='id identifier rubyid_block'>block</span><span class='lbracket'>[</span><span class='backref'>$1</span><span class='period'>.</span><span class='id identifier rubyid_to_sym'>to_sym</span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='backref'>$2</span><span class='period'>.</span><span class='id identifier rubyid_strip'>strip</span>
- <span class='kw'>end</span>
- <span class='kw'>end</span>
-
- <span class='comment'># Create instance methods for easy access to properties
-</span> <span class='ivar'>@objects</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_key'>key</span><span class='comma'>,</span><span class='id identifier rubyid_val'>val</span><span class='op'>|</span>
- <span class='id identifier rubyid_instance_variable_set'>instance_variable_set</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>@</span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_instance_eval'>instance_eval</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>def </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_key'>key</span><span class='rbrace'>}</span><span class='tstring_content'>; return </span><span class='embexpr_beg'>#{</span><span class='id identifier rubyid_val'>val</span><span class='rbrace'>}</span><span class='tstring_content'>; end</span><span class='tstring_end'>&quot;</span></span>
- <span class='kw'>end</span>
- <span class='kw'>self</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
-</div>
-
- <div id="footer">
- Generated on Fri Jan 13 10:23:36 2012 by
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
- 0.7.4 (ruby-1.9.3).
-</div>
-
- </body>
-</html>
779 doc/Nagios/Status.html
View
@@ -1,779 +0,0 @@
-<!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" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<title>
- Class: Nagios::Status
-
- &mdash; Documentation by YARD 0.7.4
-
-</title>
-
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
-
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
-
-<script type="text/javascript" charset="utf-8">
- relpath = '..';
- if (relpath != '') relpath += '/';
-</script>
-
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
-
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
-
-
- </head>
- <body>
- <script type="text/javascript" charset="utf-8">
- if (window.top.frames.main) document.body.className = 'frames';
- </script>
-
- <div id="header">
- <div id="menu">
-
- <a href="../_index.html">Index (S)</a> &raquo;
- <span class='title'><span class='object_link'><a href="../Nagios.html" title="Nagios (module)">Nagios</a></span></span>
- &raquo;
- <span class="title">Status</span>
-
-
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
-</div>
-
- <div id="search">
-
- <a id="class_list_link" href="#">Class List</a>
-
- <a id="method_list_link" href="#">Method List</a>
-
- <a id="file_list_link" href="#">File List</a>
-
-</div>
- <div class="clear"></div>
- </div>
-
- <iframe id="search_frame"></iframe>
-
- <div id="content"><h1>Class: Nagios::Status
-
-
-
-</h1>
-
-<dl class="box">
-
- <dt class="r1">Inherits:</dt>
- <dd class="r1">
- <span class="inheritName">Object</span>
-
- <ul class="fullTree">
- <li>Object</li>
-
- <li class="next">Nagios::Status</li>
-
- </ul>
- <a href="#" class="inheritanceTree">show all</a>
-
- </dd>
-
-
-
-
-
-
- <dt class="r2">Includes:</dt>
- <dd class="r2"><span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></dd>
-
-
-
-
-
- <dt class="r1 last">Defined in:</dt>
- <dd class="r1 last">lib/nagira/nagios.rb<span class="defines">,<br />
- lib/ruby-nagios/nagios/status.rb</span>
-</dd>
-
-</dl>
-<div class="clear"></div>
-
-<h2>Overview</h2><div class="docstring">
- <div class="discussion">
-
-<p>Extensions to Nagios::Status and Objects classes for use with Nagira: keep
-track of file modification times and parse only changed files.</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div>
- <h2>Constant Summary</h2>
-
-
-
-
-
-
-
- <h3 class="inherited">Constants included from <span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="TimedParse.html#MIN_PARSE_INTERVAL-constant" title="Nagios::TimedParse::MIN_PARSE_INTERVAL (constant)">MIN_PARSE_INTERVAL</a></span></p>
-
- <h2>Instance Attribute Summary <small>(<a href="#" class="summary_toggle">collapse</a>)</small></h2>
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#status-instance_method" title="#status (instance method)">- (Object) <strong>status</strong> </a>
-
-
-
- </span>
-
-
- <span class="note title readonly">readonly</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Returns the value of attribute status.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#statusfile-instance_method" title="#statusfile (instance method)">- (Object) <strong>statusfile</strong> </a>
-
-
-
- </span>
-
-
- <span class="note title readonly">readonly</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Returns the value of attribute statusfile.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
-
-
-
-
-
-
-
- <h3 class="inherited">Attributes included from <span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="TimedParse.html#last_changed-instance_method" title="Nagios::TimedParse#last_changed (method)">last_changed</a></span>, <span class='object_link'><a href="TimedParse.html#last_parsed-instance_method" title="Nagios::TimedParse#last_parsed (method)">last_parsed</a></span>, <span class='object_link'><a href="TimedParse.html#parse_interval-instance_method" title="Nagios::TimedParse#parse_interval (method)">parse_interval</a></span></p>
-
-
-
- <h2>
- Instance Method Summary
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
- </h2>
-
- <ul class="summary">
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#find_hosts-instance_method" title="#find_hosts (instance method)">- (Object) <strong>find_hosts</strong>(options = {}) </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Returns a list of all hosts matching the options in options.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#find_services-instance_method" title="#find_services (instance method)">- (Object) <strong>find_services</strong>(options = {}) </a>
-
-
-
- </span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Returns a list of all services matching the options in options.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Status) <strong>initialize</strong>(statusfile) </a>
-
-
-
- </span>
-
- <span class="note title constructor">constructor</span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>A new instance of Status.</p>
-</div></span>
-
-</li>
-
-
- <li class="public ">
- <span class="summary_signature">
-
- <a href="#parsestatus-instance_method" title="#parsestatus (instance method)">- (Object) <strong>parsestatus</strong> </a>
-
-
-
- (also: #parse)
-
- </span>
-
-
-
-
-
-
-
-
- <span class="summary_desc"><div class='inline'>
-<p>Parses a nagios status file returning a data structure for all the data.</p>
-</div></span>
-
-</li>
-
-
- </ul>
-
-
-
-
-
-
-
-
-
-
- <h3 class="inherited">Methods included from <span class='object_link'><a href="TimedParse.html" title="Nagios::TimedParse (module)">TimedParse</a></span></h3>
- <p class="inherited"><span class='object_link'><a href="TimedParse.html#changed%3F-instance_method" title="Nagios::TimedParse#changed? (method)">#changed?</a></span>, <span class='object_link'><a href="TimedParse.html#included-class_method" title="Nagios::TimedParse.included (method)">included</a></span>, <span class='object_link'><a href="TimedParse.html#need_parsing%3F-instance_method" title="Nagios::TimedParse#need_parsing? (method)">#need_parsing?</a></span></p>
-<div id="constructor_details" class="method_details_list">
- <h2>Constructor Details</h2>
-
- <div class="method_details first">
- <p class="signature first" id="initialize-instance_method">
-
- - (<tt><span class='object_link'><a href="" title="Nagios::Status (class)">Status</a></span></tt>) <strong>initialize</strong>(statusfile)
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>A new instance of Status</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-<h3>Raises:</h3>
-<ul class="raise">
-
- <li>
-
-
- <span class='type'>(<tt>ArgumentError</tt>)</span>
-
-
-
- </li>
-
-</ul>
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-6
-7
-8
-9
-10
-11
-12
-13
-14
-15</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/status.rb', line 6</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_statusfile'>statusfile</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>ArgumentError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Statusfile file name must be provided</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='id identifier rubyid_statusfile'>statusfile</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Statusfile does not exist</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_exist?'>exist?</span> <span class='id identifier rubyid_statusfile'>statusfile</span>
- <span class='id identifier rubyid_raise'>raise</span> <span class='const'>RuntimeError</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>Statusfile is not readable</span><span class='tstring_end'>&quot;</span></span> <span class='kw'>unless</span> <span class='const'>File</span><span class='period'>.</span><span class='id identifier rubyid_readable?'>readable?</span> <span class='id identifier rubyid_statusfile'>statusfile</span>
- <span class='ivar'>@statusfile</span> <span class='op'>=</span> <span class='id identifier rubyid_statusfile'>statusfile</span>
- <span class='ivar'>@status</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
- <span class='ivar'>@status</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>hosts</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
-
- <span class='kw'>self</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-</div>
-
- <div id="instance_attr_details" class="attr_details">
- <h2>Instance Attribute Details</h2>
-
-
- <span id=""></span>
- <span id="status-instance_method"></span>
- <div class="method_details first">
- <p class="signature first" id="status-instance_method">
-
- - (<tt>Object</tt>) <strong>status</strong> <span class="extras">(readonly)</span>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Returns the value of attribute status</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-3
-4
-5</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/status.rb', line 3</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_status'>status</span>
- <span class='ivar'>@status</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
-
- <span id=""></span>
- <span id="statusfile-instance_method"></span>
- <div class="method_details ">
- <p class="signature " id="statusfile-instance_method">
-
- - (<tt>Object</tt>) <strong>statusfile</strong> <span class="extras">(readonly)</span>
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Returns the value of attribute statusfile</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-3
-4
-5</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/status.rb', line 3</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_statusfile'>statusfile</span>
- <span class='ivar'>@statusfile</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- </div>
-
-
- <div id="instance_method_details" class="method_details_list">
- <h2>Instance Method Details</h2>
-
-
- <div class="method_details first">
- <p class="signature first" id="find_hosts-instance_method">
-
- - (<tt>Object</tt>) <strong>find_hosts</strong>(options = {})
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Returns a list of all hosts matching the options in options</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-49
-50
-51
-52
-53
-54
-55
-56
-57
-58
-59
-60
-61
-62
-63
-64
-65
-66
-67
-68
-69
-70
-71
-72
-73
-74
-75
-76
-77
-78
-79</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/status.rb', line 49</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_find_hosts'>find_hosts</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_forhost'>forhost</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:forhost</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_notifications'>notifications</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:notifyenabled</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_action'>action</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:action</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_withservice'>withservice</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:withservice</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
-
- <span class='id identifier rubyid_hosts'>hosts</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
- <span class='id identifier rubyid_searchquery'>searchquery</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
-
- <span class='comment'># Build up a search query for find_with_properties each
-</span> <span class='comment'># array member is a hash of property and a match
-</span> <span class='id identifier rubyid_forhost'>forhost</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_host'>host</span><span class='op'>|</span>
- <span class='id identifier rubyid_searchquery'>searchquery</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_search_term'>search_term</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>host_name</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_host'>host</span><span class='rparen'>)</span>
- <span class='kw'>end</span>
-
- <span class='id identifier rubyid_withservice'>withservice</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_s'>s</span><span class='op'>|</span>
- <span class='id identifier rubyid_searchquery'>searchquery</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_search_term'>search_term</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>service_description</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_s'>s</span><span class='rparen'>)</span>
- <span class='kw'>end</span>
-
- <span class='id identifier rubyid_searchquery'>searchquery</span> <span class='op'>&lt;&lt;</span> <span class='lbrace'>{</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>notifications_enabled</span><span class='tstring_end'>&quot;</span></span> <span class='op'>=&gt;</span> <span class='id identifier rubyid_notifications'>notifications</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='rbrace'>}</span> <span class='kw'>if</span> <span class='id identifier rubyid_notifications'>notifications</span>
-
- <span class='id identifier rubyid_hsts'>hsts</span> <span class='op'>=</span> <span class='id identifier rubyid_find_with_properties'>find_with_properties</span><span class='lparen'>(</span><span class='id identifier rubyid_searchquery'>searchquery</span><span class='rparen'>)</span>
-
- <span class='id identifier rubyid_hsts'>hsts</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_host'>host</span><span class='op'>|</span>
- <span class='id identifier rubyid_host_name'>host_name</span> <span class='op'>=</span> <span class='id identifier rubyid_host'>host</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>host_name</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span>
-
- <span class='id identifier rubyid_hosts'>hosts</span> <span class='op'>&lt;&lt;</span> <span class='id identifier rubyid_parse_command_template'>parse_command_template</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_host_name'>host_name</span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_end'>&quot;</span></span><span class='comma'>,</span> <span class='id identifier rubyid_host_name'>host_name</span><span class='rparen'>)</span>
- <span class='kw'>end</span>
-
- <span class='id identifier rubyid_hosts'>hosts</span><span class='period'>.</span><span class='id identifier rubyid_uniq'>uniq</span><span class='period'>.</span><span class='id identifier rubyid_sort'>sort</span>
-<span class='kw'>end</span></pre>
- </td>
- </tr>
-</table>
-</div>
-
- <div class="method_details ">
- <p class="signature " id="find_services-instance_method">
-
- - (<tt>Object</tt>) <strong>find_services</strong>(options = {})
-
-
-
-</p><div class="docstring">
- <div class="discussion">
-
-<p>Returns a list of all services matching the options in options</p>
-
-
- </div>
-</div>
-<div class="tags">
-
-
-</div><table class="source_code">
- <tr>
- <td>
- <pre class="lines">
-
-
-82
-83
-84
-85
-86
-87
-88
-89
-90
-91
-92
-93
-94
-95
-96
-97
-98
-99
-100
-101
-102
-103
-104
-105
-106
-107
-108
-109
-110
-111
-112
-113
-114
-115
-116
-117
-118</pre>
- </td>
- <td>
- <pre class="code"><span class="info file"># File 'lib/ruby-nagios/nagios/status.rb', line 82</span>
-
-<span class='kw'>def</span> <span class='id identifier rubyid_find_services'>find_services</span><span class='lparen'>(</span><span class='id identifier rubyid_options'>options</span> <span class='op'>=</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_forhost'>forhost</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:forhost</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_notifications'>notifications</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:notifyenabled</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_action'>action</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:action</span><span class='comma'>,</span> <span class='kw'>nil</span><span class='rparen'>)</span>
- <span class='id identifier rubyid_withservice'>withservice</span> <span class='op'>=</span> <span class='id identifier rubyid_options'>options</span><span class='period'>.</span><span class='id identifier rubyid_fetch'>fetch</span><span class='lparen'>(</span><span class='symbol'>:withservice</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'