mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	fix emailing of up/down hosts and add config option to allow unauth'd graphs
git-svn-id: http://www.observium.org/svn/observer/trunk@1091 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		| @@ -15,7 +15,9 @@ if($_GET['debug']) { | |||||||
|   include("../includes/rewrites.php"); |   include("../includes/rewrites.php"); | ||||||
|   include("includes/authenticate.inc.php"); |   include("includes/authenticate.inc.php"); | ||||||
|  |  | ||||||
|  |   if(!$config['allow_unauth_graphs']) { | ||||||
|     if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; } |     if(!$_SESSION['authenticated']) { echo("not authenticated"); exit; } | ||||||
|  |   } | ||||||
|    |    | ||||||
|   if($_GET['device']) { |   if($_GET['device']) { | ||||||
|     $_GET['id'] = $_GET['device']; |     $_GET['id'] = $_GET['device']; | ||||||
|   | |||||||
| @@ -83,6 +83,8 @@ $config['ignore_mount_optical']   = 1; # Ignore mounted optical discs | |||||||
| $config['device_traffic_iftype']  = array('/loopback/','/other/','/tunnel/','/virtual/','/mpls/'); | $config['device_traffic_iftype']  = array('/loopback/','/other/','/tunnel/','/virtual/','/mpls/'); | ||||||
| $config['device_traffic_descr']   = array('/loopback/','/vlan/','/tunnel/','/:/'); | $config['device_traffic_descr']   = array('/loopback/','/vlan/','/tunnel/','/:/'); | ||||||
|  |  | ||||||
|  | $config['allow_unauth_graphs']	  = 0; ## Allow graphs to be viewed by anyone | ||||||
|  |  | ||||||
| # Sensors | # Sensors | ||||||
|  |  | ||||||
| $config['allow_entity_sensor']['amperes'] = 1; | $config['allow_entity_sensor']['amperes'] = 1; | ||||||
|   | |||||||
| @@ -78,6 +78,9 @@ while ($device = mysql_fetch_array($device_query)) { | |||||||
|       mysql_query("UPDATE `devices` SET `status` = '".$status."' WHERE `device_id` = '".$device['device_id']."'"); |       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') . "')"); |       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']); |       eventlog('Device status changed to ' . ($status == '1' ? 'Up' : 'Down'), $device['device_id']); | ||||||
|  |       mail($email, "Device ".($status == '1' ? 'Up' : 'Down').": " . $device['hostname'], "Device ".($status == '1' ? 'up' : 'down').": " . $device['hostname'] . " at " . date($config['timestamp_format']), $config['email_headers']); | ||||||
|  |  | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   if ($status == "1")  |   if ($status == "1")  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user