diff --git a/config/modules/monitoring/instances.ini b/config/modules/monitoring/instances.ini index 18213f142..2f54e11e3 100644 --- a/config/modules/monitoring/instances.ini +++ b/config/modules/monitoring/instances.ini @@ -1,2 +1,2 @@ [icinga] -path=/usr/local/icinga/var/rw/icinga.cmd +path = "/usr/local/icinga-mysql/var/rw/icinga.cmd" diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index e50207571..a3e118253 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -402,7 +402,7 @@ class Form extends Zend_Form foreach ($triggerElements as $elementName) { $element = $this->getElement($elementName); if ($element !== null) { - $element->setAttrib('onchange', 'this.form.submit()'); + $element->setAttrib('onchange', '$(this.form).submit();'); $element->setAttrib('data-icinga-form-autosubmit', true); } else { throw new ProgrammingError( diff --git a/modules/monitoring/application/views/helpers/CommandForm.php b/modules/monitoring/application/views/helpers/CommandForm.php index 4f32d064c..14d5194dc 100644 --- a/modules/monitoring/application/views/helpers/CommandForm.php +++ b/modules/monitoring/application/views/helpers/CommandForm.php @@ -94,6 +94,40 @@ class Zend_View_Helper_CommandForm extends Zend_View_Helper_Abstract return $form; } + public function toggleSubmitForm($label, $checkValue, $enabledCommand, $disabledCommand, array $arguments = array()) + { + if ($checkValue === '1') { + $commandName = $disabledCommand; + } else { + $commandName = $enabledCommand; + } + + $form = $this->simpleForm($commandName, $arguments); + $form->setAttrib('class', 'pull-right'); + + $uniqueName = uniqid('check'); + + $checkBox = new Zend_Form_Element_Checkbox($uniqueName); + + if ($checkValue === '1') { + $checkBox->setChecked(true); + } + + $form->addElement($checkBox); + $form->enableAutoSubmit(array($uniqueName)); + + $checkBox->setDecorators(array('ViewHelper')); + $checkBox->setAttrib('class', ''); + $checkBox->setAttrib('id', $uniqueName); + + $submit_identifier = new Zend_Form_Element_Hidden('btn_submit'); + $submit_identifier->setValue('1'); + $form->addElement($submit_identifier); + $form->getElement('btn_submit')->setDecorators(array('ViewHelper')); + + return '' . $form; + } + /** * Merges css class names together * diff --git a/modules/monitoring/application/views/scripts/process/performance.phtml b/modules/monitoring/application/views/scripts/process/performance.phtml index 46cdfa4e9..0ed318b44 100644 --- a/modules/monitoring/application/views/scripts/process/performance.phtml +++ b/modules/monitoring/application/views/scripts/process/performance.phtml @@ -1,8 +1,9 @@ runtimevariables; $ps = $this->programstatus; - $cp = $this->checkPerformance()->create($this->checkperformance); + /** @var Zend_View_Helper_CommandForm $ch */ + $ch = $this->getHelper('CommandForm'); ?>
+ = + $ch->toggleSubmitForm( + 'Notifications enabled', + $ps->notifications_enabled, + 'enablenotifications', + 'disablenotifications', + array( + 'global' => '1' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Execute active service checks', + $ps->active_service_checks_enabled, + 'enableactivechecks', + 'disableactivechecks', + array( + 'global' => 'service' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Accept passive service checks', + $ps->passive_service_checks_enabled, + 'startacceptingpassivechecks', + 'stopacceptingpassivechecks', + array( + 'global' => 'service' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Execute active host checks', + $ps->active_host_checks_enabled, + 'enableactivechecks', + 'disableactivechecks', + array( + 'global' => 'host' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Accept passive host checks', + $ps->passive_host_checks_enabled, + 'startacceptingpassivechecks', + 'stopacceptingpassivechecks', + array( + 'global' => 'host' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Eventhandlers enabled', + $ps->event_handlers_enabled, + 'enableeventhandler', + 'disableeventhandler', + array( + 'global' => '1' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Obsessing over host checks', + $ps->obsess_over_hosts, + 'startobsessing', + 'stopobsessing', + array( + 'global' => 'host' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Obsessing over service checks', + $ps->obsess_over_services, + 'startobsessing', + 'stopobsessing', + array( + 'global' => 'service' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Flap detection enabled', + $ps->flap_detection_enabled, + 'enableflapdetection', + 'disableflapdetection', + array( + 'global' => '1' + ) + ); + ?> + | +
+ = + $ch->toggleSubmitForm( + 'Process performance data', + $ps->process_performance_data, + 'enableperformancedata', + 'disableperformancedata', + array( + 'global' => '1' + ) + ); + ?> + | +