mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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';
|
||||
|
@@ -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");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user