mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
memcached and drbd application improvements
git-svn-id: http://www.observium.org/svn/observer/trunk@3099 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
<?php
|
||||
|
||||
$drbd_dev = $app['app_instance'];
|
||||
$drbd_data = $agent_data['app']['drbd'][$drbd_dev];
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$app['app_instance'].".rrd";
|
||||
|
||||
$rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$drbd_dev.".rrd";
|
||||
|
||||
foreach (explode("|", $drbd_data) as $part)
|
||||
foreach (explode("|", $agent_data['app']['drbd'][$app['app_instance']]) as $part)
|
||||
{
|
||||
list($stat, $val) = explode("=", $part);
|
||||
if (!empty($stat))
|
||||
@@ -29,6 +26,14 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-drbd-".$
|
||||
DS:oos:GAUGE:600:0:125000000000 ".$config['rrd_rra']);
|
||||
}
|
||||
|
||||
$ds_list = array('ns','nr','dw','dr','al','bm','lo','pe','ua','ap','oos');
|
||||
foreach($ds_list as $ds)
|
||||
{
|
||||
if(empty($drbd[$ds])) { $drbd[$ds] = "U"; }
|
||||
}
|
||||
|
||||
rrdtool_update($rrd_filename, "N:".$drbd['ns'].":".$drbd['nr'].":".$drbd['dw'].":".$drbd['dr'].":".$drbd['al'].":".$drbd['bm'].":".$drbd['lo'].":".$drbd['pe'].":".$drbd['ua'].":".$drbd['ap'].":".$drbd['oop']);
|
||||
|
||||
unset($drbd)
|
||||
|
||||
?>
|
||||
|
||||
@@ -42,7 +42,7 @@ if($device['os_group'] == "unix")
|
||||
|
||||
if($section == "apache") { $sa = "app"; $sb = "apache"; }
|
||||
if($section == "mysql") { $sa = "app"; $sb = "mysql"; }
|
||||
if($section == "drbd") { $sa = "app"; $sb = "drbd"; }
|
||||
# if($section == "drbd") { $sa = "app"; $sb = "drbd"; }
|
||||
|
||||
if(!empty($sa) && !empty($sb))
|
||||
{
|
||||
@@ -107,16 +107,15 @@ if($device['os_group'] == "unix")
|
||||
}
|
||||
|
||||
### DRBD
|
||||
if (!empty($agent_data['app']['drbd']))
|
||||
if (!empty($agent_data['drbd']))
|
||||
{
|
||||
$agent_data['drbd_raw'] = $agent_data['drbd'];
|
||||
$agent_data['drbd'] = array();
|
||||
foreach (explode("\n", $agent_data['drbd_raw']) as $drbd_entry)
|
||||
$agent_data['app']['drbd'] = array();
|
||||
foreach (explode("\n", $agent_data['drbd']) as $drbd_entry)
|
||||
{
|
||||
list($drbd_dev, $drbd_data) = explode(":", $drbd_entry);
|
||||
if (preg_match("/^drbd/", $drbd_dev))
|
||||
{
|
||||
$agent_data['drbd'][$drbd_dev] = $drbd_data;
|
||||
$agent_data['app']['drbd'][$drbd_dev] = $drbd_data;
|
||||
if (dbFetchCell("SELECT COUNT(*) FROM `applications` WHERE `device_id` = ? AND `app_type` = ? AND `app_instance` = ?", array($device['device_id'], 'drbd', $drbd_dev)) == "0")
|
||||
{
|
||||
echo("Found new application 'DRBd' $drbd_dev\n");
|
||||
|
||||
Reference in New Issue
Block a user