Merge branch 'maint/7.0'
[ninja.git] / application / widgets / tac_monfeat / tac_monfeat.php
blobd1a6c6625bc7b703984186f9924cf20b623f4bd1
1 <?php defined('SYSPATH') OR die('No direct access allowed.');
2 /**
3 * Monitoring Features widget for tactical overview
5 * @author op5 AB
6 */
7 class Tac_monfeat_Widget extends widget_Base {
8 protected $duplicatable = true;
10 public function index()
12 # fetch widget view path
13 $view_path = $this->view_path('view');
15 $current_status = $this->get_current_status();
17 $flap_detect_header_label = _('Flap Detection');
18 $notifications_header_label = _('Notifications');
19 $eventhandler_header_label = _('Event Handlers');
20 $activechecks_header_label = _('Active Checks');
21 $passivechecks_header_label = _('Passive Checks');
22 $lable_enabled = _('Enabled');
23 $lable_disabled = _('Disabled');
24 $lable_flapping = _('Flapping');
26 $lable_all_services = _('All Services');
27 $lable_no_services = _('No Services');
28 $lable_service_singular = _('Service');
29 $lable_service_plural = _('Services');
31 $lable_all_hosts = _('All Hosts');
32 $lable_no_hosts = _('No Hosts');
33 $lable_host_singular = _('Host');
34 $lable_host_plural = _('Hosts');
36 # fetch global nagios config data
37 # try with the database first but we may use the nagios.cfg file as fallback
38 $status = Current_status_Model::instance()->program_status();
39 $enable_notifications = $status->enable_notifications;
40 $enable_flap_detection = $status->enable_flap_detection;
41 $enable_event_handlers = $status->enable_event_handlers;
42 $execute_service_checks = $status->execute_service_checks;
43 $accept_passive_service_checks = $status->accept_passive_service_checks;
45 $flap_disabled_services = $current_status->svc->flapping_disabled;
46 $flapping_services = $current_status->svc->flapping;
47 $flap_disabled_hosts = $current_status->hst->flapping_disabled;
48 $flapping_hosts = $current_status->hst->flapping;
50 $notification_disabled_services = $current_status->svc->notifications_disabled;
51 $notification_disabled_hosts = $current_status->hst->notifications_disabled;
53 $event_handler_disabled_svcs = $current_status->svc->eventhandler_disabled;
54 $event_handler_disabled_hosts = $current_status->svc->eventhandler_disabled;
56 $active_checks_disabled_svcs = $current_status->svc->active_checks_disabled_active;
57 $active_checks_disabled_hosts = $current_status->hst->active_checks_disabled_active;
59 $passive_checks_disabled_svcs = $current_status->svc->passive_checks_disabled;
60 $passive_checks_disabled_hosts = $current_status->hst->passive_checks_disabled;
62 $cmd_flap_status = ($enable_flap_detection ? 'enabled' : 'disabled').'_monfeat';
63 $cmd_notification_status = ($enable_notifications ? 'enabled' : 'disabled').'_monfeat';
64 $cmd_event_status = ($enable_event_handlers ? 'enabled' : 'disabled').'_monfeat';
65 $cmd_activecheck_status = ($execute_service_checks ? 'enabled' : 'disabled').'_monfeat';
66 $cmd_passivecheck_status = ($accept_passive_service_checks ? 'enabled' : 'disabled').'_monfeat';
68 $cmd_flap_link = url::site('command/submit?cmd_typ='.($enable_flap_detection ? 'DIS' : 'EN').'ABLE_FLAP_DETECTION');
69 $cmd_notification_link = url::site('command/submit?cmd_typ='.($enable_notifications ? 'DIS' : 'EN') . 'ABLE_NOTIFICATIONS');
70 $cmd_event_link = url::site('command/submit?cmd_typ='.($enable_event_handlers ? 'DIS' : 'EN') . 'ABLE_EVENT_HANDLERS');
71 $cmd_activecheck_link = url::site('extinfo/');
72 $cmd_passivecheck_link = url::site('extinfo/');
74 # fetch widget content
75 require($view_path);