Changeset 112
- Timestamp:
- 03/22/08 21:17:07 (5 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 modified
-
controllers/comments.php (modified) (1 diff)
-
controllers/controller.php (modified) (1 diff)
-
controllers/hosts.php (modified) (2 diffs)
-
controllers/services.php (modified) (5 diffs)
-
images/tab_npc.gif (modified) (previous)
-
images/tab_npc_down.gif (added)
-
js/src/monitoring/commandForms.js (modified) (11 diffs)
-
js/src/monitoring/hosts/hostCommandMenu.js (modified) (3 diffs)
-
js/src/monitoring/hosts/hostDetail.js (modified) (1 diff)
-
js/src/monitoring/services/serviceCommandMenu.js (modified) (2 diffs)
-
js/src/monitoring/services/serviceDetail.js (modified) (2 diffs)
-
js/src/monitoring/services/services.js (modified) (1 diff)
-
setup.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/controllers/comments.php
r97 r112 14 14 * @version $Id: $ 15 15 */ 16 17 require_once("include/auth.php");18 16 19 17 /** -
trunk/controllers/controller.php
r97 r112 213 213 'event_handler' => 'Event Handler', 214 214 'check_command' => 'Check Command', 215 'command_line' => 'Command Line', 215 216 'normal_check_interval' => 'Normal Check Interval', 216 217 'retry_check_interval' => 'Retry Check Interval', -
trunk/controllers/hosts.php
r111 r112 15 15 */ 16 16 17 require_once("include/auth.php"); 18 require_once("plugins/npc/controllers/comments.php"); 17 require_once($config["base_path"]."/plugins/npc/controllers/comments.php"); 19 18 20 19 /** … … 236 235 if ($key == 'current_state') { 237 236 $return = $cs[$results[$key]]; 237 if ($results['problem_has_been_acknowledged']) { 238 $comments = new NpcCommentsController; 239 $string = $comments->getAck($results['host_object_id']); 240 $ack = preg_split("/\*\|\*/", $string); 241 $return = '<pre>' . $return . ' (Acknowledged by ' . $ack[0] . ')</pre>'; 242 } 238 243 } 239 244 -
trunk/controllers/services.php
r104 r112 15 15 */ 16 16 17 require_once("include/auth.php"); 18 require_once("plugins/npc/controllers/comments.php"); 17 require_once($config["base_path"]."/plugins/npc/controllers/comments.php"); 19 18 20 19 /** … … 70 69 'last_state_change', 71 70 'check_command', 71 'command_line', 72 72 'current_check_attempt', 73 73 'last_check', … … 202 202 } 203 203 204 function getPerfData($id) { 204 function getPerfData($id=null) { 205 206 $id = $this->id ? $this->id : $id; 205 207 206 208 $q = new Doctrine_Pager( 207 209 Doctrine_Query::create() 208 ->select('n. perfdata')210 ->select('n.*') 209 211 ->from('NpcServicechecks n, NpcServices n2') 210 212 ->where('n.service_object_id = ? AND n2.service_object_id = n.service_object_id AND n.start_time' … … 254 256 if ($key == 'current_state') { 255 257 $return = $cs[$results[$key]]; 258 if ($results['problem_has_been_acknowledged']) { 259 $comments = new NpcCommentsController; 260 $string = $comments->getAck($results['service_object_id']); 261 $ack = preg_split("/\*\|\*/", $string); 262 $return = '<pre>' . $return . ' (Acknowledged by ' . $ack[0] . ')</pre>'; 263 } 256 264 } 257 265 … … 281 289 } 282 290 291 // Add the full command as a tooltip 292 if ($key == 'command_line') { 293 $perf = $this->getPerfData($results['service_object_id']); 294 $return = $perf[0]['command_line']; 295 } 296 283 297 if ($return == '' || !$return) { 284 298 $return = 'NA'; -
trunk/js/src/monitoring/commandForms.js
r111 r112 88 88 name: 'p_comment', 89 89 xtype: 'htmleditor', 90 height: 200,90 height:150, 91 91 width: 500 92 92 },{ … … 105 105 closable: true, 106 106 width:680, 107 height: 400,107 height:375, 108 108 bodyStyle:'padding:5px;', 109 109 items: form … … 557 557 var cmd = 'SCHEDULE_' + type.toUpperCase() + '_DOWNTIME'; 558 558 559 var title = 'Schedule Host Downtime - ' + host; 560 561 if (type == 'svc') { 562 title = 'Schedule Service Downtime - ' + host + ': ' + service; 563 } 564 559 565 var sd = new Date(); 560 566 var ed = new Date(); … … 636 642 valueField:'value', 637 643 forceSelection:true, 644 labelStyle: 'cursor: help;', 645 tooltipText: "Trigger the start of the downtime by the start of some other scheduled host or service downtime.", 638 646 listeners: { 639 647 expand: function(comboBox) { 640 648 comboBox.list.setWidth( 'auto' ); 641 649 comboBox.innerList.setWidth( 'auto' ); 650 }, 651 render: function(o) { 652 npc.setFormFieldTooltip(o); 642 653 } 643 654 }, … … 662 673 name: 'p_stime', 663 674 value: startDate, 675 labelStyle: 'cursor: help;', 676 tooltipText: "Start time must be in the format 'YYYY-MM-DD HH:MM:SS'.", 664 677 listeners: { 665 678 change: function(comboBox) { … … 667 680 var d = new Date(v.replace(/-/g,' ')); 668 681 form.form.setValues({p_start_time: d.format('U')}); 682 }, 683 render: function(o) { 684 npc.setFormFieldTooltip(o); 669 685 } 670 686 }, … … 675 691 name: 'p_etime', 676 692 value: endDate, 693 labelStyle: 'cursor: help;', 694 tooltipText: "End time must be in the format 'YYYY-MM-DD HH:MM:SS'.", 677 695 listeners: { 678 696 change: function(comboBox) { … … 680 698 var d = new Date(v.replace(/-/g,' ')); 681 699 form.form.setValues({p_end_time: d.format('U')}); 700 }, 701 render: function(o) { 702 npc.setFormFieldTooltip(o); 682 703 } 683 704 }, … … 695 716 displayField:'name', 696 717 valueField:'value', 718 labelStyle: 'cursor: help;', 719 tooltipText: "Flexible downtime starts when the service enters a non-OK state (sometime between the start and end times you specified) and lasts as long as the duration of time you enter. Fixed downtime is starts and ands strictly based on start and end times provided. The duration field does not apply for fixed downtime.", 720 listeners: { 721 render: function(o) { 722 npc.setFormFieldTooltip(o); 723 } 724 }, 697 725 forceSelection:true, 698 726 mode: 'local', … … 710 738 fieldLabel: 'Duration (minutes)', 711 739 name: 'p_minutes', 740 value: 120, 712 741 width: 50, 713 742 listeners: { … … 766 795 767 796 var win = new Ext.Window({ 768 title: 'Schedule Downtime',797 title:title, 769 798 layout:'fit', 770 799 modal:true, 771 800 closable: true, 772 801 width:700, 773 height: 500,802 height:450, 774 803 bodyStyle:'padding:5px;', 775 804 items: form -
trunk/js/src/monitoring/hosts/hostCommandMenu.js
r111 r112 20 20 handler: function(o) { 21 21 post.p_command = 'REMOVE_HOST_ACKNOWLEDGEMENT'; 22 post.p_host_name = host.host_name; 22 23 npc.doCommand(o.text+'?',post); 23 24 } … … 32 33 } 33 34 } 35 36 menu.add({ 37 text: font + 'Re-schedule Next Check</b>', 38 handler: function() { 39 npc.scheduleNextCheck('host', host.host_name); 40 } 41 }); 34 42 35 43 a = host.active_checks_enabled ? 'Disable' : 'Enable'; … … 59 67 handler: function() { 60 68 npc.sendCustomNotification('host', host.host_name); 61 }62 });63 64 menu.add({65 text: font + 'Re-schedule Next Check</b>',66 handler: function() {67 npc.scheduleNextCheck('host', host.host_name);68 69 } 69 70 }); -
trunk/js/src/monitoring/hosts/hostDetail.js
r111 r112 128 128 id: id + '-hn' 129 129 },{ 130 title: ' Downtime History',130 title: 'Scheduled Downtime History', 131 131 id: id + '-hd' 132 132 },{ -
trunk/js/src/monitoring/services/serviceCommandMenu.js
r111 r112 16 16 17 17 if (service.current_state == 2) { 18 menu.add({ 19 text: font + 'Acknowledge Problem</b>', 20 handler: function(o) { 21 npc.ackProblem('svc', service.host_name, service.service_description); 22 } 23 }); 18 if (!service.problem_has_been_acknowledged) { 19 menu.add({ 20 text: font + 'Acknowledge Problem</b>', 21 handler: function(o) { 22 npc.ackProblem('svc', service.host_name, service.service_description); 23 } 24 }); 25 } else { 26 menu.add({ 27 text: font + 'Remove problem acknowledgement</b>', 28 handler: function(o) { 29 post.p_command = 'REMOVE_SVC_ACKNOWLEDGEMENT'; 30 post.p_host_name = service.host_name; 31 post.p_service_description = service.service_description; 32 npc.doCommand(o.text+'?',post); 33 } 34 }); 35 } 24 36 } 37 38 menu.add({ 39 text: font + 'Re-schedule Next Check</b>', 40 handler: function() { 41 npc.scheduleNextCheck('svc', service.host_name, service.service_description); 42 } 43 }); 25 44 26 45 a = service.active_checks_enabled ? 'Disable' : 'Enable'; … … 50 69 handler: function() { 51 70 npc.sendCustomNotification('svc', service.host_name, service.service_description); 52 }53 });54 55 menu.add({56 text: font + 'Re-schedule Next Check</b>',57 handler: function() {58 npc.scheduleNextCheck('svc', service.host_name, service.service_description);59 71 } 60 72 }); -
trunk/js/src/monitoring/services/serviceDetail.js
r111 r112 184 184 id: id + '-sn' 185 185 },{ 186 title: ' Downtime History',186 title: 'Scheduled Downtime History', 187 187 id: id + '-sd' 188 188 },{ … … 485 485 header:"Comment", 486 486 dataIndex:'comment_data', 487 width: 400487 width:500 488 488 },{ 489 489 header:"Persistent", 490 490 dataIndex:'is_persistent', 491 491 renderer:npc.renderPersistent, 492 width: 80492 width:75 493 493 },{ 494 494 header:"Type", -
trunk/js/src/monitoring/services/services.js
r111 r112 97 97 dataIndex:'last_state_change', 98 98 renderer: npc.getDuration, 99 hidden:true, 99 100 width:110 100 101 },{ -
trunk/setup.php
r111 r112 1330 1330 global $config; 1331 1331 if (api_user_realm_auth('npc.php')) { 1332 print '<a href="' . $config['url_path'] . 'plugins/npc/npc.php"><img src="' . $config['url_path'] 1333 . 'plugins/npc/images/tab_npc.gif" alt="Nagios" align="absmiddle" border="0"></a>'; 1332 $cp = false; 1333 if (basename($_SERVER["PHP_SELF"]) == "npc.php") 1334 $cp = true; 1335 1336 print '<a href="' . $config['url_path'] . 'plugins/npc/npc.php"><img src="' . $config['url_path'] . 'plugins/npc/images/tab_npc' . ($cp ? "_down": "") . '.gif" alt="npc" align="absmiddle" border="0"></a>'; 1334 1337 } 1335 1338 npc_check_upgrade ();