├── img ├── spin.gif ├── glyphicons-halflings.png └── glyphicons-halflings-white.png ├── screenshot.png ├── css ├── images │ ├── ajax-loader.png │ ├── form-check-off.png │ ├── form-check-on.png │ ├── form-radio-off.png │ ├── form-radio-on.png │ ├── icons-18-black.png │ ├── icons-18-white.png │ ├── icons-36-black.png │ ├── icons-36-white.png │ └── icon-search-black.png ├── smoothness │ ├── images │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_2e83ff_256x240.png │ │ ├── ui-icons_454545_256x240.png │ │ ├── ui-icons_888888_256x240.png │ │ ├── ui-icons_cd0a0a_256x240.png │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ ├── ui-bg_flat_75_ffffff_40x100.png │ │ ├── ui-bg_glass_55_fbf9ee_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_glass_75_dadada_1x400.png │ │ ├── ui-bg_glass_75_e6e6e6_1x400.png │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ └── ui-bg_highlight-soft_75_cccccc_1x100.png │ ├── jquery-ui-1.8.14.custom.min.css │ └── jquery-ui-1.8.14.custom.css ├── bootswatch.less ├── variables.less └── bootstrap-responsive.css ├── js ├── .jshintrc ├── bootstrap-transition.js ├── bootstrap-alert.js ├── bootstrap-button.js ├── bootstrap-dropdown.js ├── bootstrap-popover.js ├── combobox.js ├── bootstrap-tab.js ├── bootstrap-scrollspy.js ├── bootstrap-collapse.js ├── bootstrap-carousel.js ├── bootstrap-modal.js ├── bootstrap-typeahead.js └── bootstrap-tooltip.js ├── README.md ├── conf_default.php ├── test.php ├── search.php ├── actions.php ├── nagios_commands.php ├── index.php ├── tools.php └── parse_nagios_status.php /img/spin.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/img/spin.gif -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/screenshot.png -------------------------------------------------------------------------------- /css/images/ajax-loader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/ajax-loader.png -------------------------------------------------------------------------------- /css/images/form-check-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/form-check-off.png -------------------------------------------------------------------------------- /css/images/form-check-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/form-check-on.png -------------------------------------------------------------------------------- /css/images/form-radio-off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/form-radio-off.png -------------------------------------------------------------------------------- /css/images/form-radio-on.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/form-radio-on.png -------------------------------------------------------------------------------- /css/images/icons-18-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/icons-18-black.png -------------------------------------------------------------------------------- /css/images/icons-18-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/icons-18-white.png -------------------------------------------------------------------------------- /css/images/icons-36-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/icons-36-black.png -------------------------------------------------------------------------------- /css/images/icons-36-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/icons-36-white.png -------------------------------------------------------------------------------- /img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /css/images/icon-search-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/images/icon-search-black.png -------------------------------------------------------------------------------- /img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-icons_2e83ff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-icons_2e83ff_256x240.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-icons_454545_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-icons_454545_256x240.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-icons_888888_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-icons_888888_256x240.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-icons_cd0a0a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-icons_cd0a0a_256x240.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_glass_75_dadada_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png -------------------------------------------------------------------------------- /css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvuksan/alerting-controller/master/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png -------------------------------------------------------------------------------- /js/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "validthis": true, 3 | "laxcomma" : true, 4 | "laxbreak" : true, 5 | "browser" : true, 6 | "debug" : true, 7 | "boss" : true, 8 | "expr" : true, 9 | "asi" : true 10 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | alerting-controller 2 | =================== 3 | 4 | Easy way to control Nagios/Icinga 5 | 6 | This is WIP 7 | 8 | It is licensed under Apache License, v2.0. Please read the license here 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0.html 11 | -------------------------------------------------------------------------------- /conf_default.php: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /test.php: -------------------------------------------------------------------------------- 1 | "); print_r($nagios); 25 | 26 | ?> -------------------------------------------------------------------------------- /js/bootstrap-transition.js: -------------------------------------------------------------------------------- 1 | /* =================================================== 2 | * bootstrap-transition.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#transitions 4 | * =================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | $(function () { 24 | 25 | "use strict"; // jshint ;_; 26 | 27 | 28 | /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) 29 | * ======================================================= */ 30 | 31 | $.support.transition = (function () { 32 | 33 | var transitionEnd = (function () { 34 | 35 | var el = document.createElement('bootstrap') 36 | , transEndEventNames = { 37 | 'WebkitTransition' : 'webkitTransitionEnd' 38 | , 'MozTransition' : 'transitionend' 39 | , 'OTransition' : 'oTransitionEnd' 40 | , 'msTransition' : 'MSTransitionEnd' 41 | , 'transition' : 'transitionend' 42 | } 43 | , name 44 | 45 | for (name in transEndEventNames){ 46 | if (el.style[name] !== undefined) { 47 | return transEndEventNames[name] 48 | } 49 | } 50 | 51 | }()) 52 | 53 | return transitionEnd && { 54 | end: transitionEnd 55 | } 56 | 57 | })() 58 | 59 | }) 60 | 61 | }(window.jQuery); -------------------------------------------------------------------------------- /css/bootswatch.less: -------------------------------------------------------------------------------- 1 | // Bootswatch.less 2 | // Swatch: Cerulean 3 | // Version: 2.0.3 4 | // ----------------------------------------------------- 5 | 6 | // IMPORTS 7 | // ----------------------------------------------------- 8 | 9 | @import url(https://fonts.googleapis.com/css?family=Telex); 10 | 11 | // NAVBAR 12 | // ----------------------------------------------------- 13 | 14 | .navbar { 15 | 16 | font-family: @headingsFontFamily; 17 | 18 | .navbar-inner { 19 | #gradient > .vertical-three-colors(@navbarBackground, @navbarBackground, 90%, @navbarBackgroundHighlight); 20 | } 21 | 22 | .nav li.dropdown.active > .dropdown-toggle, 23 | .nav li.dropdown.active.open > .dropdown-toggle { 24 | background-color: @navbarLinkBackgroundActive; 25 | } 26 | 27 | .search-query { 28 | border: 1px solid darken(@linkColor, 10%); 29 | } 30 | 31 | .nav-collapse.in > .nav > li .dropdown-menu a { 32 | color: @white; 33 | 34 | &:hover { 35 | color: @white; 36 | } 37 | } 38 | 39 | .nav-collapse.in .nav li > a { 40 | color: @white; 41 | 42 | &:hover { 43 | background-color: #2B7CAC; 44 | } 45 | } 46 | 47 | .btn-navbar:hover { 48 | background-color: darken(@white, 20%); 49 | } 50 | } 51 | 52 | div.subnav { 53 | font-family: @headingsFontFamily; 54 | } 55 | 56 | // BUTTONS 57 | // ----------------------------------------------------- 58 | 59 | .btn { 60 | #gradient > .vertical-three-colors(@white, @white, 5%, darken(@white, 0%)); 61 | @shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); 62 | .box-shadow(@shadow); 63 | 64 | &:hover { 65 | background-position: 0 0; 66 | } 67 | } 68 | 69 | .btn-primary { 70 | .buttonBackground(lighten(@btnPrimaryBackground, 5%), @btnPrimaryBackground); 71 | } 72 | 73 | .btn-info { 74 | .buttonBackground(lighten(@btnInfoBackground, 5%), @btnInfoBackground); 75 | } 76 | 77 | .btn-success { 78 | .buttonBackground(lighten(@btnSuccessBackground, 5%), @btnSuccessBackground); 79 | } 80 | 81 | .btn-warning { 82 | .buttonBackground(lighten(@btnWarningBackground, 5%), @btnWarningBackground); 83 | } 84 | 85 | .btn-danger { 86 | .buttonBackground(lighten(@btnDangerBackground, 5%), @btnDangerBackground); 87 | } 88 | 89 | .btn-inverse { 90 | .buttonBackground(lighten(@btnInverseBackground, 5%), @btnInverseBackground); 91 | } 92 | 93 | // ICONS 94 | // ----------------------------------------------------- 95 | 96 | // Make icons gray 97 | i[class^="icon-"]{ 98 | opacity: 0.8; 99 | } 100 | -------------------------------------------------------------------------------- /js/bootstrap-alert.js: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * bootstrap-alert.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#alerts 4 | * ========================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* ALERT CLASS DEFINITION 27 | * ====================== */ 28 | 29 | var dismiss = '[data-dismiss="alert"]' 30 | , Alert = function (el) { 31 | $(el).on('click', dismiss, this.close) 32 | } 33 | 34 | Alert.prototype.close = function (e) { 35 | var $this = $(this) 36 | , selector = $this.attr('data-target') 37 | , $parent 38 | 39 | if (!selector) { 40 | selector = $this.attr('href') 41 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 42 | } 43 | 44 | $parent = $(selector) 45 | 46 | e && e.preventDefault() 47 | 48 | $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) 49 | 50 | $parent.trigger(e = $.Event('close')) 51 | 52 | if (e.isDefaultPrevented()) return 53 | 54 | $parent.removeClass('in') 55 | 56 | function removeElement() { 57 | $parent 58 | .trigger('closed') 59 | .remove() 60 | } 61 | 62 | $.support.transition && $parent.hasClass('fade') ? 63 | $parent.on($.support.transition.end, removeElement) : 64 | removeElement() 65 | } 66 | 67 | 68 | /* ALERT PLUGIN DEFINITION 69 | * ======================= */ 70 | 71 | $.fn.alert = function (option) { 72 | return this.each(function () { 73 | var $this = $(this) 74 | , data = $this.data('alert') 75 | if (!data) $this.data('alert', (data = new Alert(this))) 76 | if (typeof option == 'string') data[option].call($this) 77 | }) 78 | } 79 | 80 | $.fn.alert.Constructor = Alert 81 | 82 | 83 | /* ALERT DATA-API 84 | * ============== */ 85 | 86 | $(function () { 87 | $('body').on('click.alert.data-api', dismiss, Alert.prototype.close) 88 | }) 89 | 90 | }(window.jQuery); -------------------------------------------------------------------------------- /search.php: -------------------------------------------------------------------------------- 1 | $alerts ) { 28 | foreach ( $alerts as $alert => $alert_settings ) { 29 | // Matching search 30 | if ( preg_match("/" . $search_term . "/i", $alert ) ) { 31 | if ( isset($alert_settings['notifications_enabled']) && $alert_settings['notifications_enabled'] == 0 ) { 32 | $state = "notification"; 33 | } else { 34 | $current_state = $alert_settings['current_state']; 35 | $state = $states[$current_state]; 36 | } 37 | 38 | $html .= ""; 39 | $html .= "" . $host_name . "" . $alert . ""; 40 | 41 | $count++; 42 | 43 | } // end of if ( preg_match("/" . $search_term . "/i" 44 | 45 | } 46 | } 47 | 48 | if ( $count > 0 ) { 49 | 50 | print "
51 | 52 | "; 53 | 54 | print $html; 55 | 56 | print ""; 57 | print ""; 58 | print ""; 59 | print ""; 61 | print "
 HostnameAlert
DisableDisable Notifications
EnableEnable Notifications
Schedule DowntimeDowntime, 60 | Duration seconds
"; 62 | 63 | 64 | print "

65 |
66 | 69 | "; 70 | 71 | } else { 72 | 73 | ?> 74 |
75 | No results. 76 |
77 | -------------------------------------------------------------------------------- /js/bootstrap-button.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-button.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#buttons 4 | * ============================================================ 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* BUTTON PUBLIC CLASS DEFINITION 27 | * ============================== */ 28 | 29 | var Button = function (element, options) { 30 | this.$element = $(element) 31 | this.options = $.extend({}, $.fn.button.defaults, options) 32 | } 33 | 34 | Button.prototype.setState = function (state) { 35 | var d = 'disabled' 36 | , $el = this.$element 37 | , data = $el.data() 38 | , val = $el.is('input') ? 'val' : 'html' 39 | 40 | state = state + 'Text' 41 | data.resetText || $el.data('resetText', $el[val]()) 42 | 43 | $el[val](data[state] || this.options[state]) 44 | 45 | // push to event loop to allow forms to submit 46 | setTimeout(function () { 47 | state == 'loadingText' ? 48 | $el.addClass(d).attr(d, d) : 49 | $el.removeClass(d).removeAttr(d) 50 | }, 0) 51 | } 52 | 53 | Button.prototype.toggle = function () { 54 | var $parent = this.$element.parent('[data-toggle="buttons-radio"]') 55 | 56 | $parent && $parent 57 | .find('.active') 58 | .removeClass('active') 59 | 60 | this.$element.toggleClass('active') 61 | } 62 | 63 | 64 | /* BUTTON PLUGIN DEFINITION 65 | * ======================== */ 66 | 67 | $.fn.button = function (option) { 68 | return this.each(function () { 69 | var $this = $(this) 70 | , data = $this.data('button') 71 | , options = typeof option == 'object' && option 72 | if (!data) $this.data('button', (data = new Button(this, options))) 73 | if (option == 'toggle') data.toggle() 74 | else if (option) data.setState(option) 75 | }) 76 | } 77 | 78 | $.fn.button.defaults = { 79 | loadingText: 'loading...' 80 | } 81 | 82 | $.fn.button.Constructor = Button 83 | 84 | 85 | /* BUTTON DATA-API 86 | * =============== */ 87 | 88 | $(function () { 89 | $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) { 90 | var $btn = $(e.target) 91 | if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') 92 | $btn.button('toggle') 93 | }) 94 | }) 95 | 96 | }(window.jQuery); -------------------------------------------------------------------------------- /js/bootstrap-dropdown.js: -------------------------------------------------------------------------------- 1 | /* ============================================================ 2 | * bootstrap-dropdown.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#dropdowns 4 | * ============================================================ 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* DROPDOWN CLASS DEFINITION 27 | * ========================= */ 28 | 29 | var toggle = '[data-toggle="dropdown"]' 30 | , Dropdown = function (element) { 31 | var $el = $(element).on('click.dropdown.data-api', this.toggle) 32 | $('html').on('click.dropdown.data-api', function () { 33 | $el.parent().removeClass('open') 34 | }) 35 | } 36 | 37 | Dropdown.prototype = { 38 | 39 | constructor: Dropdown 40 | 41 | , toggle: function (e) { 42 | var $this = $(this) 43 | , $parent 44 | , selector 45 | , isActive 46 | 47 | if ($this.is('.disabled, :disabled')) return 48 | 49 | selector = $this.attr('data-target') 50 | 51 | if (!selector) { 52 | selector = $this.attr('href') 53 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 54 | } 55 | 56 | $parent = $(selector) 57 | $parent.length || ($parent = $this.parent()) 58 | 59 | isActive = $parent.hasClass('open') 60 | 61 | clearMenus() 62 | 63 | if (!isActive) $parent.toggleClass('open') 64 | 65 | return false 66 | } 67 | 68 | } 69 | 70 | function clearMenus() { 71 | $(toggle).parent().removeClass('open') 72 | } 73 | 74 | 75 | /* DROPDOWN PLUGIN DEFINITION 76 | * ========================== */ 77 | 78 | $.fn.dropdown = function (option) { 79 | return this.each(function () { 80 | var $this = $(this) 81 | , data = $this.data('dropdown') 82 | if (!data) $this.data('dropdown', (data = new Dropdown(this))) 83 | if (typeof option == 'string') data[option].call($this) 84 | }) 85 | } 86 | 87 | $.fn.dropdown.Constructor = Dropdown 88 | 89 | 90 | /* APPLY TO STANDARD DROPDOWN ELEMENTS 91 | * =================================== */ 92 | 93 | $(function () { 94 | $('html').on('click.dropdown.data-api', clearMenus) 95 | $('body') 96 | .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() }) 97 | .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle) 98 | }) 99 | 100 | }(window.jQuery); -------------------------------------------------------------------------------- /js/bootstrap-popover.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * bootstrap-popover.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#popovers 4 | * =========================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * =========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* POPOVER PUBLIC CLASS DEFINITION 27 | * =============================== */ 28 | 29 | var Popover = function ( element, options ) { 30 | this.init('popover', element, options) 31 | } 32 | 33 | 34 | /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js 35 | ========================================== */ 36 | 37 | Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { 38 | 39 | constructor: Popover 40 | 41 | , setContent: function () { 42 | var $tip = this.tip() 43 | , title = this.getTitle() 44 | , content = this.getContent() 45 | 46 | $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title) 47 | $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content) 48 | 49 | $tip.removeClass('fade top bottom left right in') 50 | } 51 | 52 | , hasContent: function () { 53 | return this.getTitle() || this.getContent() 54 | } 55 | 56 | , getContent: function () { 57 | var content 58 | , $e = this.$element 59 | , o = this.options 60 | 61 | content = $e.attr('data-content') 62 | || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) 63 | 64 | return content 65 | } 66 | 67 | , tip: function () { 68 | if (!this.$tip) { 69 | this.$tip = $(this.options.template) 70 | } 71 | return this.$tip 72 | } 73 | 74 | }) 75 | 76 | 77 | /* POPOVER PLUGIN DEFINITION 78 | * ======================= */ 79 | 80 | $.fn.popover = function (option) { 81 | return this.each(function () { 82 | var $this = $(this) 83 | , data = $this.data('popover') 84 | , options = typeof option == 'object' && option 85 | if (!data) $this.data('popover', (data = new Popover(this, options))) 86 | if (typeof option == 'string') data[option]() 87 | }) 88 | } 89 | 90 | $.fn.popover.Constructor = Popover 91 | 92 | $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { 93 | placement: 'right' 94 | , content: '' 95 | , template: '

' 96 | }) 97 | 98 | }(window.jQuery); -------------------------------------------------------------------------------- /js/combobox.js: -------------------------------------------------------------------------------- 1 | (function( $ ) { 2 | $.widget( "ui.combobox", { 3 | _create: function() { 4 | var self = this, 5 | select = this.element.hide(), 6 | selected = select.children( ":selected" ), 7 | value = selected.val() ? selected.text() : ""; 8 | var input = this.input = $( "" ) 9 | .insertAfter( select ) 10 | .val( value ) 11 | .autocomplete({ 12 | delay: 0, 13 | minLength: 0, 14 | source: function( request, response ) { 15 | var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" ); 16 | response( select.children( "option" ).map(function() { 17 | var text = $( this ).text(); 18 | if ( this.value && ( !request.term || matcher.test(text) ) ) 19 | return { 20 | label: text.replace( 21 | new RegExp( 22 | "(?![^&;]+;)(?!<[^<>]*)(" + 23 | $.ui.autocomplete.escapeRegex(request.term) + 24 | ")(?![^<>]*>)(?![^&;]+;)", "gi" 25 | ), "$1" ), 26 | value: text, 27 | option: this 28 | }; 29 | }) ); 30 | }, 31 | select: function( event, ui ) { 32 | ui.item.option.selected = true; 33 | self._trigger( "selected", event, { 34 | item: ui.item.option 35 | }); 36 | this.form.submit(); 37 | }, 38 | change: function( event, ui ) { 39 | if ( !ui.item ) { 40 | var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ), 41 | valid = false; 42 | select.children( "option" ).each(function() { 43 | if ( $( this ).text().match( matcher ) ) { 44 | this.selected = valid = true; 45 | return false; 46 | } 47 | }); 48 | if ( !valid ) { 49 | // remove invalid value, as it didn't match anything 50 | $( this ).val( "" ); 51 | select.val( "" ); 52 | input.data( "autocomplete" ).term = ""; 53 | return false; 54 | } 55 | } 56 | } 57 | }) 58 | .addClass( "ui-widget ui-widget-content ui-corner-left" ); 59 | 60 | input.data( "autocomplete" )._renderItem = function( ul, item ) { 61 | return $( "
  • " ) 62 | .data( "item.autocomplete", item ) 63 | .append( "" + item.label + "" ) 64 | .appendTo( ul ); 65 | }; 66 | 67 | this.button = $( "" ) 68 | .attr( "tabIndex", -1 ) 69 | .attr( "title", "Show All Items" ) 70 | .insertAfter( input ) 71 | .button({ 72 | icons: { 73 | primary: "ui-icon-triangle-1-s" 74 | }, 75 | text: false 76 | }) 77 | .removeClass( "ui-corner-all" ) 78 | .addClass( "ui-corner-right ui-button-icon" ) 79 | .click(function() { 80 | // close if already visible 81 | if ( input.autocomplete( "widget" ).is( ":visible" ) ) { 82 | input.autocomplete( "close" ); 83 | return; 84 | } 85 | 86 | // work around a bug (likely same cause as #5265) 87 | $( this ).blur(); 88 | 89 | // pass empty string as value to search for, displaying all results 90 | input.autocomplete( "search", "" ); 91 | input.focus(); 92 | }); 93 | }, 94 | 95 | destroy: function() { 96 | this.input.remove(); 97 | this.button.remove(); 98 | this.element.show(); 99 | $.Widget.prototype.destroy.call( this ); 100 | } 101 | }); 102 | })( jQuery ); 103 | -------------------------------------------------------------------------------- /actions.php: -------------------------------------------------------------------------------- 1 | 23 | Problem! Host name is not valid ' . $_REQUEST['host_name'] . '. Please fix and resubmit. 24 | 25 | '; 26 | exit(1); 27 | } else { 28 | $host_name = $_REQUEST['host_name']; 29 | } 30 | 31 | if ( isset($_REQUEST['regex_search']) and $_REQUEST['regex_search'] == 1 ) { 32 | $regex_search = TRUE; 33 | } else { 34 | $regex_search = FALSE; 35 | } 36 | 37 | 38 | switch ( $_REQUEST['action'] ) { 39 | 40 | case "disable_notifications": 41 | $action = "notifications will be disabled"; 42 | break; 43 | case "enable_notifications": 44 | $action = "notifications will be enabled"; 45 | break; 46 | case "downtime": 47 | $action = "scheduled for downtime"; 48 | break; 49 | 50 | } 51 | 52 | print ' 53 |
    54 | '; 55 | 56 | ###################################################################################### 57 | # If alert hash is not available we are operating on a single host 58 | ###################################################################################### 59 | if ( !isset($_REQUEST['alert']) or size($_REQUEST['alert']) == 0 ) { 60 | 61 | switch ( $_REQUEST['action'] ) { 62 | 63 | case "disable_notifications": 64 | disable_host_notifications($host_name); 65 | break; 66 | case "enable_notifications": 67 | enable_host_notifications($host_name); 68 | break; 69 | case "downtime": 70 | schedule_host_downtime($host_name, is_numeric($_REQUEST['downtime_duration']) ? $_REQUEST['downtime_duration'] : 0 ); 71 | foreach ($nagios['services'][$host_name] as $alert_name => $details ) { 72 | print "Disabling $alert_name
    "; 73 | schedule_service_downtime($host_name, $alert_name, is_numeric($_REQUEST['downtime_duration']) ? $_REQUEST['downtime_duration'] : 0 ); 74 | } 75 | break; 76 | 77 | } 78 | 79 | print "Command sent"; 80 | 81 | } else { 82 | 83 | foreach ( $_REQUEST['alert'] as $index => $alert ) { 84 | // If it's regex_search we are encoding hostname and alert with a pipe 85 | if ( $regex_search ) { 86 | if ( preg_match("/^(.*)(\|)(.*)/", $alert, $out ) ) { 87 | $host_name = $out[1]; 88 | $alert_name = $out[3]; 89 | } else { 90 | continue; 91 | } 92 | } else { 93 | $alert_name = $alert; 94 | } 95 | 96 | // Make sure alert exists 97 | if ( isset($nagios['services'][$host_name][$alert_name] ) ) { 98 | 99 | print "" . $alert . " " . $action . "
    "; 100 | 101 | switch ( $_REQUEST['action'] ) { 102 | 103 | case "disable_notifications": 104 | disable_service_notifications($host_name, $alert_name); 105 | break; 106 | case "enable_notifications": 107 | enable_service_notifications($host_name, $alert_name); 108 | break; 109 | case "downtime": 110 | schedule_service_downtime($host_name, $alert_name, is_numeric($_REQUEST['downtime_duration']) ? $_REQUEST['downtime_duration'] : 0 ); 111 | break; 112 | 113 | } 114 | 115 | } 116 | 117 | } // end of foreach ( $_REQUEST['alert'] as $index => $alert ) { 118 | 119 | } // end if ( !isset($_REQUEST['alert']) or size($_REQUEST['alert']) == 0 ) { 120 | 121 | 122 | print '
    '; 123 | 124 | 125 | ?> -------------------------------------------------------------------------------- /js/bootstrap-tab.js: -------------------------------------------------------------------------------- 1 | /* ======================================================== 2 | * bootstrap-tab.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#tabs 4 | * ======================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ======================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* TAB CLASS DEFINITION 27 | * ==================== */ 28 | 29 | var Tab = function ( element ) { 30 | this.element = $(element) 31 | } 32 | 33 | Tab.prototype = { 34 | 35 | constructor: Tab 36 | 37 | , show: function () { 38 | var $this = this.element 39 | , $ul = $this.closest('ul:not(.dropdown-menu)') 40 | , selector = $this.attr('data-target') 41 | , previous 42 | , $target 43 | , e 44 | 45 | if (!selector) { 46 | selector = $this.attr('href') 47 | selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 48 | } 49 | 50 | if ( $this.parent('li').hasClass('active') ) return 51 | 52 | previous = $ul.find('.active a').last()[0] 53 | 54 | e = $.Event('show', { 55 | relatedTarget: previous 56 | }) 57 | 58 | $this.trigger(e) 59 | 60 | if (e.isDefaultPrevented()) return 61 | 62 | $target = $(selector) 63 | 64 | this.activate($this.parent('li'), $ul) 65 | this.activate($target, $target.parent(), function () { 66 | $this.trigger({ 67 | type: 'shown' 68 | , relatedTarget: previous 69 | }) 70 | }) 71 | } 72 | 73 | , activate: function ( element, container, callback) { 74 | var $active = container.find('> .active') 75 | , transition = callback 76 | && $.support.transition 77 | && $active.hasClass('fade') 78 | 79 | function next() { 80 | $active 81 | .removeClass('active') 82 | .find('> .dropdown-menu > .active') 83 | .removeClass('active') 84 | 85 | element.addClass('active') 86 | 87 | if (transition) { 88 | element[0].offsetWidth // reflow for transition 89 | element.addClass('in') 90 | } else { 91 | element.removeClass('fade') 92 | } 93 | 94 | if ( element.parent('.dropdown-menu') ) { 95 | element.closest('li.dropdown').addClass('active') 96 | } 97 | 98 | callback && callback() 99 | } 100 | 101 | transition ? 102 | $active.one($.support.transition.end, next) : 103 | next() 104 | 105 | $active.removeClass('in') 106 | } 107 | } 108 | 109 | 110 | /* TAB PLUGIN DEFINITION 111 | * ===================== */ 112 | 113 | $.fn.tab = function ( option ) { 114 | return this.each(function () { 115 | var $this = $(this) 116 | , data = $this.data('tab') 117 | if (!data) $this.data('tab', (data = new Tab(this))) 118 | if (typeof option == 'string') data[option]() 119 | }) 120 | } 121 | 122 | $.fn.tab.Constructor = Tab 123 | 124 | 125 | /* TAB DATA-API 126 | * ============ */ 127 | 128 | $(function () { 129 | $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { 130 | e.preventDefault() 131 | $(this).tab('show') 132 | }) 133 | }) 134 | 135 | }(window.jQuery); -------------------------------------------------------------------------------- /js/bootstrap-scrollspy.js: -------------------------------------------------------------------------------- 1 | /* ============================================================= 2 | * bootstrap-scrollspy.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#scrollspy 4 | * ============================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* SCROLLSPY CLASS DEFINITION 27 | * ========================== */ 28 | 29 | function ScrollSpy( element, options) { 30 | var process = $.proxy(this.process, this) 31 | , $element = $(element).is('body') ? $(window) : $(element) 32 | , href 33 | this.options = $.extend({}, $.fn.scrollspy.defaults, options) 34 | this.$scrollElement = $element.on('scroll.scroll.data-api', process) 35 | this.selector = (this.options.target 36 | || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 37 | || '') + ' .nav li > a' 38 | this.$body = $('body') 39 | this.refresh() 40 | this.process() 41 | } 42 | 43 | ScrollSpy.prototype = { 44 | 45 | constructor: ScrollSpy 46 | 47 | , refresh: function () { 48 | var self = this 49 | , $targets 50 | 51 | this.offsets = $([]) 52 | this.targets = $([]) 53 | 54 | $targets = this.$body 55 | .find(this.selector) 56 | .map(function () { 57 | var $el = $(this) 58 | , href = $el.data('target') || $el.attr('href') 59 | , $href = /^#\w/.test(href) && $(href) 60 | return ( $href 61 | && href.length 62 | && [[ $href.position().top, href ]] ) || null 63 | }) 64 | .sort(function (a, b) { return a[0] - b[0] }) 65 | .each(function () { 66 | self.offsets.push(this[0]) 67 | self.targets.push(this[1]) 68 | }) 69 | } 70 | 71 | , process: function () { 72 | var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 73 | , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight 74 | , maxScroll = scrollHeight - this.$scrollElement.height() 75 | , offsets = this.offsets 76 | , targets = this.targets 77 | , activeTarget = this.activeTarget 78 | , i 79 | 80 | if (scrollTop >= maxScroll) { 81 | return activeTarget != (i = targets.last()[0]) 82 | && this.activate ( i ) 83 | } 84 | 85 | for (i = offsets.length; i--;) { 86 | activeTarget != targets[i] 87 | && scrollTop >= offsets[i] 88 | && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) 89 | && this.activate( targets[i] ) 90 | } 91 | } 92 | 93 | , activate: function (target) { 94 | var active 95 | , selector 96 | 97 | this.activeTarget = target 98 | 99 | $(this.selector) 100 | .parent('.active') 101 | .removeClass('active') 102 | 103 | selector = this.selector 104 | + '[data-target="' + target + '"],' 105 | + this.selector + '[href="' + target + '"]' 106 | 107 | active = $(selector) 108 | .parent('li') 109 | .addClass('active') 110 | 111 | if (active.parent('.dropdown-menu')) { 112 | active = active.closest('li.dropdown').addClass('active') 113 | } 114 | 115 | active.trigger('activate') 116 | } 117 | 118 | } 119 | 120 | 121 | /* SCROLLSPY PLUGIN DEFINITION 122 | * =========================== */ 123 | 124 | $.fn.scrollspy = function ( option ) { 125 | return this.each(function () { 126 | var $this = $(this) 127 | , data = $this.data('scrollspy') 128 | , options = typeof option == 'object' && option 129 | if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) 130 | if (typeof option == 'string') data[option]() 131 | }) 132 | } 133 | 134 | $.fn.scrollspy.Constructor = ScrollSpy 135 | 136 | $.fn.scrollspy.defaults = { 137 | offset: 10 138 | } 139 | 140 | 141 | /* SCROLLSPY DATA-API 142 | * ================== */ 143 | 144 | $(function () { 145 | $('[data-spy="scroll"]').each(function () { 146 | var $spy = $(this) 147 | $spy.scrollspy($spy.data()) 148 | }) 149 | }) 150 | 151 | }(window.jQuery); -------------------------------------------------------------------------------- /js/bootstrap-collapse.js: -------------------------------------------------------------------------------- 1 | /* ============================================================= 2 | * bootstrap-collapse.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#collapse 4 | * ============================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ============================================================ */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* COLLAPSE PUBLIC CLASS DEFINITION 27 | * ================================ */ 28 | 29 | var Collapse = function (element, options) { 30 | this.$element = $(element) 31 | this.options = $.extend({}, $.fn.collapse.defaults, options) 32 | 33 | if (this.options.parent) { 34 | this.$parent = $(this.options.parent) 35 | } 36 | 37 | this.options.toggle && this.toggle() 38 | } 39 | 40 | Collapse.prototype = { 41 | 42 | constructor: Collapse 43 | 44 | , dimension: function () { 45 | var hasWidth = this.$element.hasClass('width') 46 | return hasWidth ? 'width' : 'height' 47 | } 48 | 49 | , show: function () { 50 | var dimension 51 | , scroll 52 | , actives 53 | , hasData 54 | 55 | if (this.transitioning) return 56 | 57 | dimension = this.dimension() 58 | scroll = $.camelCase(['scroll', dimension].join('-')) 59 | actives = this.$parent && this.$parent.find('> .accordion-group > .in') 60 | 61 | if (actives && actives.length) { 62 | hasData = actives.data('collapse') 63 | if (hasData && hasData.transitioning) return 64 | actives.collapse('hide') 65 | hasData || actives.data('collapse', null) 66 | } 67 | 68 | this.$element[dimension](0) 69 | this.transition('addClass', $.Event('show'), 'shown') 70 | this.$element[dimension](this.$element[0][scroll]) 71 | } 72 | 73 | , hide: function () { 74 | var dimension 75 | if (this.transitioning) return 76 | dimension = this.dimension() 77 | this.reset(this.$element[dimension]()) 78 | this.transition('removeClass', $.Event('hide'), 'hidden') 79 | this.$element[dimension](0) 80 | } 81 | 82 | , reset: function (size) { 83 | var dimension = this.dimension() 84 | 85 | this.$element 86 | .removeClass('collapse') 87 | [dimension](size || 'auto') 88 | [0].offsetWidth 89 | 90 | this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') 91 | 92 | return this 93 | } 94 | 95 | , transition: function (method, startEvent, completeEvent) { 96 | var that = this 97 | , complete = function () { 98 | if (startEvent.type == 'show') that.reset() 99 | that.transitioning = 0 100 | that.$element.trigger(completeEvent) 101 | } 102 | 103 | this.$element.trigger(startEvent) 104 | 105 | if (startEvent.isDefaultPrevented()) return 106 | 107 | this.transitioning = 1 108 | 109 | this.$element[method]('in') 110 | 111 | $.support.transition && this.$element.hasClass('collapse') ? 112 | this.$element.one($.support.transition.end, complete) : 113 | complete() 114 | } 115 | 116 | , toggle: function () { 117 | this[this.$element.hasClass('in') ? 'hide' : 'show']() 118 | } 119 | 120 | } 121 | 122 | 123 | /* COLLAPSIBLE PLUGIN DEFINITION 124 | * ============================== */ 125 | 126 | $.fn.collapse = function (option) { 127 | return this.each(function () { 128 | var $this = $(this) 129 | , data = $this.data('collapse') 130 | , options = typeof option == 'object' && option 131 | if (!data) $this.data('collapse', (data = new Collapse(this, options))) 132 | if (typeof option == 'string') data[option]() 133 | }) 134 | } 135 | 136 | $.fn.collapse.defaults = { 137 | toggle: true 138 | } 139 | 140 | $.fn.collapse.Constructor = Collapse 141 | 142 | 143 | /* COLLAPSIBLE DATA-API 144 | * ==================== */ 145 | 146 | $(function () { 147 | $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) { 148 | var $this = $(this), href 149 | , target = $this.attr('data-target') 150 | || e.preventDefault() 151 | || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 152 | , option = $(target).data('collapse') ? 'toggle' : $this.data() 153 | $(target).collapse(option) 154 | }) 155 | }) 156 | 157 | }(window.jQuery); -------------------------------------------------------------------------------- /js/bootstrap-carousel.js: -------------------------------------------------------------------------------- 1 | /* ========================================================== 2 | * bootstrap-carousel.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#carousel 4 | * ========================================================== 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================== */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* CAROUSEL CLASS DEFINITION 27 | * ========================= */ 28 | 29 | var Carousel = function (element, options) { 30 | this.$element = $(element) 31 | this.options = options 32 | this.options.slide && this.slide(this.options.slide) 33 | this.options.pause == 'hover' && this.$element 34 | .on('mouseenter', $.proxy(this.pause, this)) 35 | .on('mouseleave', $.proxy(this.cycle, this)) 36 | } 37 | 38 | Carousel.prototype = { 39 | 40 | cycle: function (e) { 41 | if (!e) this.paused = false 42 | this.options.interval 43 | && !this.paused 44 | && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 45 | return this 46 | } 47 | 48 | , to: function (pos) { 49 | var $active = this.$element.find('.active') 50 | , children = $active.parent().children() 51 | , activePos = children.index($active) 52 | , that = this 53 | 54 | if (pos > (children.length - 1) || pos < 0) return 55 | 56 | if (this.sliding) { 57 | return this.$element.one('slid', function () { 58 | that.to(pos) 59 | }) 60 | } 61 | 62 | if (activePos == pos) { 63 | return this.pause().cycle() 64 | } 65 | 66 | return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos])) 67 | } 68 | 69 | , pause: function (e) { 70 | if (!e) this.paused = true 71 | clearInterval(this.interval) 72 | this.interval = null 73 | return this 74 | } 75 | 76 | , next: function () { 77 | if (this.sliding) return 78 | return this.slide('next') 79 | } 80 | 81 | , prev: function () { 82 | if (this.sliding) return 83 | return this.slide('prev') 84 | } 85 | 86 | , slide: function (type, next) { 87 | var $active = this.$element.find('.active') 88 | , $next = next || $active[type]() 89 | , isCycling = this.interval 90 | , direction = type == 'next' ? 'left' : 'right' 91 | , fallback = type == 'next' ? 'first' : 'last' 92 | , that = this 93 | , e = $.Event('slide') 94 | 95 | this.sliding = true 96 | 97 | isCycling && this.pause() 98 | 99 | $next = $next.length ? $next : this.$element.find('.item')[fallback]() 100 | 101 | if ($next.hasClass('active')) return 102 | 103 | if ($.support.transition && this.$element.hasClass('slide')) { 104 | this.$element.trigger(e) 105 | if (e.isDefaultPrevented()) return 106 | $next.addClass(type) 107 | $next[0].offsetWidth // force reflow 108 | $active.addClass(direction) 109 | $next.addClass(direction) 110 | this.$element.one($.support.transition.end, function () { 111 | $next.removeClass([type, direction].join(' ')).addClass('active') 112 | $active.removeClass(['active', direction].join(' ')) 113 | that.sliding = false 114 | setTimeout(function () { that.$element.trigger('slid') }, 0) 115 | }) 116 | } else { 117 | this.$element.trigger(e) 118 | if (e.isDefaultPrevented()) return 119 | $active.removeClass('active') 120 | $next.addClass('active') 121 | this.sliding = false 122 | this.$element.trigger('slid') 123 | } 124 | 125 | isCycling && this.cycle() 126 | 127 | return this 128 | } 129 | 130 | } 131 | 132 | 133 | /* CAROUSEL PLUGIN DEFINITION 134 | * ========================== */ 135 | 136 | $.fn.carousel = function (option) { 137 | return this.each(function () { 138 | var $this = $(this) 139 | , data = $this.data('carousel') 140 | , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) 141 | if (!data) $this.data('carousel', (data = new Carousel(this, options))) 142 | if (typeof option == 'number') data.to(option) 143 | else if (typeof option == 'string' || (option = options.slide)) data[option]() 144 | else if (options.interval) data.cycle() 145 | }) 146 | } 147 | 148 | $.fn.carousel.defaults = { 149 | interval: 5000 150 | , pause: 'hover' 151 | } 152 | 153 | $.fn.carousel.Constructor = Carousel 154 | 155 | 156 | /* CAROUSEL DATA-API 157 | * ================= */ 158 | 159 | $(function () { 160 | $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) { 161 | var $this = $(this), href 162 | , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 163 | , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data()) 164 | $target.carousel(options) 165 | e.preventDefault() 166 | }) 167 | }) 168 | 169 | }(window.jQuery); -------------------------------------------------------------------------------- /nagios_commands.php: -------------------------------------------------------------------------------- 1 | nobody 18 | # [password] => secret 19 | # [p] => true 20 | #) 21 | function commandline_arguments($argv) { 22 | $_ARG = array(); 23 | foreach ($argv as $arg) { 24 | if (ereg('--[a-zA-Z0-9]*=.*',$arg)) { 25 | $str = split("=",$arg); $arg = ''; 26 | $key = ereg_replace("--",'',$str[0]); 27 | for ( $i = 1; $i < count($str); $i++ ) { 28 | $arg .= $str[$i]; 29 | } 30 | $_ARG[$key] = $arg; 31 | } elseif(ereg('-[a-zA-Z0-9]',$arg)) { 32 | $arg = ereg_replace("-",'',$arg); 33 | $_ARG[$arg] = 'true'; 34 | } 35 | 36 | } 37 | return $_ARG; 38 | } 39 | 40 | 41 | /////////////////////////////////////////////////////////////////////////////// 42 | // Function that opens up a pipe to Nagios command file and sends a command 43 | /////////////////////////////////////////////////////////////////////////////// 44 | function send_command_to_nagios( $command_string ) { 45 | 46 | global $conf; 47 | 48 | if ( file_exists ( $conf['nagios_command_file'] ) ) { 49 | $fifo = fopen( $conf['nagios_command_file'], 'a'); 50 | fwrite($fifo, $command_string); 51 | fclose($fifo); 52 | 53 | } else { 54 | return 1; 55 | } 56 | 57 | } 58 | 59 | /////////////////////////////////////////////////////////////////////////////// 60 | // 61 | /////////////////////////////////////////////////////////////////////////////// 62 | function schedule_service_downtime($hostname, $service, $downtime = 0 ) { 63 | 64 | global $conf; 65 | if ( $downtime == 0 ) 66 | $downtime = $conf['default_downtime_period']; 67 | $now = time(); 68 | $end_maint = $now + $downtime; 69 | 70 | 71 | $command_string = "[$now] SCHEDULE_SVC_DOWNTIME;$hostname;$service;$now;$end_maint;1;0;$downtime;SCRIPT;Invoked from command line\n"; 72 | 73 | send_command_to_nagios( $command_string ); 74 | 75 | } 76 | 77 | /////////////////////////////////////////////////////////////////////////////// 78 | // 79 | /////////////////////////////////////////////////////////////////////////////// 80 | function schedule_host_service_downtime($hostname, $downtime = 0 ) { 81 | 82 | global $conf; 83 | if ( $downtime == 0 ) 84 | $downtime = $conf['default_downtime_period']; 85 | $now = time(); 86 | $end_maint = $now + $downtime; 87 | 88 | $command_string = "[$now] SCHEDULE_HOST_SVC_DOWNTIME;$hostname;$now;$end_maint;0;0;$downtime;SCRIPT;Invoked from command line\n"; 89 | 90 | send_command_to_nagios( $command_string ); 91 | 92 | } 93 | 94 | /////////////////////////////////////////////////////////////////////////////// 95 | // 96 | /////////////////////////////////////////////////////////////////////////////// 97 | function schedule_host_downtime($hostname, $downtime = 0 ) { 98 | 99 | global $conf; 100 | if ( $downtime == 0 ) 101 | $downtime = $conf['default_downtime_period']; 102 | $now = time(); 103 | $end_maint = $now + $downtime; 104 | 105 | 106 | $command_string = "[$now] SCHEDULE_HOST_DOWNTIME;$hostname;$now;$end_maint;0;0;$downtime;SCRIPT;Invoked from command line\n"; 107 | 108 | send_command_to_nagios( $command_string ); 109 | 110 | } 111 | 112 | /////////////////////////////////////////////////////////////////////////////// 113 | // 114 | /////////////////////////////////////////////////////////////////////////////// 115 | function enable_service_notifications($hostname, $service ) { 116 | 117 | global $conf; 118 | 119 | $now = time(); 120 | 121 | $command_string = "[$now] ENABLE_SVC_NOTIFICATIONS;$hostname;$service\n"; 122 | 123 | send_command_to_nagios( $command_string ); 124 | 125 | } 126 | 127 | /////////////////////////////////////////////////////////////////////////////// 128 | // 129 | /////////////////////////////////////////////////////////////////////////////// 130 | function disable_service_notifications($hostname, $service ) { 131 | 132 | global $conf; 133 | 134 | $now = time(); 135 | 136 | $command_string = "[$now] DISABLE_SVC_NOTIFICATIONS;$hostname;$service\n"; 137 | 138 | send_command_to_nagios( $command_string ); 139 | 140 | } 141 | 142 | /////////////////////////////////////////////////////////////////////////////// 143 | // 144 | /////////////////////////////////////////////////////////////////////////////// 145 | function disable_all_service_notifications($hostname ) { 146 | 147 | global $conf; 148 | 149 | $now = time(); 150 | 151 | $command_string = "[$now] DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST;$hostname\n"; 152 | 153 | send_command_to_nagios( $command_string ); 154 | 155 | } 156 | 157 | /////////////////////////////////////////////////////////////////////////////// 158 | // 159 | /////////////////////////////////////////////////////////////////////////////// 160 | function disable_host_notifications( $hostname ) { 161 | 162 | global $conf; 163 | 164 | $now = time(); 165 | 166 | $command_string = "[$now] DISABLE_HOST_NOTIFICATIONS;$hostname\n"; 167 | 168 | send_command_to_nagios( $command_string ); 169 | 170 | } 171 | 172 | /////////////////////////////////////////////////////////////////////////////// 173 | // 174 | /////////////////////////////////////////////////////////////////////////////// 175 | function enable_host_notifications($hostname ) { 176 | 177 | global $conf; 178 | 179 | $now = time(); 180 | 181 | $command_string = "[$now] ENABLE_HOST_NOTIFICATIONS;$hostname\n"; 182 | 183 | send_command_to_nagios( $command_string ); 184 | 185 | } 186 | 187 | 188 | ?> 189 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Alerting controller 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 20 | 49 | 50 | 51 | 52 | 70 | 71 |
    72 |
    73 |

    Alert Controller

    74 |
    75 |
    76 | "ok", 102 | 1 => "warning", 103 | 2 => "critical", 104 | 3 => "unknown" 105 | ); 106 | 107 | 108 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 109 | // 110 | ///////////////////////////////////////////////////////////////////////////////////////////////////// 111 | if ( !isset($_REQUEST['regex']) ) { 112 | 113 | ?> 114 |
    115 |
    Hostname: 116 | "; 123 | 124 | if ( isset($arguments['host_name']) && $arguments['host_name'] != "none" ) { 125 | 126 | $host_name = $arguments['host_name']; 127 | 128 | print " 129 | "; 130 | foreach ( $nagios['services'][$host_name] as $alert => $alert_settings ) { 131 | if ( isset($alert_settings['notifications_enabled']) && $alert_settings['notifications_enabled'] == 0 ) { 132 | $state = "notification"; 133 | } else { 134 | $current_state = $alert_settings['current_state']; 135 | $state = $states[$current_state]; 136 | } 137 | 138 | print ""; 139 | print ""; 140 | } 141 | print ""; 142 | print ""; 143 | print ""; 144 | print ""; 146 | print "
     Alert
    " . $alert . "
    DisableDisable Notifications
    EnableEnable Notifications
    Schedule DowntimeDowntime, 145 | Duration seconds
    "; 147 | 148 | 149 | print "

    150 |
    151 | 154 | "; 155 | 156 | } 157 | 158 | } // end of if ( !isset($_REQUEST['regex']) ) 159 | 160 | if ( isset($_REQUEST['regex']) && $_REQUEST['regex'] == 1 ) { 161 | 162 | ?> 163 | 164 |
    165 | Regular expression 166 | 167 |
    168 | 169 |
    170 |
    171 | 172 | ";print_r($nagios); 175 | 176 | ?> 177 |
    178 |
    179 |
    180 |
    181 | 182 | 183 | 184 | -------------------------------------------------------------------------------- /js/bootstrap-modal.js: -------------------------------------------------------------------------------- 1 | /* ========================================================= 2 | * bootstrap-modal.js v2.0.3 3 | * http://twitter.github.com/bootstrap/javascript.html#modals 4 | * ========================================================= 5 | * Copyright 2012 Twitter, Inc. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | * ========================================================= */ 19 | 20 | 21 | !function ($) { 22 | 23 | "use strict"; // jshint ;_; 24 | 25 | 26 | /* MODAL CLASS DEFINITION 27 | * ====================== */ 28 | 29 | var Modal = function (content, options) { 30 | this.options = options 31 | this.$element = $(content) 32 | .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) 33 | } 34 | 35 | Modal.prototype = { 36 | 37 | constructor: Modal 38 | 39 | , toggle: function () { 40 | return this[!this.isShown ? 'show' : 'hide']() 41 | } 42 | 43 | , show: function () { 44 | var that = this 45 | , e = $.Event('show') 46 | 47 | this.$element.trigger(e) 48 | 49 | if (this.isShown || e.isDefaultPrevented()) return 50 | 51 | $('body').addClass('modal-open') 52 | 53 | this.isShown = true 54 | 55 | escape.call(this) 56 | backdrop.call(this, function () { 57 | var transition = $.support.transition && that.$element.hasClass('fade') 58 | 59 | if (!that.$element.parent().length) { 60 | that.$element.appendTo(document.body) //don't move modals dom position 61 | } 62 | 63 | that.$element 64 | .show() 65 | 66 | if (transition) { 67 | that.$element[0].offsetWidth // force reflow 68 | } 69 | 70 | that.$element.addClass('in') 71 | 72 | transition ? 73 | that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) : 74 | that.$element.trigger('shown') 75 | 76 | }) 77 | } 78 | 79 | , hide: function (e) { 80 | e && e.preventDefault() 81 | 82 | var that = this 83 | 84 | e = $.Event('hide') 85 | 86 | this.$element.trigger(e) 87 | 88 | if (!this.isShown || e.isDefaultPrevented()) return 89 | 90 | this.isShown = false 91 | 92 | $('body').removeClass('modal-open') 93 | 94 | escape.call(this) 95 | 96 | this.$element.removeClass('in') 97 | 98 | $.support.transition && this.$element.hasClass('fade') ? 99 | hideWithTransition.call(this) : 100 | hideModal.call(this) 101 | } 102 | 103 | } 104 | 105 | 106 | /* MODAL PRIVATE METHODS 107 | * ===================== */ 108 | 109 | function hideWithTransition() { 110 | var that = this 111 | , timeout = setTimeout(function () { 112 | that.$element.off($.support.transition.end) 113 | hideModal.call(that) 114 | }, 500) 115 | 116 | this.$element.one($.support.transition.end, function () { 117 | clearTimeout(timeout) 118 | hideModal.call(that) 119 | }) 120 | } 121 | 122 | function hideModal(that) { 123 | this.$element 124 | .hide() 125 | .trigger('hidden') 126 | 127 | backdrop.call(this) 128 | } 129 | 130 | function backdrop(callback) { 131 | var that = this 132 | , animate = this.$element.hasClass('fade') ? 'fade' : '' 133 | 134 | if (this.isShown && this.options.backdrop) { 135 | var doAnimate = $.support.transition && animate 136 | 137 | this.$backdrop = $('