allow disabling of alerting per device, allow override of syscontact, minor cleanups

git-svn-id: http://www.observium.org/svn/observer/trunk@1995 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-03-30 16:28:24 +00:00
parent d302d1a4ce
commit 9fd77cd884
17 changed files with 126 additions and 63 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 678 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 567 B

+1 -2
View File
@@ -53,7 +53,6 @@ $interface['graph_type'] = "port_bits";
echo(generate_port_link($interface, "<img src='graph.php?type=".$interface['graph_type']."&amp;id=".$interface['interface_id']."&amp;from=".$from."&amp;to=".$now."&amp;width=".$width."&amp;height=".$height."&amp;legend=no&amp;bg=".
str_replace("#","", $row_colour)."'>", $interface['graph_type']));
echo("</td><td width=135>");
echo("".formatRates($interface['adslAturChanCurrTxRate']) . "/". formatRates($interface['adslAtucChanCurrTxRate']));
echo("<br />");
@@ -142,4 +141,4 @@ if ($graph_type && is_file($graph_file))
}
?>
?>
+2 -7
View File
@@ -1,9 +1,5 @@
<?php
#echo("<pre>");
#print_r($interface);
#echo("</pre>");
# This file prints a table row for each interface
$interface['device_id'] = $device['device_id'];
@@ -32,12 +28,12 @@ echo("<tr style=\"background-color: $row_colour;\" valign=top onmouseover=\"this
<td valign=top width=350>");
echo(" <span class=list-large>
" . generate_port_link($interface, $interface['ifIndex'] . ". ".$interface['label']) . " $error_img $mac
</span><br /><span class=interface-desc>".$interface['ifAlias']."</span>");
if ($interface['ifAlias']) { echo("<br />"); }
unset ($break);
if ($port_details)
{
$ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
@@ -271,7 +267,6 @@ if ($graph_type && is_file($graph_file))
# onmouseout=\"return nd();\"> <img src='$yearly_traffic' border=0></a>");
echo("</td></tr>");
}
?>
?>
+1 -1
View File
@@ -29,7 +29,7 @@ if ($_POST['hostname'] && $_POST['community'])
?>
<form name="form1" method="post" action="<?php echo($config['base_url']); ?>/addhost/">
<form name="form1" method="post" action="">
<p>Devices will be checked for Ping and SNMP reachability before being probed. Only devices with recognised OSes will be added.</p>
<div style="padding: 10px; background: #f0f0f0;">
+2 -2
View File
@@ -1,4 +1,4 @@
<?php
[B<?php
if ($_POST['addbill'] == "yes")
{
@@ -146,7 +146,7 @@ if ($_GET['opta'] == "add")
$allowed = formatRates($bill['bill_cdr'] * 1000);
$used = formatRates($rate_data['rate_95th'] * 1000);
$percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2);
} elseif ($bill['bill_type'] == "quota") {
} elseif ($bill['bill_type'] == "quota") {
$type = "Quota";
$allowed = formatStorage($bill['bill_gb']* 1024 * 1024 * 1024);
$used = formatStorage($rate_data['total_data'] * 1024 * 1024);
+1
View File
@@ -9,6 +9,7 @@ if ($_SESSION['userlevel'] < '7')
$panes['snmp'] = 'SNMP';
$panes['ports'] = 'Port Settings';
$panes['apps'] = 'Applications';
$panes['alerts'] = 'Alerts';
if ($config['enable_services'])
{
+63
View File
@@ -0,0 +1,63 @@
<?php
if ($_POST['editing'])
{
if ($_SESSION['userlevel'] > "7")
{
$override_sysContact_bool = mres($_POST['override_sysContact']);
if (isset($_POST['sysContact'])) { $override_sysContact_string = mres($_POST['sysContact']); }
$disable_notify = mres($_POST['disable_notify']);
if ($override_sysContact_bool) { set_dev_attrib($device, 'override_sysContact_bool', '1'); } else { del_dev_attrib($device, 'override_sysContact_bool'); }
if (isset($override_sysContact_string)) { set_dev_attrib($device, 'override_sysContact_string', $override_sysContact_string); };
if ($disable_notify) { set_dev_attrib($device, 'disable_notify', '1'); } else { del_dev_attrib($device, 'disable_notify'); }
$update_message = "Device alert settings updated.";
$updated = 1;
}
}
if ($updated && $update_message)
{
print_message($update_message);
} elseif ($update_message) {
print_error($update_message);
}
$override_sysContact_bool = get_dev_attrib($device,'override_sysContact_bool');
$override_sysContact_string = get_dev_attrib($device,'override_sysContact_string');
$disable_notify = get_dev_attrib($device,'disable_notify');
?>
<h3>Alert settings</h3>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<form id="edit" name="edit" method="post" action="">
<input type="hidden" name="editing" value="yes">
<table width="500" border="0">
<tr>
<td width="50"><div style="padding-right: 5px; text-align: right"><input onclick="edit.sysContact.disabled=!edit.override_sysContact.checked" type="checkbox" name="override_sysContact"<?php if ($override_sysContact_bool) { echo(' checked="1"'); } ?> /></div></td>
<td width="150">Override sysContact:</td>
<td><input name="sysContact" size="32"<?php if (!$override_sysContact_bool) { echo(' disabled="1"'); } ?> value="<?php echo $override_sysContact_string; ?>" /></td>
</tr>
<tr>
<td width="50"><div style="padding-right: 5px; text-align: right"><input type="checkbox" name="disable_notify"<?php if ($disable_notify) { echo(' checked="1"'); } ?> /></div></td>
<td colspan="2">Disable all alerting for this host</td>
</tr>
<tr>
<td></td>
<td>
<br />
<input type="submit" name="Submit" value="Save" />
</td>
</tr>
</table>
<br />
</form>
</td>
<td width="50"></td>
<td></td>
</tr>
</table>
+7 -5
View File
@@ -26,24 +26,26 @@ if ($updated && $update_message)
?>
<table cellpadding=0 cellspacing=0>
<h3>IPMI settings</h3>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<form id="edit" name="edit" method="post" action="">
<input type=hidden name="editing" value="yes">
<input type="hidden" name="editing" value="yes">
<table width="500" border="0">
<tr>
<td width="150"><div align="right">IPMI/BMC Hostname</div></td>
<td colspan="3"><input name="ipmi_hostname" size="32" value="<?php echo get_dev_attrib($device,'ipmi_hostname'); ?>"></input></td>
<td colspan="3"><input name="ipmi_hostname" size="32" value="<?php echo get_dev_attrib($device,'ipmi_hostname'); ?>" /></td>
</tr>
<tr>
<td><div align="right">IPMI/BMC Username</div></td>
<td colspan="3"><input name="ipmi_username" size="32" value="<?php echo get_dev_attrib($device,'ipmi_username'); ?>"></input></td>
<td colspan="3"><input name="ipmi_username" size="32" value="<?php echo get_dev_attrib($device,'ipmi_username'); ?>" /></td>
</td>
</tr>
<tr>
<td><div align="right">IPMI/BMC Password</div></td>
<td colspan="3"><input name="ipmi_password" type="password" size="32" value="<?php echo get_dev_attrib($device,'ipmi_password'); ?>"></input></td>
<td colspan="3"><input name="ipmi_password" type="password" size="32" value="<?php echo get_dev_attrib($device,'ipmi_password'); ?>" /></td>
</td>
</tr>
<tr>
+4 -4
View File
@@ -50,7 +50,7 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
<table width='400' border='0'>
<tr>
<td width='150'><div align='right'>SNMP Community</div></td>
<td><input name='community' size='20' value='" . $device['community'] . "'></input>
<td><input name='community' size='20' value='" . $device['community'] . "' />
</td>
</tr>
<tr>
@@ -63,7 +63,7 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
</tr>
<tr>
<td><div align='right'>SNMP Port</div></td>
<td><input name='port' size='20' value='" . $device['port'] . "'></input>
<td><input name='port' size='20' value='" . $device['port'] . "' />
</td>
</tr>
<tr>
@@ -83,13 +83,13 @@ echo(" </select>
</tr>
<tr>
<td><div align='right'>SNMP Timeout</div></td>
<td><input name='timeout' size='20' value='" . ($device['timeout'] ? $device['timeout'] : '') . "'></input>&nbsp;
<td><input name='timeout' size='20' value='" . ($device['timeout'] ? $device['timeout'] : '') . "' />&nbsp;
<em>seconds</em>
</td>
</tr>
<tr>
<td><div align='right'>SNMP Retries</div></td>
<td colspan='3'><input name='retries' size='20' value='" . ($device['timeout'] ? $device['retries'] : '') . "'></input>
<td colspan='3'><input name='retries' size='20' value='" . ($device['timeout'] ? $device['retries'] : '') . "' />
</td>
</tr>");