Changeset 112

Show
Ignore:
Timestamp:
03/22/08 21:17:07 (5 years ago)
Author:
divagater
Message:

Various updates

Location:
trunk
Files:
1 added
12 modified

Legend:

Unmodified
Added
Removed
  • trunk/controllers/comments.php

    r97 r112  
    1414 * @version             $Id: $ 
    1515 */ 
    16  
    17 require_once("include/auth.php"); 
    1816 
    1917/** 
  • trunk/controllers/controller.php

    r97 r112  
    213213        'event_handler'                 => 'Event Handler',  
    214214        'check_command'                 => 'Check Command',  
     215        'command_line'                  => 'Command Line',  
    215216        'normal_check_interval'         => 'Normal Check Interval',  
    216217        'retry_check_interval'          => 'Retry Check Interval',  
  • trunk/controllers/hosts.php

    r111 r112  
    1515 */ 
    1616 
    17 require_once("include/auth.php"); 
    18 require_once("plugins/npc/controllers/comments.php"); 
     17require_once($config["base_path"]."/plugins/npc/controllers/comments.php"); 
    1918 
    2019/** 
     
    236235        if ($key == 'current_state') { 
    237236            $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            } 
    238243        } 
    239244 
  • trunk/controllers/services.php

    r104 r112  
    1515 */ 
    1616 
    17 require_once("include/auth.php"); 
    18 require_once("plugins/npc/controllers/comments.php"); 
     17require_once($config["base_path"]."/plugins/npc/controllers/comments.php"); 
    1918 
    2019/** 
     
    7069            'last_state_change', 
    7170            'check_command', 
     71            'command_line', 
    7272            'current_check_attempt', 
    7373            'last_check', 
     
    202202    } 
    203203 
    204     function getPerfData($id) { 
     204    function getPerfData($id=null) { 
     205 
     206        $id = $this->id ? $this->id : $id; 
    205207 
    206208        $q = new Doctrine_Pager( 
    207209            Doctrine_Query::create() 
    208                 ->select('n.perfdata') 
     210                ->select('n.*') 
    209211                ->from('NpcServicechecks n, NpcServices n2') 
    210212                    ->where('n.service_object_id = ? AND n2.service_object_id = n.service_object_id AND n.start_time' 
     
    254256        if ($key == 'current_state') { 
    255257            $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            } 
    256264        } 
    257265 
     
    281289        } 
    282290 
     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 
    283297        if ($return == '' || !$return) { 
    284298            $return = 'NA'; 
  • trunk/js/src/monitoring/commandForms.js

    r111 r112  
    8888            name: 'p_comment', 
    8989            xtype: 'htmleditor', 
    90             height:200, 
     90            height:150, 
    9191            width: 500 
    9292        },{ 
     
    105105        closable: true, 
    106106        width:680, 
    107         height:400, 
     107        height:375, 
    108108        bodyStyle:'padding:5px;', 
    109109        items: form 
     
    557557    var cmd = 'SCHEDULE_' + type.toUpperCase() + '_DOWNTIME'; 
    558558 
     559    var title = 'Schedule Host Downtime - ' + host; 
     560 
     561    if (type == 'svc') { 
     562        title = 'Schedule Service Downtime - ' + host + ': ' + service; 
     563    } 
     564 
    559565    var sd = new Date(); 
    560566    var ed = new Date(); 
     
    636642                    valueField:'value', 
    637643                    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.", 
    638646                    listeners: { 
    639647                        expand: function(comboBox) { 
    640648                            comboBox.list.setWidth( 'auto' ); 
    641649                            comboBox.innerList.setWidth( 'auto' ); 
     650                        }, 
     651                        render: function(o) { 
     652                            npc.setFormFieldTooltip(o); 
    642653                        } 
    643654                    }, 
     
    662673                name: 'p_stime', 
    663674                value: startDate, 
     675                labelStyle: 'cursor: help;', 
     676                tooltipText: "Start time must be in the format 'YYYY-MM-DD HH:MM:SS'.", 
    664677                listeners: { 
    665678                    change: function(comboBox) { 
     
    667680                        var d = new Date(v.replace(/-/g,' ')); 
    668681                        form.form.setValues({p_start_time: d.format('U')}); 
     682                    }, 
     683                    render: function(o) { 
     684                        npc.setFormFieldTooltip(o); 
    669685                    } 
    670686                }, 
     
    675691                name: 'p_etime', 
    676692                value: endDate, 
     693                labelStyle: 'cursor: help;', 
     694                tooltipText: "End time must be in the format 'YYYY-MM-DD HH:MM:SS'.", 
    677695                listeners: { 
    678696                    change: function(comboBox) { 
     
    680698                        var d = new Date(v.replace(/-/g,' ')); 
    681699                        form.form.setValues({p_end_time: d.format('U')}); 
     700                    }, 
     701                    render: function(o) { 
     702                        npc.setFormFieldTooltip(o); 
    682703                    } 
    683704                }, 
     
    695716                    displayField:'name', 
    696717                    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                    }, 
    697725                    forceSelection:true, 
    698726                    mode: 'local', 
     
    710738                fieldLabel: 'Duration (minutes)', 
    711739                name: 'p_minutes', 
     740                value: 120, 
    712741                width: 50, 
    713742                listeners: { 
     
    766795 
    767796    var win = new Ext.Window({ 
    768         title:'Schedule Downtime', 
     797        title:title, 
    769798        layout:'fit', 
    770799        modal:true, 
    771800        closable: true, 
    772801        width:700, 
    773         height:500, 
     802        height:450, 
    774803        bodyStyle:'padding:5px;', 
    775804        items: form 
  • trunk/js/src/monitoring/hosts/hostCommandMenu.js

    r111 r112  
    2020                handler: function(o) { 
    2121                    post.p_command = 'REMOVE_HOST_ACKNOWLEDGEMENT'; 
     22                    post.p_host_name = host.host_name; 
    2223                    npc.doCommand(o.text+'?',post); 
    2324                } 
     
    3233        } 
    3334    } 
     35 
     36    menu.add({ 
     37        text: font + 'Re-schedule Next Check</b>', 
     38        handler: function() { 
     39            npc.scheduleNextCheck('host', host.host_name); 
     40        } 
     41    }); 
    3442 
    3543    a = host.active_checks_enabled ? 'Disable' : 'Enable'; 
     
    5967        handler: function() { 
    6068            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); 
    6869        } 
    6970    }); 
  • trunk/js/src/monitoring/hosts/hostDetail.js

    r111 r112  
    128128                        id: id + '-hn' 
    129129                    },{ 
    130                         title: 'Downtime History', 
     130                        title: 'Scheduled Downtime History', 
    131131                        id: id + '-hd' 
    132132                    },{ 
  • trunk/js/src/monitoring/services/serviceCommandMenu.js

    r111 r112  
    1616 
    1717    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        } 
    2436    } 
     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    }); 
    2544 
    2645    a = service.active_checks_enabled ? 'Disable' : 'Enable'; 
     
    5069        handler: function() { 
    5170            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); 
    5971        } 
    6072    }); 
  • trunk/js/src/monitoring/services/serviceDetail.js

    r111 r112  
    184184                        id: id + '-sn' 
    185185                    },{ 
    186                         title: 'Downtime History', 
     186                        title: 'Scheduled Downtime History', 
    187187                        id: id + '-sd' 
    188188                    },{ 
     
    485485        header:"Comment", 
    486486        dataIndex:'comment_data', 
    487         width:400 
     487        width:500 
    488488    },{ 
    489489        header:"Persistent", 
    490490        dataIndex:'is_persistent', 
    491491        renderer:npc.renderPersistent, 
    492         width:80 
     492        width:75 
    493493    },{ 
    494494        header:"Type", 
  • trunk/js/src/monitoring/services/services.js

    r111 r112  
    9797        dataIndex:'last_state_change', 
    9898        renderer: npc.getDuration, 
     99        hidden:true, 
    99100        width:110 
    100101    },{ 
  • trunk/setup.php

    r111 r112  
    13301330        global $config; 
    13311331        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>'; 
    13341337        } 
    13351338        npc_check_upgrade ();