fix status setting for down also add new storage image :>

git-svn-id: http://www.observium.org/svn/observer/trunk@1010 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2010-03-12 02:24:23 +00:00
parent d62c8aedc8
commit b230457eb7
3 changed files with 11 additions and 10 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 390 B

After

Width:  |  Height:  |  Size: 644 B

View File

@@ -18,6 +18,7 @@ if(is_array($storage_array)) {
if (isset($config['ignore_mount_removable']) && $config['ignore_mount_removable'] && $fstype == "hrStorageRemovableDisk") { $deny = 1; if ($debug) echo("skip(removable)\n"); }
if (isset($config['ignore_mount_network']) && $config['ignore_mount_network'] && $fstype == "hrStorageNetworkDisk") { $deny = 1; if ($debug) echo("skip(network)\n"); }
if (isset($config['ignore_mount_optical']) && $config['ignore_mount_optical'] && $fstype == "hrStorageCompactDisc") { $deny = 1; if ($debug) echo("skip(cd)\n"); }
if ($fstype == "hrStorageVirtualMemory" || $fstype == "hrStorageRam" || $fstype == "hrStorageOther") { $deny = 1; }
if(!$deny && is_numeric($index)) {
discover_storage($valid_storage, $device, $index, $fstype, "hrstorage", $descr, $size , $units, $used);

View File

@@ -71,7 +71,16 @@ while ($device = mysql_fetch_array($device_query)) {
$status = "0";
}
if ($status) {
if ( $device['status'] != $status )
{
$poll_update .= $poll_separator . "`status` = '$status'";
$poll_separator = ", ";
mysql_query("UPDATE `devices` SET `status` = '".$status."' WHERE `device_id` = '".$device['device_id']."'");
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is " .($status == '1' ? 'up' : 'down') . "')");
eventlog('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device['device_id']);
}
if ($status == "1") {
$snmp_cmd = $config['snmpget'] . " -m SNMPv2-MIB -O qv -" . $device['snmpver'] . " -c " . $device['community'] . " " . $device['hostname'].":".$device['port'];
$snmp_cmd .= " sysUpTime.0 sysLocation.0 sysContact.0 sysName.0 HOST-RESOURCES-MIB::hrSystemUptime.0";
$snmpdata = shell_exec($snmp_cmd);
@@ -132,15 +141,6 @@ while ($device = mysql_fetch_array($device_query)) {
$poll_separator = ", ";
}
if ( $device['status'] != $status )
{
$poll_update .= $poll_separator . "`status` = '$status'";
$poll_separator = ", ";
mysql_query("UPDATE `devices` SET `status` = '".$status."' WHERE `device_id` = '".$device['device_id']."'");
mysql_query("INSERT INTO alerts (importance, device_id, message) VALUES ('0', '" . $device['device_id'] . "', 'Device is " . ($status == '1' ? 'up' : 'down') . "')");
eventlog('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device['device_id']);
}
if (is_file($config['install_dir'] . "/includes/polling/device-".$device['os'].".inc.php")) {
/// OS Specific
include($config['install_dir'] . "/includes/polling/device-".$device['os'].".inc.php");