summaryrefslogtreecommitdiffstats
path: root/application/forms/Config/AdvancedForm.php
blob: 1fc196bb7ac7571a47cd78eb857c557d2f2f1e9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php

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
{
    public function init()
    {
        $this->setName('form_config_graphite_advanced');
        $this->setSubmitLabel($this->translate('Save Changes'));
    }

    public function createElements(array $formData)
    {
        $this->addElements([
            [
                'number',
                'ui_default_time_range',
                [
                    'label'         => $this->translate('Default time range'),
                    'description'   => $this->translate('The default time range for graphs'),
                    'min'           => 0,
                    'value'         => 1
                ]
            ],
            [
                'select',
                'ui_default_time_range_unit',
                [
                    'label'         => $this->translate('Default time range unit'),
                    'description'   => $this->translate('The above range\'s unit'),
                    'multiOptions'  => [
                        'minutes'   => $this->translate('Minutes'),
                        'hours'     => $this->translate('Hours'),
                        'days'      => $this->translate('Days'),
                        'weeks'     => $this->translate('Weeks'),
                        'months'    => $this->translate('Months'),
                        'years'     => $this->translate('Years')
                    ],
                    'value'         => 'hours'
                ]
            ],
            [
                'checkbox',
                'ui_disable_no_graphs_found',
                [
                    'label'         => $this->translate('Disable "no graphs found"'),
                    'description'   => $this->translate(
                        'If no graphs were found for a monitored object, just display nothing at all'
                    ),
                ]
            ],
            [
                'text',
                'icinga_graphite_writer_host_name_template',
                [
                    'label'         => $this->translate('Host name template'),
                    'description'   => $this->translate(
                        'The value of your Icinga 2 GraphiteWriter\'s'
                        . ' attribute host_name_template (if specified)'
                    ),
                    'validators'    => [new MacroTemplateValidator()]
                ]
            ],
            [
                'text',
                'icinga_graphite_writer_service_name_template',
                [
                    'label'         => $this->translate('Service name template'),
                    'description'   => $this->translate(
                        'The value of your Icinga 2 GraphiteWriter\'s'
                        . ' attribute service_name_template (if specified)'
                    ),
                    '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/')]
                ]
            ]
        ]);
    }
}