diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/bartlby_action.php bartlby-ui/bartlby_action.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/bartlby_action.php 2007-01-29 05:04:12.000000000 +0100 +++ bartlby-ui/bartlby_action.php 2007-04-01 18:06:46.000000000 +0200 @@ -335,7 +335,7 @@ break; case 'modify_worker': $layout->set_menu("worker"); - if($_GET[worker_id] >= 0 && $_GET[worker_name] && $_GET[worker_password]) { + if($_GET[worker_id] >= 0 && $_GET[worker_name]) { if(!$btl->isSuperUser() && $btl->user_id != $_GET[worker_id]) { $btl->hasRight("modify_all_workers"); @@ -393,8 +393,15 @@ if($df == false) { $exec_plan=""; } + $end_pw= md5($_GET[worker_password]); - $add=bartlby_modify_worker($btl->CFG,$_GET[worker_id], $_GET[worker_mail], $_GET[worker_icq], $svcstr, $notifystr, $_GET[worker_active], $_GET[worker_name], md5($_GET[worker_password]), $triggerstr, $_GET[escalation_limit], $_GET[escalation_minutes], $exec_plan); + if(!$_GET[worker_password]) { + $wrk1 = bartlby_get_worker_by_id($btl->CFG, $_GET[worker_id]); + $end_pw=$wrk1[password]; + } + + + $add=bartlby_modify_worker($btl->CFG,$_GET[worker_id], $_GET[worker_mail], $_GET[worker_icq], $svcstr, $notifystr, $_GET[worker_active], $_GET[worker_name],$end_pw, $triggerstr, $_GET[escalation_limit], $_GET[escalation_minutes], $exec_plan); $btl->setUIRight("selected_servers", $selected_servers, $_GET[worker_name]); $btl->setUIRight("selected_services", $selected_services, $_GET[worker_name]); $layout->OUT .= ""; @@ -477,7 +484,7 @@ set_magic_quotes_runtime(0); $layout->set_menu("services"); - if($_GET[service_id] != "" && $_GET[service_id] && $_GET[service_server] && $_GET[service_type] && $_GET[service_name] && $_GET[service_interval]) { + if($_GET[service_id] != "" && $_GET[service_id] && $_GET[service_server] && $_GET[service_type] && $_GET[service_name] && $_GET[service_interval] != "") { $btl->hasServerorServiceRight($_GET[service_id]); $df=false; $exec_plan = ""; @@ -485,7 +492,12 @@ if($v != "") { $df = true; } - $exec_plan .= $k . "=" . $v . "|"; + if($_GET[wdays_inv][$k]) { + $sepa = "!"; + } else { + $sepa = "="; + } + $exec_plan .= $k . $sepa . $v . "|"; } @@ -526,14 +538,17 @@ if($v != "") { $df = true; } - $exec_plan .= $k . "=" . $v . "|"; + if($_GET[wdays_inv][$k]) { + $sepa = "!"; + } else { + $sepa = "="; + } + $exec_plan .= $k . $sepa . $v . "|"; } if($df == false) { $exec_plan=""; } - - $ads=bartlby_add_service($btl->CFG, $_GET[service_server], $_GET[service_plugin],$_GET[service_name],$_GET[service_args],$_GET[notify_enabled], $exec_plan,$_GET[service_interval],$_GET[service_type],$_GET[service_var], $_GET[service_passive_timeout], $_GET[service_check_timeout], $_GET[service_ack], $_GET[service_retain], $_GET[service_snmp_community], $_GET[service_snmp_objid], $_GET[service_snmp_version], $_GET[service_snmp_warning], $_GET[service_snmp_critical], $_GET[service_snmp_type],$_GET[service_active], $_GET[flap_seconds]); $global_msg=bartlby_get_server_by_id($btl->CFG, $_GET[service_server]); $global_msg[exec_plan]=$btl->resolveServicePlan($exec_plan); @@ -667,4 +682,4 @@ $layout->TableEnd(); -$layout->display(); \ No newline at end of file +$layout->display(); diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/bartlby-ui.class.php bartlby-ui/bartlby-ui.class.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/bartlby-ui.class.php 2007-01-29 17:07:07.000000000 +0100 +++ bartlby-ui/bartlby-ui.class.php 2007-04-24 21:25:50.000000000 +0200 @@ -1,4 +1,6 @@ CFG, $service_id); + $rap = "Report for: " . $defaults[server_name] . "/" . $defaults[service_name] . "\n"; + $btl_subj = "Bartlby Custom report"; + + $rap .= "DAILY REPORT:\n\n"; + $rep = $this->do_report($from, $to, 0, $service_id); + + $rap .= "FROM: " . $from . " TO: " . $to . "\n"; + $file = $this->format_report($rep, "html", $rap); + + + + + + + $tmpfname = tempnam ("/tmp", "ArS"); + + $fp = fopen($tmpfname, "w"); + fwrite($fp, $file); + fclose($fp); + + copy($tmpfname, $tmpfname . ".html"); + unlink($tmpfname); + + $mime = new Mail_Mime(); + $mime->setTxtBody("see the attachment for details"); + + $mime->addAttachment($tmpfname . ".html", "text/html", "report.html"); + + + //update perf handler ;) + $this->updatePerfHandler($defaults[server_id], $defaults[service_id]); + $path=bartlby_config($this->CFG, "performance_rrd_htdocs"); + foreach(glob($path . "/" . $service_id . "_*.png") as $fn) { + //$mime->addAttachment($fn, "image/png", basename($fn), true, 'base64', 'inline'); + $mime->addHTMLImage($fn, "image/png", basename($fn), true); + $file .= "
"; + } + $mime->setHTMLBody($file); + $body=$mime->get(); + + + + + + + $dd = explode(";", $emails); + for($x=0; $x $storage->load_key("ars_smtp_from") , 'To' => $dd[$x], + 'Subject' => $btl_subj); + + $smtp = Mail::factory('smtp', + array ('host' => $storage->load_key("ars_smtp_host"), + 'auth' => false, + 'timeout' => 10, + 'debug' => false + )); + + $hdrs=$mime->headers($headers); + + $mail = $smtp->send($dd[$x], $hdrs, $body); + $r .= "Sent to: " . $dd[$x] . "
"; + + } + + return $r; + + + } + function doReload() { bartlby_reload($this->CFG); while(1) { @@ -110,7 +189,176 @@ $r = "" . $mydiv; return $r; } + function format_report($rep, $type='html', $hdr, $do_perf=false) { + global $btl; + + + + $svc=$rep[svc]; + $svc_id=$rep[service_id]; + $srv_id=$rep[server_id]; + $state_array=$rep[state_array]; + $notify=$rep[notify]; + $files_scanned=$rep[files_scanned]; + + $hun=$svc[0]+$svc[1]+$svc[2]; + + + + + switch($type) { + case 'html': + $rap =""; + $rap .= ""; + break; + } + switch($type) { + case 'html': + $rap .= ""; + break; + } + + switch($type) { + case 'html': + $rap .= ""; + break; + } + + while(list($state, $time) = @each($svc)) { + + + $perc = (($hun-$time) * 100 / $hun); + $perc =100-$perc; + + + switch($type) { + case 'html': + $rap .= ""; + $rap .= ""; + $rap .= ""; + $rap .= ""; + $rap .= ""; + break; + } + + + + + } + + if($do_perf == true) { + $this->updatePerfHandler($srv_id, $svc_id); + $path=bartlby_config($this->CFG, "performance_rrd_htdocs"); + + foreach(glob($path . "/" . $svc_id . "_*.png") as $fn) { + //$mime->addAttachment($fn, "image/png", basename($fn), true, 'base64', 'inline'); + + $rap .= ""; + } + } + + switch($type) { + case 'html': + $rap .= ""; + break; + } + while(list($worker, $dd) = @each($notify)) { + + switch($type) { + case 'html': + $rap .= ""; + break; + } + + } + switch($type) { + case 'html': + $rap .= ""; + break; + } + $c1="#cccccc"; + $c2="#eeeeee"; + $cl = $c1; + $z=0; + for($xy=count($state_array)-1; $xy>=0;$xy=$xy-2) { + + switch($type) { + case 'html': + $stay_time=""; + $stay_sec=$state_array[$xy][end]-$state_array[$xy][start]; + + if($state_array[$xy][state] != 0) { + + + //if it was not ok we display the stay in time ;) + $stay_time="(" . $this->intervall($stay_sec) . ")"; + } + if(!$_GET[sec_filter] || $stay_sec > $_GET[sec_filter]) { + + $o1 .= ""; + $o1 .= ""; + $o1 .= ""; + $o1 .= ""; + $o1 .= ""; + + $o1 .= ""; + $o1 .= ""; + $o1 .= ""; + $o1 .= ""; + $o1 .= ""; + + + $z++; + $z++; + if($z == 2) { + if($cl == $c1 ){ + $cl = $c2; + } else { + $cl = $c1; + } + $z=0; + } + } + break; + } + + } + + $rap .= $o1; + + switch($type) { + case 'html': + $rap .= "
" . $hdr . "
Service Availability
"; + $rap .= "" . $btl->getState($state) . ""; + $rap .= ""; + $rap .= $btl->intervall($time); + $rap .= ""; + $rap .= round($perc,2); + $rap .= "%
Notifications
" . $worker . ""; + break; + } + + + while(list($trigger, $dd1) = @each($dd)) { + $rap .= "\t" . $trigger . "
"; + while(list($k, $ts) = @each($dd1)) { + + switch($type) { + case 'html': + $rap .= "
  • " . date("d.m.Y H:i:s", $ts[0]) . " (" . $btl->getState($ts[1]) . ")
    "; + break; + } + } + } + switch($type) { + case 'html': + $rap .= "
  • Output
    " . date("d.m.Y H:i:s", $state_array[$xy][end]) . "" . $btl->getState($state_array[$xy][lstate]) . " " . $state_array[$xy][msg] . "
    " . date("d.m.Y H:i:s", $state_array[$xy-1][end]) . "" . $btl->getState($state_array[$xy-1][lstate]) . " $stay_time " . $state_array[$xy-1][msg] . "
    "; + break; + } + + return $rap; + } function resolveServicePlan($str) { global $wdays; @@ -127,42 +375,63 @@ for($x=0; $x= $t1 && $cur_ts <= $t2 && $cur_wday == $x) { - $filled[$x] .= "" . $xx[$y] . ","; - $range_found = true; + + if($inv == 0) { + $cl = 'blue'; + $range_found = true; + } else { + $cl = 'grey'; + $range_found = false; + + + } + + $filled[$x][value] .= "" . $xx[$y] . ","; + } else { - $filled[$x] .= $xx[$y] . ","; + $filled[$x][value] .= $xx[$y] . ","; } } - $filled[$x]{strlen($filled[$x])-1} = " "; + $filled[$x]{strlen($filled[$x][value])-1} = " "; } $plan_box = ""; for($x=0; $x<=6; $x++) { $chk=""; $vv = "NO"; - if($filled[$x]) { + if($filled[$x][value]) { $chk="checked"; - $vv = $filled[$x]; + $vv = $filled[$x][value]; } $cl = ""; if($cur_wday == $x) { $cl = "color=blue"; } - $plan_box .= ""; + if($filled[$x][disabled] == 1) { + $invinfo="(inverted)"; + } else { + $invinfo=""; + } + $plan_box .= ""; } $plan_box .= "
    " . $wdays[$x] . "" . $vv . "
    " . $wdays[$x] . $invinfo . "" . $vv . "
    "; - if($range_found == true) { - $plan_box .= "currently in range"; - } else { - $plan_box .= "currently not in range"; - } + return $plan_box; } @@ -269,6 +538,7 @@ } $r[svc]=$svc; + $r[service_id]=$in_service; $r[state_array]=$state_array; $r[notify]=$notify; $r[files_scanned]=$files_scanned; diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/cli.php bartlby-ui/cli.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/cli.php 2007-01-05 02:49:48.000000000 +0100 +++ bartlby-ui/cli.php 2007-03-27 17:42:20.000000000 +0200 @@ -1,7 +1,7 @@ Tr( + $layout->Td( + Array( + 0=>"Email RCPT:", + 1=>$layout->Field("report_rcpt", "text", "") + ) + ) + +); $layout->Tr( $layout->Td( diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/extensions/Basket/Basket.class.php bartlby-ui/extensions/Basket/Basket.class.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/extensions/Basket/Basket.class.php 2006-12-02 22:35:07.000000000 +0100 +++ bartlby-ui/extensions/Basket/Basket.class.php 2007-04-01 18:06:47.000000000 +0200 @@ -116,6 +116,9 @@ } + function _logView() { + return $this->_overview(); + } function _services() { return $this->_overview(); } diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/fin/delete_service bartlby-ui/fin/delete_service --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/fin/delete_service 2006-01-22 02:32:47.000000000 +0100 +++ bartlby-ui/fin/delete_service 2007-03-22 02:10:18.000000000 +0100 @@ -1,4 +1,5 @@ - Delete Service
    You have successfully deleted service '$global_msg[server_name]:$global_msg[client_port]/$global_msg[service_name]'

    Next Steps

    - \ No newline at end of file +Delete Service
    You have successfully deleted service '$global_msg[server_name]:$global_msg[client_port]/$global_msg[service_name]'

    Next Steps

    +
    \ No newline at end of file Binary files /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/images/agent_syncer.gif and bartlby-ui/images/agent_syncer.gif differ diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/layout.class.php bartlby-ui/layout.class.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/layout.class.php 2006-11-30 22:51:08.000000000 +0100 +++ bartlby-ui/layout.class.php 2007-04-01 18:06:46.000000000 +0200 @@ -51,7 +51,13 @@ $this->OUT .= ""; } function MetaRefresh($time=20) { - $this->OUT .= ""; + $this->OUT .= ""; } function TableEnd() { $this->OUT .= "
    "; diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/logview.php bartlby-ui/logview.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/logview.php 2006-09-28 19:22:50.000000000 +0200 +++ bartlby-ui/logview.php 2007-04-01 18:06:46.000000000 +0200 @@ -245,6 +245,7 @@ } $layout->TableEnd(); $layout->FormEnd(); + $r=$btl->getExtensionsReturn("_logView", $layout); $layout->display("no"); diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/modify_service.php bartlby-ui/modify_service.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/modify_service.php 2007-01-27 00:20:34.000000000 +0100 +++ bartlby-ui/modify_service.php 2007-04-01 18:06:46.000000000 +0200 @@ -336,18 +336,34 @@ $o = explode("|", $defaults[exec_plan]); + for($x=0; $x"; + $plan_box .= "" . $wdays[$x] . " invert"; + } $plan_box .= "Time ranges are seperated with ',' e.g.: 14:30-15:20,01:20-02:30 make 24h a day"; $plan_box .= ""; diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/modify_worker.php bartlby-ui/modify_worker.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/modify_worker.php 2007-01-27 20:52:21.000000000 +0100 +++ bartlby-ui/modify_worker.php 2007-03-22 02:10:18.000000000 +0100 @@ -222,7 +222,7 @@ $ov .= $layout->Tr( $layout->Td( array( - 0=>"Active?:", + 0=>"Notifications:", 1=>$layout->DropDown("worker_active", $act) ) ) @@ -342,4 +342,4 @@ $layout->TableEnd(); $layout->FormEnd(); -$layout->display(); \ No newline at end of file +$layout->display(); diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/print_report.php bartlby-ui/print_report.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/print_report.php 1970-01-01 01:00:00.000000000 +0100 +++ bartlby-ui/print_report.php 2007-04-24 21:25:50.000000000 +0200 @@ -0,0 +1,93 @@ +hasright("log.report"); +$btl->hasServerorServiceRight($_GET[report_service]); + + +echo "
    "; + +while(list($k, $v) = @each($_GET)) { + if($k != "sec_filter") { + echo ""; + } +} +echo ""; +echo ""; + + + + +echo "
    "; + +$defaults=bartlby_get_service_by_id($btl->CFG, $_GET[report_service]); +$rap = "Second filter: " . $_GET[sec_filter] . "
    Print it
    Report for: " . $defaults[server_name] . "/" . $defaults[service_name] . "\n"; + +$rep=$btl->do_report($_GET[report_start], $_GET[report_end], $_GET[report_init], $_GET[report_service]); +$rap .= "FROM: " . $_GET[report_start] . " TO: " . $_GET[report_end] . "\n"; + +$file .= $out; + + + + +$file .= $btl->format_report($rep, "html", $rap, true); + +$svc=$rep[svc]; +$state_array=$rep[state_array]; +$notify=$rep[notify]; +$files_scanned=$rep[files_scanned]; +$hun=$svc[0]+$svc[1]+$svc[2]; +$flash[0]="0"; +$flash[1]="0"; +$flash[2]="0"; + +//$img_file=$btl->create_report_img($state_array, $time_start, $time_end); + + + + + +while(list($state, $time) = @each($svc)) { + + + $perc = (($hun-$time) * 100 / $hun); + $perc =100-$perc; + + + $flash[$state]=$perc; + + +} + +for($x=0; $x<3; $x++) { + $nstate= $x+1; + $rstr .= "&text_" . $nstate . "=" . $btl->getState($x) . "&value_" . $nstate . "=" . $flash[$x]; +} + +$out .= ' + + + + + + + + +
    +'; + + + + +echo $file; + \ No newline at end of file diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/report.php bartlby-ui/report.php --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/report.php 2007-02-02 21:56:17.000000000 +0100 +++ bartlby-ui/report.php 2007-04-24 21:25:50.000000000 +0200 @@ -36,7 +36,12 @@ if(!$_GET[report_service] || !$log_mask) { $out ="You v choosen a server? or log file is not set"; } else { - $out = "creating report for service: $_GET[report_service] From: $_GET[report_start] To: $_GET[report_end]
    "; + + if($_POST[report_rcpt]) { + + $out .= $btl->send_custom_report($_POST[report_rcpt], $_GET[report_service], $_GET[report_start], $_GET[report_end]); + } + $out .= "creating report for service: $_GET[report_service] From: $_GET[report_start] To: $_GET[report_end]
    "; $ra=$btl->do_report($_GET[report_start], $_GET[report_end], $_GET[report_init], $_GET[report_service]); $svc=$ra[svc]; @@ -82,7 +87,7 @@ $rstr .= "&text_" . $nstate . "=" . $btl->getState($x) . "&value_" . $nstate . "=" . $flash[$x]; } $idx=$btl->findSHMPlace($defaults[service_id]); - $svc_option_line="" . $defaults[server_name] . ":" . $defaults[client_port] . "/" . $defaults[service_name] . "" . $btl->getServiceOptions($defaults, $layout); + $svc_option_line="" . $defaults[server_name] . ":" . $defaults[client_port] . "/" . $defaults[service_name] . "" . $btl->getServiceOptions($defaults, $layout) . "Print"; $out .= ""; diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/rights/admin.dat bartlby-ui/rights/admin.dat --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/rights/admin.dat 2007-01-05 02:49:49.000000000 +0100 +++ bartlby-ui/rights/admin.dat 2007-04-01 18:06:47.000000000 +0200 @@ -1,5 +1,5 @@ -selected_servers= -selected_services= +selected_servers=, +selected_services=, view_service_output=true super_user=true action.reload=true @@ -45,3 +45,11 @@ action.delete_worker=true action.modify_worker=true action.copy_worker=true + + + + + + + + Binary files /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/server_icons/vista.gif and bartlby-ui/server_icons/vista.gif differ diff -Nur /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/template.html bartlby-ui/template.html --- /var/www/htdocs/bartlby.januschka.com/cvs/last_full//bartlby-ui/template.html 2006-12-10 16:56:51.000000000 +0100 +++ bartlby-ui/template.html 2007-04-24 21:25:50.000000000 +0200 @@ -9,6 +9,14 @@