add storage warning percentage in database even though we can't configure it from anywhere yet

git-svn-id: http://www.observium.org/svn/observer/trunk@746 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2010-01-30 11:25:23 +00:00
parent fc3c1a141e
commit a0d2a6ff47
2 changed files with 6 additions and 6 deletions

View File

@@ -75,4 +75,4 @@ ALTER TABLE `temperature` ADD `temp_precision` INT(11) NULL DEFAULT '1';
UPDATE temperature SET temp_precision=10 WHERE temp_tenths=1;
ALTER TABLE `temperature` DROP `temp_tenths`;
CREATE TABLE IF NOT EXISTS `dbSchema` ( `revision` int(11) NOT NULL default '0', PRIMARY KEY (`revision`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `storage` ADD `storage_perc_warn` INT(11) NULL DEFAULT '60';

View File

@@ -33,11 +33,11 @@ while ($dr = mysql_fetch_array($dq)) {
}
rrdtool_update($storage_rrd, "N:$hrStorageSize:$used:$perc");
mysql_query("UPDATE `storage` SET `hrStorageUsed` = '$used_units', `storage_perc` = '$perc' WHERE storage_id = '" . $dr['storage_id'] . "'");
if($dr['storage_perc'] < '40' && $perc >= '40') {
if($device['sysContact']) { $email = $device['sysContact']; } else { $email = $config['email_default']; }
$msg = "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'] . " is " . $perc;
$msg .= "% at " . date('l dS F Y h:i:s A');
mail($email, "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'], $msg, $config['email_headers']);
if (!is_numeric($dr['storage_perc_warn'])) { $dr['storage_perc_warn'] = 60; }
if($dr['storage_perc'] < $dr['storage_perc_warn'] && $perc >= $dr['storage_perc_warn'])
{
$msg = "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'] . " is " . $perc . "% at " . date('l dS F Y h:i:s A');
notify($device, "Disk Alarm: " . $device['hostname'] . " " . $dr['hrStorageDescr'], $msg);
echo("Alerting for " . $device['hostname'] . " " . $dr['hrStorageDescr'] . "\n");
}
}