The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.
<html><head><title>smonitor</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >

<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
BODY {
  background: white;
  color: black;
  font-family: arial,sans-serif;
  margin: 0;
  padding: 1ex;
}

A:link, A:visited {
  background: transparent;
  color: #006699;
}

A[href="#POD_ERRORS"] {
  background: transparent;
  color: #FF0000;
}

DIV {
  border-width: 0;
}

DT {
  margin-top: 1em;
  margin-left: 1em;
}

.pod { margin-right: 20ex; }

.pod PRE     {
  background: #eeeeee;
  border: 1px solid #888888;
  color: black;
  padding: 1em;
  white-space: pre;
}

.pod H1      {
  background: transparent;
  color: #006699;
  font-size: large;
}

.pod H1 A { text-decoration: none; }
.pod H2 A { text-decoration: none; }
.pod H3 A { text-decoration: none; }
.pod H4 A { text-decoration: none; }

.pod H2      {
  background: transparent;
  color: #006699;
  font-size: medium;
}

.pod H3      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-style: italic;
}

.pod H4      {
  background: transparent;
  color: #006699;
  font-size: medium;
  font-weight: normal;
}

.pod IMG     {
  vertical-align: top;
}

.pod .toc A  {
  text-decoration: none;
}

.pod .toc LI {
  line-height: 1.2em;
  list-style-type: none;
}

  /*]]>*/-->
</style>


</head>
<body class='pod'>
<!--
  generated by Pod::Simple::HTML v3.20,
  using Pod::Simple::PullParser v3.20,
  under Perl v5.012004 at Sat Apr  7 11:59:12 2012 GMT.

 If you want to change this HTML document, you probably shouldn't do that
   by changing it directly.  Instead, see about changing the calling options
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name='___top' class='dummyTopAnchor' ></a>

<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#VERSION'>VERSION</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <li class='indexItem indexItem1'><a href='#OPTIONS'>OPTIONS</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#-cfg_%3Cconfig-file%3E'>-cfg &#60;config-file&#62;</a>
    <li class='indexItem indexItem2'><a href='#-service_%3Cservice-name%3E_%5B%3Cservice-name%3E...%5D'>-service &#60;service-name&#62; [&#60;service-name&#62;...]</a>
    <li class='indexItem indexItem2'><a href='#-outfile_%3Cfile%3E'>-outfile &#60;file&#62;</a>
    <li class='indexItem indexItem2'><a href='#-onlyerr'>-onlyerr</a>
    <li class='indexItem indexItem2'><a href='#-format_human_%7C_tsv_%7C_html'>-format human | tsv | html</a>
    <li class='indexItem indexItem2'><a href='#-cssurl_%3Curl%3E'>-cssurl &#60;url&#62;</a>
    <li class='indexItem indexItem2'><a href='#-npp_%3Cinteger%3E'>-npp &#60;integer&#62;</a>
    <li class='indexItem indexItem2'><a href='#-nonotif'>-nonotif</a>
    <li class='indexItem indexItem2'><a href='#Logging_options'>Logging options</a>
    <li class='indexItem indexItem2'><a href='#-showcfg'>-showcfg</a>
    <li class='indexItem indexItem2'><a href='#-lf'>-lf</a>
    <li class='indexItem indexItem2'><a href='#General_options'>General options</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#AUTHOR'>AUTHOR</a>
  <li class='indexItem indexItem1'><a href='#COPYRIGHT_AND_LICENSE'>COPYRIGHT AND LICENSE</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>smonitor - command-line tool for monitoring services</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="VERSION"
>VERSION</a></h1>

<p>version 0.2.5</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<pre>   smonitor [-cfg &#60;file&#62;] [&#60;output-options&#62;] [&#60;log-options&#62;] [&#60;other-options&#62;]
      where &#60;output-options&#62; are: -outfile &#60;file&#62;
                                  -onlyerr
                                  -format human | tsv | html
                                  -cssurl &#60;url&#62;
      where &#60;log-options&#62; are:    -logfile &#60;file&#62;
                                  -loglevel debug | info | warn | error | fatal
                                  -debug
                                  -logformat &#60;template&#62;
      where &#60;other-options&#62; are:  -npp &#60;integer&#62;
                                  -service[s] &#60;service-name&#62; [&#60;service-name&#62;...]
                                  -nonotif

   smonitor -showcfg
   smonitor -lf

   smonitor -h
   smonitor -help
   smonitor -man
   smonitor -version</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p><b>smonitor</b> is a command-line tool for monitoring (checking) various services and other parts of your IT infrastructure. In order to run it, you need to have a configuration file that defines what services to check and how to do the checking. Details how to create such configuration file are in the documentation of the Perl module <i>Monitor::Simple</i>; just type:</p>

<pre>   perldoc Monitor::Simple</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="OPTIONS"
>OPTIONS</a></h1>

<p>The command-line arguments and options can be specified with single or double dash. Most of them can be abbreviated to the nearest unbiased length. They are case-sensitive.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-cfg_&#60;config-file&#62;"
>-cfg &#60;config-file&#62;</a></h2>

<p>It specifies what configuration file to use (read: what services to check). By default, it uses file <em>monitor-simple-cfg.xml</em>.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-service_&#60;service-name&#62;_[&#60;service-name&#62;...]"
>-service &#60;service-name&#62; [&#60;service-name&#62;...]</a></h2>

<p>By default, <i>smonitor</i> checks all services specified in the configuration file. This parameter can select only some services. For example:</p>

<pre>   smonitor -cfg my.cfg -service synonia mrs</pre>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-outfile_&#60;file&#62;"
>-outfile &#60;file&#62;</a></h2>

<p>It specifies a file where the report about checking is written to. By default, it is written to standard output (but see also possible combinations with <code>-onlyerr</code> option).</p>

<p>A note about <i>notifications</i>: This parameter <code>-outfile</code> has nothing to do with notifications. The notifications are messages about the status of individual services and they are defined (if at all) in the configuration file (where it is also specified where to send them and how to format them). You cannot influence notifications by any parameter of the <i>smonitor</i>. Well, it is not entirely true: You can use parameter <code>-nonotif</code> to disable all notifications.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-onlyerr"
>-onlyerr</a></h2>

<p>This option influences what will be reported on the standard output (STDOUT). The overall behaviour depends on the combination of <code>-outfile</code> and <code>-onlyerr</code> parameters:</p>

<pre>   -outfile &#60;file&#62;    -onlyerr    what will be done
   -----------------------------------------------------
   yes                no         all output to &#60;file&#62;

   yes                yes        all output to &#60;file&#62;
                                 + errors also on STDOUT

   no                 no         all output to STDOUT

   no                 yes        only errors to STDOUT</pre>

<p>The variety of output destinations allows to run <i>smonitor</i> as a &#34;cron&#34; job (a scheduled job) and to decide when the scheduling system reports the results. Just remember that these reports, sent by the scheduling system, are not the same as notifications defined in the configuration file - these two ways how to report status of services are independent and both can be used in the same time.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-format_human_|_tsv_|_html"
>-format human | tsv | html</a></h2>

<p>How the report will be formatted. Default is <code>human</code>:</p>

<pre>   DATE                           SERVICE                 STATUS  MESSAGE
   Tue Sep 27 10:40:15 2011       Memory Check                 2  Memory CRITICAL - 91.7% (1601124 kB) used
   Tue Sep 27 10:40:15 2011       Current timestamp            0  Tue Sep 27 10:40:15 2011
   Tue Sep 27 10:40:15 2011       Born To Be Killed            2  Plugin &#39;Monitor/Simple/plugins/born-to-be-killed.pl&#39; died with signal 9

   Tue Sep 27 10:40:15 2011       Synonia Bad Params           2  500 Can&#39;t connect to Xdb.cbrc.kaust.edu.sa:80...</pre>

<p>The <code>tsv</code> is a TAB-separated output, without any header line. The <code>html</code> format creates a simple HTML page with the report.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-cssurl_&#60;url&#62;"
>-cssurl &#60;url&#62;</a></h2>

<p>This is used only when <code>-format html</code> is used. It specifies a URL of a CSS-stylesheet that can change the look-and-feel of the HTML report page. See the source of the page for the CSS-classes names.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-npp_&#60;integer&#62;"
>-npp &#60;integer&#62;</a></h2>

<p>A not much used parameter, rather a technical one: it specifies maximum number of parallel checks. Because each check is done by a new process, the <code>npp</code> parameter actually stands for &#34;Number of Parallel Processes&#34;. Default is 10.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-nonotif"
>-nonotif</a></h2>

<p>This options disables executing all notifications (as they are defined in the configuration file). It is, for example, useful when you are testing a new configuration file and you do not wish to send emails, etc. about it</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Logging_options"
>Logging options</a></h2>

<p>Additional to the report about the status of services (parameters <code>-outfile</code> and <code>-onlyerr</code>) and to the notifications (defined in the configuration file) there is also a logging mechanism that helps to trace how the checking is done in more details. The logging is defined by few logging parameters - they all have reasonable default values.</p>

<dl>
<dt><a name="-logfile_&#60;logfile&#62;"
><b>-logfile &#60;logfile</b>&#62;</a></dt>

<dd>
<p>Where to put log records. By default, it appends records to the file <em>smonitor.log</em> (which is created if it does not exist yet). You can also specify <code>STDOUT</code> as the logfile:</p>

<pre>   -logfile STDOUT</pre>

<dt><a name="-loglevel_debug_|_info_|_warn_|_error_|_fatal"
><b>-loglevel debug | info | warn | error | fatal</b></a></dt>

<dd>
<p>Each log record has its level of importance (five possible levels: from <code>debug</code> to <code>fatal</code>). This parameter tells which log records (read: records of what importance) will be created. A level means also all levels &#34;below&#34; it. For example, level <code>warn</code> includes <code>warn</code>, <code>error</code> and <code>fatal</code> messages. Default level is <code>info</code>.</p>

<dt><a name="-debug"
><b>-debug</b></a></dt>

<dd>
<p>It is the same as <code>-loglevel debug</code>.</p>

<dt><a name="-logformat_&#60;string&#62;"
><b>-logformat &#60;string</b>&#62;</a></dt>

<dd>
<p>It specifies how to format log records. Default format is &#34;%d&#160;(%r)&#160;%p %m%n&#62;&#34; when the log records look like this:</p>

<pre>   2011/09/27 12:18:50 (97)  INFO&#62; --- Checking started ---
   2011/09/27 12:18:50 (100) DEBUG&#62; Started: Monitor/Simple/plugins/check_mem.pl -u -w 55 -c 80
   2011/09/27 12:18:50 (100) DEBUG&#62; Started: Monitor/Simple/plugins/check-url.pl -cfg configs/simple-example-cfg.xml -service pubmed -logfile a.log -loglevel debug
   2011/09/27 12:18:50 (30)  DEBUG&#62; Invoking HTTP HEAD: http://www.ncbi.nlm.nih.gov/pubmed/
   2011/09/27 12:18:51 (760) INFO&#62; Done: pubmed 0 OK
   2011/09/27 12:18:51 (971) INFO&#62; --- Checking finished [0.872014999389648 s] ---</pre>

<p>The columns in this examples are: date (%d), number of milliseconds from the moment smonitor was started (%r), log level (%p) and log message (%m). More details about formats are in the Perl module <i>Log::Log4perl</i>.</p>
</dd>
</dl>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-showcfg"
>-showcfg</a></h2>

<p>It prints the name of the used configuration file and its content and it exits. It is rather for debugging.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="-lf"
>-lf</a></h2>

<p>It prints the currently available formats (the values recognizable by the <code>-format</code> parameter) and exits:</p>

<pre>   $&#62; smonitor -lf
   html    Formatted as an HTML document
   human   Easier readable by humans
   tsv     TAB-separated (good for machines)</pre>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="General_options"
>General options</a></h2>

<dl>
<dt><a name="-h"
><b>-h</b></a></dt>

<dd>
<p>Print a brief usage message and exits.</p>

<dt><a name="-help"
><b>-help</b></a></dt>

<dd>
<p>Print a brief usage message with options and exits.</p>

<dt><a name="-man"
><b>-man</b></a></dt>

<dd>
<p>Print a full usage message and exits.</p>

<dt><a name="-version"
><b>-version</b></a></dt>

<dd>
<p>Print the version and exits.</p>
</dd>
</dl>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="AUTHOR"
>AUTHOR</a></h1>

<p>Martin Senger &#60;martin.senger@gmail.com&#62;</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="COPYRIGHT_AND_LICENSE"
>COPYRIGHT AND LICENSE</a></h1>

<p>This software is copyright (c) 2012 by Martin Senger, CBRC-KAUST (Computational Biology Research Center - King Abdullah University of Science and Technology) All Rights Reserved.</p>

<p>This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.</p>

<!-- end doc -->

</body></html>