<p>&nbsp;</p>
<h3>RRDAlarm</h3>
<p>RRDAlarm is a tool design to work in conjunction with <b>ntop</b> to let you configure and check a certain number of thresholds for any rrd file generated by <b>ntop</b>. During the checking if a threshold is exceeded the action defined for that specific threshold will be launched, in this manner you can configure, for example, a mailing script to send you a mail for any abnormality that you want to control over your network. This piece of software is written in python and included in <b>ntop</b> through two dynamic loaded modules, ntop and host (look at python.c), provided as an extension to python by <b>ntop</b> itself. 

<h3>RRDAlarm configuration </h3>
<p>RRDAlarm needs a configuration file to actually do the checking, this file must contain the thresholds to check and all the data necessary to perform the action established in correspondence of the trespass of a threshold. To generate the configuration you have to fill the table (Utils -> RRDAlarm -> Configure Thresholds) with rows, each row represent a threshold. Every time you modify the table you can save it clicking the Save Config button at the bottom of the table. You can still provide a manually written configuration file (appropriately formatted of course), place it in the right directory and call the ../python/rrdalarm/start.py script, but you'll find the configuration page to be more easy and good looking than edit everything manually. Moreover using this tool you can create multiple configuration files, load them, and have an immediate look at the thresholds you set.</p>
<h3>Description</h3>
<p>To load a configuration file you can modify the filename input field in the Configuration file row; pressing the button "Load" will cause the page to reloaded with the data from the new configuration file.</p>
<p>The table you see in the center of the RRD Alarm Configuration's page is the one that holds all the data of the configuration file. Every row of the table is a threshold and is selectable by a mouse click, once you select a row you can edit it changing the values on the input fields in the last row of the table. Any time you'll hit the update button the values inside the input field will be inserted in the row you selected. Hitting the Add Row button a new row will be added at the bottom of the others filled with the values currently inside the input fields. Adding and updating a row are two operations that will be performed only if the input fields values are valid, if not the uncorrected fields will turn red, placing the mouse over those fields will tell you what kind of problem was there. To help you write a valid RRD File Path you can activate the autosuggest function for that field clicking on the image button just right of it.</p>
<p>To deselect a row and reset the current values of the input field just click on the Reset button.</p>
<p>To remove a row first you need to select one, then just press on the Remove Row button. Due to the fact that the IDs could be a reference for you and should remain the same, the rows will no be re-indexed; holes can happen, if you don't like them you can still click at the top of the ID column to reIndex your table.</p>
<h3>Threshold format</h3>
<p>A threshold consist of an <b>ID</b> that represent it, a <b>RRD File Path</b> field that points to the file(s) to check periodically (same expansion characters as unix shell can be used, remember that the path inserted here is relative to the RRD file), and the <b>Threshold Type</b> you want to set, above or below. Next you must establish a limit <b>Value</b> for your threshold, any kind of numeric values are accepted. The <b>Num. Repetitions</b> field requires, on the contrary, a non negative integer and it defines the number of times for the threshold to exceed (successively) before the alarm to trigger. The <b>Start Time</b> and <b>End Time</b> let you specify the time frame you want to be controlled; the format accepted by this two fields is a subset of the AT TIME format defined in the <a href="http://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html#IAT_STYLE_TIME_SPECIFICATION">Fetch</a> documentation on RRDTool homepage. The next field <b>Action To Perform</b> shows (in bold) the name of the script that will be launched when an alarm is triggered and the parameter to pass on to that script just after the colon. The scripts listed in the drop down menu are all the executable files present in the &quot;ntop/rrdalarm/scripts/&quot; directory in your ntop install directory on disk. The last field <b>Time Before Next Alarm (sec)</b> expresses the the minimum number of seconds before another action can be triggered, any non negative number is acceptable.</p>
<p>Example:</p>
<center>
<table id="configuration" cellspacing="0" cellpadding="5" border="1" >
<thead>
<tr>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center" title="Click to reIndex this column"><A href="">ID</A> 
</th>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center"> RRD File Path</th>
<th bgcolor="#f3f3f3" align="center">Threshold<br/>Type 
</th>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center"> Value </th>
<th bgcolor="#f3f3f3" align="center">Num.<br/>Repetitions 
</th>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center"> Start Time </th>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center"> End Time </th>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center"> Action To Perform </th>
<th nowrap="nowrap" bgcolor="#f3f3f3" align="center" title="Time Before Next Action (sec)">Time Before<br/>Next Action (sec)
</th>
</tr>
</thead>
<tbody id="body">
<tr style="">
<td align="right">1</td>
<td align="left">interfaces/eth0/ethernetPkts.rrd</td>
<td align="center">
above
<img class="tooltip" border="0" src="/arrow_up.png"/>
</td>
<td align="right">0.0</td>
<td align="right">0</td>
<td align="right">now-10h</td>
<td align="right">now</td>
<td align="left" title="savelog">
<strong>savelog</strong>
:
id1logfile.txt
</td>
<td align="right">0</td>
</tr>
  </tbody>
</table>
</center>
<h3>Save Configuration</h3>
<p>All the modifications you made to the table are non-persistent, meaning you HAVE to click the Save Config button at the bottom of the table in order to save the configuration file on disk. The name of the configuration file that will be saved is the value of the Configuration File field. The path for this file is restricted to the standard defined by <b>ntop</b> installation directory.</p>
<h3>Start the Check</h3>
<p>RRDAlarm was designed to run continuously every minute to check the configuration file you provided. Anyway you can click on the Check Thresholds now link or click on the menu Utils->RRD Alarm->Check Now, this action will execute the start.py script that will check all the thresholds you have set and create an HTML report page with the details of the operation. To schedule the start.py script to run every minute you can install the crontab.rrdalarm file in the /ntop/rrdalarm install directory (simply open a shell with your ntop user and digit &quot;crontab &lt;pathcrontab.rrdalarm&gt;&quot;), you need cron installed of course and curl. For windows users there are some porting for cron and curl that can work for you. The operation that will be executed every minute is a HTTP get to &quot;<i>http://localhost:3000/python/rrdalarm/start.py?noHTML=true</i>&quot;; the last parameter will instruct the script not to return with a HTML report page.</p>
<p>&nbsp;</p>