<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- os_sup</title> </head> <body bgcolor="white" text="#000000" link="#0000ff" vlink="#ff00ff" alink="#ff0000"><div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <img alt="Erlang logo" src="../../../../doc/erlang-logo.png"><br><small><a href="index.html">Reference Manual</a><br><a href="release_notes.html">Release Notes</a><br><a href="../pdf/os_mon-2.2.5.pdf">PDF</a><br><a href="../../../../doc/index.html">Top</a></small><p><strong>OS_Mon</strong><br><strong>Reference Manual</strong><br><small>Version 2.2.5</small></p> <br><a href="javascript:openAllFlips()">Expand All</a><br><a href="javascript:closeAllFlips()">Contract All</a><p><small><strong>Table of Contents</strong></small></p> <ul class="flipMenu"> <li title="os_mon (App)"><a href="os_mon_app.html">os_mon (App) </a></li> <li id="no" title="cpu_sup " expanded="false">cpu_sup<ul> <li><a href="cpu_sup.html"> Top of manual page </a></li> <li title="nprocs-0"><a href="cpu_sup.html#nprocs-0">nprocs/0</a></li> <li title="avg1-0"><a href="cpu_sup.html#avg1-0">avg1/0</a></li> <li title="avg5-0"><a href="cpu_sup.html#avg5-0">avg5/0</a></li> <li title="avg15-0"><a href="cpu_sup.html#avg15-0">avg15/0</a></li> <li title="util-0"><a href="cpu_sup.html#util-0">util/0</a></li> <li title="util-1"><a href="cpu_sup.html#util-1">util/1</a></li> </ul> </li> <li id="no" title="disksup " expanded="false">disksup<ul> <li><a href="disksup.html"> Top of manual page </a></li> <li title="get_disk_data-0"><a href="disksup.html#get_disk_data-0">get_disk_data/0</a></li> <li title="get_check_interval-0"><a href="disksup.html#get_check_interval-0">get_check_interval/0</a></li> <li title="set_check_interval-1"><a href="disksup.html#set_check_interval-1">set_check_interval/1</a></li> <li title="get_almost_full_threshold-0"><a href="disksup.html#get_almost_full_threshold-0">get_almost_full_threshold/0</a></li> <li title="set_almost_full_threshold-1"><a href="disksup.html#set_almost_full_threshold-1">set_almost_full_threshold/1</a></li> </ul> </li> <li id="no" title="memsup " expanded="false">memsup<ul> <li><a href="memsup.html"> Top of manual page </a></li> <li title="get_memory_data-0"><a href="memsup.html#get_memory_data-0">get_memory_data/0</a></li> <li title="get_system_memory_data-0"><a href="memsup.html#get_system_memory_data-0">get_system_memory_data/0</a></li> <li title="get_os_wordsize-0"><a href="memsup.html#get_os_wordsize-0">get_os_wordsize/0</a></li> <li title="get_check_interval-0"><a href="memsup.html#get_check_interval-0">get_check_interval/0</a></li> <li title="set_check_interval-1"><a href="memsup.html#set_check_interval-1">set_check_interval/1</a></li> <li title="get_procmem_high_watermark-0"><a href="memsup.html#get_procmem_high_watermark-0">get_procmem_high_watermark/0</a></li> <li title="set_procmem_high_watermark-1"><a href="memsup.html#set_procmem_high_watermark-1">set_procmem_high_watermark/1</a></li> <li title="get_sysmem_high_watermark-0"><a href="memsup.html#get_sysmem_high_watermark-0">get_sysmem_high_watermark/0</a></li> <li title="set_sysmem_high_watermark-1"><a href="memsup.html#set_sysmem_high_watermark-1">set_sysmem_high_watermark/1</a></li> <li title="get_helper_timeout-0"><a href="memsup.html#get_helper_timeout-0">get_helper_timeout/0</a></li> <li title="set_helper_timeout-1"><a href="memsup.html#set_helper_timeout-1">set_helper_timeout/1</a></li> </ul> </li> <li id="no" title="os_mon_mib " expanded="false">os_mon_mib<ul> <li><a href="os_mon_mib.html"> Top of manual page </a></li> <li title="load-1"><a href="os_mon_mib.html#load-1">load/1</a></li> <li title="unload-1"><a href="os_mon_mib.html#unload-1">unload/1</a></li> </ul> </li> <li id="loadscrollpos" title="os_sup " expanded="true">os_sup<ul> <li><a href="os_sup.html"> Top of manual page </a></li> <li title="enable-0"><a href="os_sup.html#enable-0">enable/0</a></li> <li title="enable-2"><a href="os_sup.html#enable-2">enable/2</a></li> <li title="disable-0"><a href="os_sup.html#disable-0">disable/0</a></li> <li title="disable-2"><a href="os_sup.html#disable-2">disable/2</a></li> </ul> </li> <li id="no" title="nteventlog " expanded="false">nteventlog<ul> <li><a href="nteventlog.html"> Top of manual page </a></li> <li title="start-2"><a href="nteventlog.html#start-2">start/2</a></li> <li title="start_link-2"><a href="nteventlog.html#start_link-2">start_link/2</a></li> <li title="stop-0"><a href="nteventlog.html#stop-0">stop/0</a></li> </ul> </li> </ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>os_sup</h1></center> <h3>MODULE</h3> <div class="REFBODY">os_sup</div> <h3>MODULE SUMMARY</h3> <div class="REFBODY">Interface to OS System Messages</div> <h3>DESCRIPTION</h3> <div class="REFBODY"><p> <p><span class="code">os_sup</span> is a process providing a message passing service from the operating system to the error logger in the Erlang runtime system. It is part of the OS_Mon application, see <span class="bold_code"><a href="os_mon_app.html">os_mon(6)</a></span>. Available for Solaris and Windows.</p> <p>Messages received from the operating system results in an user defined callback function being called. This function can do whatever filtering and formatting is necessary and then deploy any type of logging suitable for the user's application.</p> </p></div> <h3><a name="id2260068">Solaris Operation</a></h3> <div class="REFBODY"> <p>The Solaris (SunOS 5.x) messages are retrieved from the syslog-daemon, <span class="code">syslogd</span>.</p> <p>Enabling the service includes actions which require root privileges, such as change of ownership and file privileges of an executable binary file, and creating a modified copy of the configuration file for <span class="code">syslogd</span>. When <span class="code">os_sup</span> is terminated, the service must be disabled, meaning the original configuration must be restored. Enabling/disabling can be done either outside or inside <span class="code">os_sup</span>, see <span class="bold_code"><a href="#config">Configuration</a></span> below.</p> <div class="warning"> <div class="label">Warning</div> <div class="content"><p> <p>This process cannot run in multiple instances on the same hardware. OS_Mon must be configured to start <span class="code">os_sup</span> on one node only if two or more Erlang nodes execute on the same machine.</p> </p></div> </div> <p>The format of received events is not defined.</p> </div> <h3><a name="id2260131">Windows Operation</a></h3> <div class="REFBODY"> <p>The Windows messages are retrieved from the eventlog file.</p> <p>The <span class="code">nteventlog</span> module is used to implement <span class="code">os_sup</span>. See <span class="bold_code"><a href="nteventlog.html">nteventlog(3)</a></span>. Note that the start functions of <span class="code">nteventlog</span> does not need to be used, in this case the process is started automatically as part of the OS_Mon supervision tree.</p> <p>OS messages are formatted as a tuple <span class="code">{Time, Category, Facility, Severity, Message}</span>:</p> <dl> <dt><strong><span class="code">Time = {MegaSecs, Secs, MicroSecs}</span></strong></dt> <dd> <p>A time stamp as returned by the BIF <span class="code">now()</span>.</p> </dd> <dt><strong><span class="code">Category = string()</span></strong></dt> <dd> <p>Usually one of <span class="code">"System"</span>, <span class="code">"Application"</span> or <span class="code">"Security"</span>. Note that the NT eventlog viewer has another notion of category, which in most cases is totally meaningless and therefore not imported into Erlang. What is called a category here is one of the main three types of events occurring in a normal NT system.</p> </dd> <dt><strong><span class="code">Facility = string()</span></strong></dt> <dd> <p>The source of the message, usually the name of the application that generated it. This could be almost any string. When matching messages from certain applications, the version number of the application may have to be accounted for. This is what the NT event viewer calls "source".</p> </dd> <dt><strong><span class="code">Severity = string()</span></strong></dt> <dd> <p>One of <span class="code">"Error"</span>, <span class="code">"Warning"</span>, <span class="code">"Informational"</span>, <span class="code">"Audit_Success"</span>, <span class="code">"Audit_Faulure"</span> or, in case of a currently unknown Windows NT version <span class="code">"Severity_Unknown"</span>.</p> </dd> <dt><strong><span class="code">Message = string()</span></strong></dt> <dd> <p>Formatted exactly as it would be in the NT eventlog viewer. Binary data is not imported into Erlang.</p> </dd> </dl> </div> <h3><a name="id2260298">Configuration</a></h3> <div class="REFBODY"> <a name="config"></a> <dl> <dt><strong><span class="code">os_sup_mfa = {Module, Function, Args}</span></strong></dt> <dd> <p>The callback function to use. <span class="code">Module</span> and <span class="code">Function</span> are atoms and <span class="code">Args</span> is a list of terms. When an OS message <span class="code">Msg</span> is received, this function is called as <span class="code">apply(Module, Function, [Msg | Args])</span>.</p> <p>Default is <span class="code">{os_sup, error_report, [Tag]}</span> which will send the event to the error logger using <span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','error_logger.html#error_report-2');">error_logger:error_report(Tag, Msg)</a></span>. <span class="code">Tag</span> is the value of <span class="code">os_sup_errortag</span>, see below.</p> </dd> <dt><strong><span class="code">os_sup_errortag = atom()</span></strong></dt> <dd> <p>This parameter defines the error report type used when messages are sent to error logger using the default callback function. Default is <span class="code">std_error</span>, which means the events are handled by the standard event handler.</p> </dd> <dt><strong><span class="code">os_sup_enable = bool()</span></strong></dt> <dd> <p>Solaris only. Defines if the service should be enabled (and disabled) inside (<span class="code">true</span>) or outside (<span class="code">false</span>) <span class="code">os_sup</span>. For backwards compatibility reasons, the default is <span class="code">true</span>. The recommended value is <span class="code">false</span>, as the Erlang emulator should normally not be run with <span class="code">root</span> privileges, as is required for enabling the service.</p> </dd> <dt><strong><span class="code">os_sup_own = string()</span></strong></dt> <dd> <p>Solaris only. Defines the directory which contains the backup copy and the Erlang specific configuration files for <span class="code">syslogd</span>, and a named pipe to receive the messages from <span class="code">syslogd</span>. Default is <span class="code">"/etc"</span>.</p> </dd> <dt><strong><span class="code">os_sup_syslogconf = string()</span></strong></dt> <dd> <p>Solaris only. Defines the full name of the configuration file for <span class="code">syslogd</span>. Default is <span class="code">"/etc/syslog.conf"</span>.</p> </dd> </dl> </div> <h3>EXPORTS</h3> <p><a name="enable-0"><span class="bold_code">enable() -> ok | {error, Res}</span></a><br><a name="enable-2"><span class="bold_code">enable(Dir, Conf) -> ok | {error, Error}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Dir = Conf = Res = string()</span><br> </div> </div> <div class="REFBODY"><p> <p>Enables the <span class="code">os_sup</span> service. Needed on Solaris only.</p> <p>If the configuration parameter <span class="code">os_sup_enable</span> is <span class="code">false</span>, this function is called automatically by <span class="code">os_sup</span>, using the values of <span class="code">os_sup_own</span> and <span class="code">os_sup_syslogconf</span> as arguments.</p> <p>If <span class="code">os_sup_enable</span> is <span class="code">true</span>, this function must be called <strong>before</strong> OS_Mon/<span class="code">os_sup</span> is started. <span class="code">Dir</span> defines the directory which contains the backup copy and the Erlang specific configuration files for <span class="code">syslogd</span>, and a named pipe to receive the messages from <span class="code">syslogd</span>. Defaults to <span class="code">"/etc"</span>. <span class="code">Conf</span> defines the full name of the configuration file for <span class="code">syslogd</span>. Default is <span class="code">"/etc/syslog.conf"</span>.</p> <p>Results in a OS call to:</p> <div class="example"><pre> <PRIVDIR>/bin/mod_syslog otp Dir Conf </pre></div> <p>where <span class="code"><PRIVDIR></span> is the <span class="code">priv</span> directory of OS_Mon, <span class="code">code:priv_dir(os_mon)</span>.</p> <p>Returns <span class="code">ok</span> if this yields the expected result <span class="code">"0"</span>, and <span class="code">{error, Res}</span> if it yields anything else.</p> <div class="note"> <div class="label">Note</div> <div class="content"><p> <p>This function requires root privileges to succeed.</p> </p></div> </div> </p></div> <p><a name="disable-0"><span class="bold_code">disable() -> ok | {error, Res}</span></a><br><a name="disable-2"><span class="bold_code">disable(Dir, Conf) -> ok | {error, Error}</span></a><br></p> <div class="REFBODY"> <p>Types:</p> <div class="REFTYPES"> <span class="bold_code">Dir = Conf = Res = string()</span><br> </div> </div> <div class="REFBODY"><p> <p>Disables the <span class="code">os_sup</span> service. Needed on Solaris only.</p> <p>If the configuration parameter <span class="code">os_sup_enable</span> is <span class="code">false</span>, this function is called automatically by <span class="code">os_sup</span>, using the same arguments as when <span class="code">enable/2</span> was called.</p> <p>If <span class="code">os_sup_enable</span> is <span class="code">true</span>, this function must be called <strong>after</strong> OS_Mon/<span class="code">os_sup</span> is stopped. <span class="code">Dir</span> defines the directory which contains the backup copy and the Erlang specific configuration files for <span class="code">syslogd</span>, and a named pipe to receive the messages from <span class="code">syslogd</span>. Defaults to <span class="code">"/etc"</span>. <span class="code">Conf</span> defines the full name of the configuration file for <span class="code">syslogd</span>. Default is <span class="code">"/etc/syslog.conf"</span>.</p> <p>Results in a OS call to:</p> <div class="example"><pre> <PRIVDIR>/bin/mod_syslog nootp Dir Conf </pre></div> <p>where <span class="code"><PRIVDIR></span> is the <span class="code">priv</span> directory of OS_Mon, <span class="code">code:priv_dir(os_mon)</span>.</p> <p>Returns <span class="code">ok</span> if this yields the expected result <span class="code">"0"</span>, and <span class="code">{error, Res}</span> if it yields anything else.</p> <div class="note"> <div class="label">Note</div> <div class="content"><p> <p>This function requires root privileges to succeed.</p> </p></div> </div> </p></div> <h3><a name="id2262493">See also</a></h3> <div class="REFBODY"> <p><span class="bold_code"><a href="javascript:erlhref('../../../../doc/../','kernel','error_logger.html');">error_logger(3)</a></span>, <span class="bold_code"><a href="os_mon_app.html">os_mon(3)</a></span></p> <p><span class="code">syslogd(1M)</span>, <span class="code">syslog.conf(4)</span> in the Solaris documentation.</p> <p></p> </div> </div> <div class="footer"> <hr> <p>Copyright © 1997-2010 Ericsson AB. All Rights Reserved.</p> </div> </div> </div></body> </html>