mirror of
https://github.com/Icinga/icingaweb2-module-graphite.git
synced 2026-05-28 04:34:57 -04:00
parent
e7b54606e6
commit
2450fcb2fe
3 changed files with 41 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ use Icinga\Module\Graphite\Forms\TimeRangePicker\TimeRangePickerTrait as TimeRan
|
|||
use Icinga\Module\Graphite\Forms\TimeRangePicker\TimeRangePickerTrait as TimeRangePickerFormTrait;
|
||||
use Icinga\Module\Graphite\Web\Controller\MonitoringAwareController;
|
||||
use Icinga\Module\Graphite\Web\Controller\TimeRangePickerTrait;
|
||||
use Icinga\Module\Graphite\Web\Widget\Graphs;
|
||||
use Icinga\Module\Monitoring\DataView\DataView;
|
||||
use Icinga\Web\Url;
|
||||
use Icinga\Web\Widget\Tabextension\DashboardAction;
|
||||
|
|
@ -34,7 +35,7 @@ class ListController extends MonitoringAwareController
|
|||
'host_name',
|
||||
'host_display_name',
|
||||
'host_check_command',
|
||||
'_host_check_command'
|
||||
'_host_check_command' => '_host_' . Graphs::getObscuredCheckCommandCustomVar()
|
||||
])
|
||||
);
|
||||
|
||||
|
|
@ -68,7 +69,7 @@ class ListController extends MonitoringAwareController
|
|||
'service_description',
|
||||
'service_display_name',
|
||||
'service_check_command',
|
||||
'_service_check_command'
|
||||
'_service_check_command' => '_service_' . Graphs::getObscuredCheckCommandCustomVar()
|
||||
])
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Icinga\Module\Graphite\Forms\Config;
|
|||
|
||||
use Icinga\Forms\ConfigForm;
|
||||
use Icinga\Module\Graphite\Web\Form\Validator\MacroTemplateValidator;
|
||||
use Zend_Validate_Regex;
|
||||
|
||||
class AdvancedForm extends ConfigForm
|
||||
{
|
||||
|
|
@ -39,6 +40,18 @@ class AdvancedForm extends ConfigForm
|
|||
),
|
||||
'validators' => [new MacroTemplateValidator()]
|
||||
]
|
||||
],
|
||||
[
|
||||
'text',
|
||||
'icinga_customvar_obscured_check_command',
|
||||
[
|
||||
'label' => $this->translate('Obscured check command custom variable'),
|
||||
'description' => $this->translate(
|
||||
'The Icinga custom variable with the "actual" check command obscured'
|
||||
. ' by e.g. check_by_ssh (defaults to check_command)'
|
||||
),
|
||||
'validators' => [new Zend_Validate_Regex('/\A\w*\z/')]
|
||||
]
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Icinga\Module\Graphite\Web\Widget;
|
||||
|
||||
use Icinga\Application\Config;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Module\Graphite\Forms\TimeRangePicker\TimeRangePickerTrait;
|
||||
use Icinga\Module\Graphite\Graphing\GraphingTrait;
|
||||
|
|
@ -20,6 +21,13 @@ abstract class Graphs extends AbstractWidget
|
|||
{
|
||||
use GraphingTrait;
|
||||
|
||||
/**
|
||||
* The Icinga custom variable with the "real" check command (if any) of monitored objects we display graphs for
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $obscuredCheckCommandCustomVar;
|
||||
|
||||
/**
|
||||
* Graph image width
|
||||
*
|
||||
|
|
@ -114,7 +122,7 @@ abstract class Graphs extends AbstractWidget
|
|||
return new HostGraphs(
|
||||
$object->getName(),
|
||||
$object->host_check_command,
|
||||
$object->_host_check_command
|
||||
$object->{'_host_' . Graphs::getObscuredCheckCommandCustomVar()}
|
||||
);
|
||||
|
||||
case 'service':
|
||||
|
|
@ -123,11 +131,26 @@ abstract class Graphs extends AbstractWidget
|
|||
$object->getHost()->getName(),
|
||||
$object->getName(),
|
||||
$object->service_check_command,
|
||||
$object->_service_check_command
|
||||
$object->{'_service_' . Graphs::getObscuredCheckCommandCustomVar()}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Icinga custom variable with the "real" check command (if any) of monitored objects we display graphs for
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getObscuredCheckCommandCustomVar()
|
||||
{
|
||||
if (static::$obscuredCheckCommandCustomVar === null) {
|
||||
static::$obscuredCheckCommandCustomVar = Config::module('graphite')
|
||||
->get('icinga', 'customvar_obscured_check_command', 'check_command');
|
||||
}
|
||||
|
||||
return static::$obscuredCheckCommandCustomVar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in a new issue