From sean at seanoneill.info Tue Mar 4 13:21:54 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Tue, 4 Mar 2003 13:21:54 -0800 Subject: [Orca-checkins] rev 205 - branches Message-ID: <200303042121.h24LLsZs016787@orcaware.com> Author: sean at seanoneill.info Date: 2003-03-04 13:21:47 -0800 (Tue, 04 Mar 2003) New Revision: 205 Added: branches/orca/ Log: * branches/orca: Create branches directory for all Orca branch work. From sean at seanoneill.info Tue Mar 4 13:28:49 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Tue, 4 Mar 2003 13:28:49 -0800 Subject: [Orca-checkins] rev 206 - branches/orca Message-ID: <200303042128.h24LSnn8016939@orcaware.com> Author: sean at seanoneill.info Date: 2003-03-04 13:28:26 -0800 (Tue, 04 Mar 2003) New Revision: 206 Added: branches/orca/import_orca_services_2.0/ Log: * Copy current Orca trunk into new branches/orca/import_orca_services_2.0 directory to work on importing new orca_services 2.0 code into Orca. Copied: import_orca_services_2.0 (from rev 205, trunk/orca) From sean at seanoneill.info Sat Mar 8 10:26:23 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Sat, 8 Mar 2003 10:26:23 -0800 Subject: [Orca-checkins] rev 207 - in branches/orca/import_orca_services_2.0: lib lib/Orca_services data_gatherers/orca_services Message-ID: <200303081826.h28IQNJC019222@orcaware.com> Author: sean at seanoneill.info Date: 2003-03-08 10:25:54 -0800 (Sat, 08 Mar 2003) New Revision: 207 Added: branches/orca/import_orca_services_2.0/lib/Orca_services/ branches/orca/import_orca_services_2.0/lib/Orca_services/Dns.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Http.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Mailq.pm branches/orca/import_orca_services_2.0/lib/Orca_services/MeritRad.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Nntp.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Output.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Pop.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Radius.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Sendmail.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Slapd.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Utils.pm branches/orca/import_orca_services_2.0/lib/Orca_services/Vars.pm Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in branches/orca/import_orca_services_2.0/lib/Makefile.in Log: Modifications being made for new orca_services 2.0 release. orca_service 2.0 is a complete rewrite of orca_services. In branches/orca/import_orca_services_2.0: Modified: data_gatherers/orca_services/S99orca_services.sh.in data_gatherers/orca_services/orca_services.cfg.in data_gatherers/orca_services/orca_services.pl.in data_gatherers/orca_services/start_orca_services.sh.in data_gatherers/orca_services/stop_orca_services.sh.in lib/Makefile.in Added: lib/Orca_services/ lib/Orca_services/Dns.pm lib/Orca_services/Http.pm lib/Orca_services/Mailq.pm lib/Orca_services/MeritRad.pm lib/Orca_services/Nntp.pm lib/Orca_services/Output.pm lib/Orca_services/Pop.pm lib/Orca_services/Radius.pm lib/Orca_services/Sendmail.pm lib/Orca_services/Slapd.pm lib/Orca_services/Utils.pm lib/Orca_services/Vars.pm Log: * data_gatherers/orca_services/S99orca_services.sh.in, data_gatherers/orca_services/orca_services.cfg.in, data_gatherers/orca_services/orca_services.pl.in, data_gatherers/orca_services/start_orca_services.sh.in, data_gatherers/orca_services/stop_orca_services.sh.in: Updated for orca_services 2.0. * lib/Makefile.in: Updated for orca_services 2.0. New section of code added to create new lib/Orca_services directory and copy contents during installation. * lib/Orca_services/, lib/Orca_services/Dns.pm, lib/Orca_services/Http.pm, lib/Orca_services/Mailq.pm, lib/Orca_services/MeritRad.pm, lib/Orca_services/Nntp.pm, lib/Orca_services/Output.pm, lib/Orca_services/Pop.pm, lib/Orca_services/Radius.pm, lib/Orca_services/Sendmail.pm, lib/Orca_services/Slapd.pm, lib/Orca_services/Utils.pm, lib/Orca_services/Vars.pm: New directory lib/Orca_services and files listed added for orca_services 2.0. Modified: branches/orca/import_orca_services_2.0/lib/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/lib/Makefile.in 2003-03-08 10:26:12.000000000 -0800 @@ -30,6 +30,7 @@ $(MKDIR) $(libdir)/Orca $(MKDIR) $(libdir)/SE/3.2.1 $(MKDIR) $(libdir)/SE/3.3 + $(MKDIR) $(libdir)/Orca_services @for f in Orca/*.pm; do \ echo $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ @@ -49,6 +50,10 @@ echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ done + @for f in Orca_services/*; do \ + echo $(INSTALL) -m 0644 $$f $(libdir)/Orca_services; \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca_services; \ + done clean: Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Dns.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Dns.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Dns.pm 2003-03-08 10:26:12.000000000 -0800 @@ -0,0 +1,525 @@ +# +# Dns.pm : Orca_Services package for dns monitoring +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Dns; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Dns}{File} = "/var/log/named"; + $Services{Dns}{FileD} = ""; + $Services{Dns}{Ok} = -1; + $Services{Dns}{External} = 0; + $Services{Dns}{Init} = "init_dns"; + $Services{Dns}{Init_Vars} = "init_dns_vars"; + $Services{Dns}{Measure} = "measure_dns"; + $Services{Dns}{Put} = "put_dns"; + + $PrgOptions{"dns_logfile=s"} = \$Services{Dns}{File}; + + $HelpText{$Services{Dns}{File}} = "--dns_logfile=FILE syslog from named (default:"; +} + + +use Orca_Services::Utils; +use Orca_Services::Output; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_dns + init_dns_vars + measure_dns + put_dns + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($dns_cpu_u, $dns_cpu_s, $dns_ccpu_u, $dns_ccpu_s, $dns_a); +my ($dns_ptr, $dns_mx, $dns_any, $dns_ns, $dns_soa, $dns_axfr); +my ($dns_aaaa, $dns_other, $dns_rr, $dns_rq, $dns_rother, $dns_sans); +my ($dns_snaans, $dns_snxd, $dns_sother); +my ($dns_usage_started, $dns_nstats_started, $dns_xstats_started); +my ($odns_rr, $odns_rq, $odns_rother, $odns_sans, $odns_snaans, $odns_snxd, $odns_sother); +my ($odns_cpu_u, $odns_cpu_s, $odns_ccpu_u, $odns_ccpu_s, $odns_a); +my ($odns_ptr, $odns_mx, $odns_any, $odns_ns, $odns_soa, $odns_axfr); +my ($odns_aaaa, $odns_other); +my ($dns_ino, $dns_size); + + +# +# usage: &init_dns($dns_logfile); +# +sub init_dns { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Dns", \$dns_ino, \$dns_size); + } + + if($retval == 0) { + &init_dns_vars (); + } + return $retval; +} + +# +# Get values for dns columns +# +# usage: &measure_dns( ); +# +sub measure_dns () { + my ($buf); + + $buf = $Services{Dns}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + &process_dns_line ($buf); + } + if ($Services{Dns}{FileD}->eof) { + printf "DNS: eof on $Services{Dns}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Dns}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Dns", \$dns_ino, \$dns_size); + + return $retval; +} + + +# +# init dns vars +# +# usage: &init_dns_vars(); +# +sub init_dns_vars() { + $dns_usage_started = 0; + $dns_nstats_started = 0; + $dns_xstats_started = 0; + + &init_dns_usage_vars(); + &init_dns_nstats_vars(); + &init_dns_xstats_vars(); + + &init_odns_vars(); +} + +sub init_dns_usage_vars () { + $dns_cpu_u = 0; + $dns_cpu_s = 0; + $dns_ccpu_u = 0; + $dns_ccpu_s = 0; +} +sub init_dns_nstats_vars () { + $dns_a = 0; + $dns_ptr = 0; + $dns_mx = 0; + $dns_any = 0; + + $dns_ns = 0; + $dns_soa = 0; + $dns_axfr = 0; + $dns_aaaa = 0; + $dns_other = 0; +} + +sub init_dns_xstats_vars () { + $dns_rr = 0; + $dns_rq = 0; + $dns_rother = 0; + + $dns_sans = 0; + $dns_snaans = 0; + $dns_snxd = 0; + $dns_sother = 0; +} + + +# +# init odns vars (save old values) +# +# usage: &init_odns_vars(); +# + +sub init_odns_vars() { + &init_odns_usage_vars(); + &init_odns_nstats_vars(); + &init_odns_xstats_vars(); +} + +sub init_odns_usage_vars() { + $odns_cpu_u = $dns_cpu_u ; + $odns_cpu_s = $dns_cpu_s ; + $odns_ccpu_u = $dns_ccpu_u ; + $odns_ccpu_s = $dns_ccpu_s ; + + &init_dns_usage_vars(); +} + +sub init_odns_nstats_vars() { + $odns_a = $dns_a ; + $odns_ptr = $dns_ptr ; + $odns_mx = $dns_mx ; + $odns_any = $dns_any ; + + $odns_ns = $dns_ns ; + $odns_soa = $dns_soa ; + $odns_axfr = $dns_axfr ; + $odns_aaaa = $dns_aaaa ; + $odns_other = $dns_other ; + + &init_dns_nstats_vars(); +} + +sub init_odns_xstats_vars() { + $odns_rr = $dns_rr ; + $odns_rq = $dns_rq ; + $odns_rother = $dns_rother ; + + $odns_sans = $dns_sans ; + $odns_snaans = $dns_snaans ; + $odns_snxd = $dns_snxd ; + $odns_sother = $dns_sother ; + + &init_dns_xstats_vars(); +} + + +# +# calc dns delta +# +# usage: &calc_dns_delta(); +# +sub calc_dns_delta() { + &calc_dns_usage_delta(); + &calc_dns_nstats_delta(); + &calc_dns_xstats_delta(); +} + +sub calc_dns_usage_delta() { + my $temp = 0; + + if ($dns_cpu_u < $odns_cpu_u) { + $odns_cpu_u = $dns_cpu_u; + } else { + $temp = $dns_cpu_u; $dns_cpu_u = $dns_cpu_u - $odns_cpu_u; $odns_cpu_u = $temp; + } + + if ($dns_cpu_s < $odns_cpu_s) { + $odns_cpu_s = $dns_cpu_s; + } else { + $temp = $dns_cpu_s; $dns_cpu_s = $dns_cpu_s - $odns_cpu_s; $odns_cpu_s = $temp; + + } + if ($dns_ccpu_u < $odns_ccpu_u) { + $odns_ccpu_u = $dns_ccpu_u; + } else { + $temp = $dns_ccpu_u; $dns_ccpu_u = $dns_ccpu_u - $odns_ccpu_u; $odns_ccpu_u = $temp; + + } + if ($dns_ccpu_s < $odns_ccpu_s) { + $odns_ccpu_s = $dns_ccpu_s; + } else { + $temp = $dns_ccpu_s; $dns_ccpu_s = $dns_ccpu_s - $odns_ccpu_s; $odns_ccpu_s = $temp; + } + +} +sub calc_dns_nstats_delta() { + my $temp = 0; + + if ($dns_a < $odns_a) { + $odns_a = $dns_a; + } else { + $temp = $dns_a; $dns_a = $dns_a - $odns_a; $odns_a = $temp; + } + + if ($dns_ptr < $odns_ptr) { + $odns_ptr = $dns_ptr; + } else { + $temp = $dns_ptr; $dns_ptr = $dns_ptr - $odns_ptr; $odns_ptr = $temp; + } + + if ($dns_mx < $odns_mx) { + $odns_mx = $dns_mx; + } else { + $temp = $dns_mx; $dns_mx = $dns_mx - $odns_mx; $odns_mx = $temp; + } + + if ($dns_any < $odns_any) { + $odns_any = $dns_any; + } else { + $temp = $dns_any; $dns_any = $dns_any - $odns_any; $odns_any = $temp; + } + + if ($dns_ns < $odns_ns) { + $odns_ns = $dns_ns; + } else { + $temp = $dns_ns; $dns_ns = $dns_ns - $odns_ns; $odns_ns = $temp; + } + + if ($dns_soa < $odns_soa) { + $odns_soa = $dns_soa; + } else { + $temp = $dns_soa; $dns_soa = $dns_soa - $odns_soa; $odns_soa = $temp; + } + if ($dns_axfr < $odns_axfr) { + $odns_axfr = $dns_axfr; + } else { + $temp = $dns_axfr; $dns_axfr = $dns_axfr - $odns_axfr; $odns_axfr = $temp; + } + + if ($dns_aaaa < $odns_aaaa) { + $odns_aaaa = $dns_aaaa; + } else { + $temp = $dns_aaaa; $dns_aaaa = $dns_aaaa - $odns_aaaa; $odns_aaaa = $temp; + } + + if ($dns_other < $odns_other) { + $odns_other = $dns_other; + } else { + $temp = $dns_other; $dns_other = $dns_other - $odns_other; $odns_other = $temp; + } +} + +sub calc_dns_xstats_delta() { + my $temp = 0; + + if ($dns_rr < $odns_rr) { + $odns_rr = $dns_rr; + } else { + $temp = $dns_rr; $dns_rr = $dns_rr - $odns_rr; $odns_rr = $temp; + } + + if ($dns_rq < $odns_rq) { + $odns_rq = $dns_rq; + } else { + $temp = $dns_rq; $dns_rq = $dns_rq - $odns_rq; $odns_rq = $temp; + } + + if ($dns_rother < $odns_rother) { + $odns_rother = $dns_rother; + } else { + $temp = $dns_rother; $dns_rother = $dns_rother - $odns_rother; $odns_rother = $temp; + } + + if ($dns_sans < $odns_sans) { + $odns_sans = $dns_sans; + } else { + $temp = $dns_sans; $dns_sans = $dns_sans - $odns_sans; $odns_sans = $temp; + } + + if ($dns_snaans < $odns_snaans) { + $odns_snaans = $dns_snaans; + } else { + $temp = $dns_snaans; $dns_snaans = $dns_snaans - $odns_snaans; $odns_snaans = $temp; + } + + if ($dns_snxd < $odns_snxd) { + $odns_snxd = $dns_snxd; + } else { + $temp = $dns_snxd; $dns_snxd = $dns_snxd - $odns_snxd; $odns_snxd = $temp; + } + + if ($dns_sother < $odns_sother) { + $odns_sother = $dns_sother; + } else { + $temp = $dns_sother; $dns_sother = $dns_sother - $odns_sother; $odns_sother = $temp; + } +} + + +# ------------------------------------------------------------------- +# +# Parse dns log line +# +# usage: &process_dns_line ($buf); +# + +sub process_dns_line () { + my ($line) = @_; + my ($t, $v, @types); + + # + # Oct 24 14:27:49 r1 named[17279]: USAGE 972394069 970586866 CPU=188.82u/82.79s CHILDCPU=0u/0s + # Oct 24 14:27:49 r1 named[17279]: NSTATS 972394069 970586866 0=6 A=322014 NS=25 SOA=415 PTR=35772 MX=111 SRV=110 ANY=238 + # Oct 24 14:27:49 r1 named[17279]: XSTATS 972394069 970586866 RR=293985 RNXD=22941 RFwdR=205718 RDupR=3603 RFail=508 RFErr=0 RErr=141 RAXFR=0 RLame=2636 ROpts=0 SSysQ=58851 SAns=205888 SFwdQ=169140 SDupQ=23529 SErr=0 RQ=358773 RIQ=0 RFwdQ=0 RDupQ=8397 RTCP=206 SFwdR=205718 SFail=3 SFErr=0 SNaAns=204478 SNXD=45736 + # + if ($line !~ / named\[\d+\]: (USAGE|NSTATS|XSTATS) /) { + return 0; + } + + + # Oct 24 14:27:49 r1 named[17279]: USAGE 972394069 970586866 CPU=188.82u/82.79s CHILDCPU=0u/0s + if ($line =~ /: USAGE \d+ \d+ CPU=([\d\.]+)u\/([\d\.]+)s CHILDCPU=([\d\.]+)u\/([\d\.]+)s/) { + $dns_cpu_u = $1; + $dns_cpu_s = $2; + $dns_ccpu_u = $3; + $dns_ccpu_s = $4; + + printf "DNS_USAGE: %s", $line if $Options{debug}; + printf "dns_cpu_u=%s, dns_cpu_s=%s, dns_ccpu_u=%s, dns_ccpu_s=%s\n", $dns_cpu_u, $dns_cpu_s, $dns_ccpu_u, $dns_ccpu_s if $Options{debug}; + + if ($dns_usage_started) { + &calc_dns_usage_delta(); # puts delta into vars to print -&- saves into old + } else { + $dns_usage_started = 1; + &init_odns_usage_vars(); # saves old and cleans current values + } + + # Oct 24 14:27:49 r1 named[17279]: NSTATS 972394069 970586866 0=6 A=322014 NS=25 SOA=415 PTR=35772 MX=111 SRV=110 ANY=238 + } elsif ($line =~ /: NSTATS \d+ \d+ /) { + my $l; + + ($l = $line) =~ s/^.*: NSTATS \d+ \d+ //; # trim beginning + chop $l; + + @types = split(' ',$l); + + $dns_other = 0; + while (@types) { + ($t,$v) = split ('=', pop @types); + if ($t eq 'A') { + $dns_a = $v; + } elsif ($t eq 'PTR') { + $dns_ptr = $v; + } elsif ($t eq 'MX') { + $dns_mx = $v; + } elsif ($t eq 'ANY') { + $dns_any = $v; + } elsif ($t eq 'NS') { + $dns_ns = $v; + } elsif ($t eq 'SOA') { + $dns_soa = $v; + } elsif ($t eq 'AXFR') { + $dns_axfr = $v; + } elsif ($t eq 'AAAA') { + $dns_aaaa = $v; + } else { + $dns_other += $v; + } + } + + printf "DNS_NSTATS: %s", $line if $Options{debug}; + printf "dns_a=%s, dns_ptr=%s, dns_mx=%s, dns_any=%s, dns_ns=%s, dns_soa=%s, dns_axfr=%s, dns_aaaa=%s, dns_other=%s\n", $dns_a, $dns_ptr, $dns_mx, $dns_any, $dns_ns, $dns_soa, $dns_axfr, $dns_aaaa, $dns_other if $Options{debug}; + + if ($dns_nstats_started) { + &calc_dns_nstats_delta(); # puts delta into vars to print -&- saves into old + } else { + $dns_nstats_started = 1; + &init_odns_nstats_vars(); # saves old and cleans current values + } + + # Oct 24 14:27:49 r1 named[17279]: XSTATS 972394069 970586866 RR=293985 RNXD=22941 RFwdR=205718 RDupR=3603 RFail=508 RFErr=0 RErr=141 RAXFR=0 RLame=2636 ROpts=0 SSysQ=58851 SAns=205888 SFwdQ=169140 SDupQ=23529 SErr=0 RQ=358773 RIQ=0 RFwdQ=0 RDupQ=8397 RTCP=206 SFwdR=205718 SFail=3 SFErr=0 SNaAns=204478 SNXD=45736 + } elsif ($line =~ /: XSTATS \d+ \d+ /) { + my $l; + + ($l = $line) =~ s/^.*: XSTATS \d+ \d+ //; # trim beginning + chop $l; + + @types = split(' ',$l); + + $dns_rother = $dns_sother = 0; + while (@types) { + ($t,$v) = split ('=', pop @types); + if ($t eq 'RR') { + $dns_rr = $v; + } elsif ($t eq 'RQ') { + $dns_rq = $v; + } elsif ($t =~ /^R/) { + $dns_rother += $v; + } elsif ($t eq 'SAns') { + $dns_sans = $v; + } elsif ($t eq 'SNaAns') { + $dns_snaans = $v; + } elsif ($t eq 'SNXD') { + $dns_snxd = $v; + } elsif ($t =~ /^S/) { + $dns_sother += $v; + } + } + + printf "DNS_XSTATS: %s", $line if $Options{debug}; + printf "dns_rr=%s, dns_rq=%s, dns_rother=%s, dns_sans=%s, dns_snaans=%s, dns_snxd=%s, dns_sother=%s\n", $dns_rr, $dns_rq, $dns_rother, $dns_sans, $dns_snaans, $dns_snxd, $dns_sother if $Options{debug}; + + if ($dns_xstats_started) { + &calc_dns_xstats_delta(); # puts delta into vars to print -&- saves into old + } else { + $dns_xstats_started = 1; + &init_odns_xstats_vars(); # saves old and cleans current values + } + } + return 0; +} + + +# +# Put the dns values for output +# +# usage: &put_dns(); +# +sub put_dns() { + &put_output("dns_cpu_u", sprintf("%8.2f", $dns_cpu_u)); + &put_output("dns_cpu_s", sprintf("%8.2f", $dns_cpu_s)); + &put_output("dns_ccpu_u", sprintf("%8.2f", $dns_ccpu_u)); + &put_output("dns_ccpu_s", sprintf("%8.2f", $dns_ccpu_s)); + + &put_output("dns_a", sprintf("%8.2f", $dns_a)); + &put_output("dns_ptr", sprintf("%8.2f", $dns_ptr)); + &put_output("dns_mx", sprintf("%8.2f", $dns_mx)); + &put_output("dns_any", sprintf("%8.2f", $dns_any)); + + &put_output("dns_ns", sprintf("%8.2f", $dns_ns)); + &put_output("dns_soa", sprintf("%8.2f", $dns_soa)); + &put_output("dns_axfr", sprintf("%8.2f", $dns_axfr)); + &put_output("dns_aaaa", sprintf("%8.2f", $dns_aaaa)); + &put_output("dns_other", sprintf("%8.2f", $dns_other)); + + &put_output("dns_rr", sprintf("%8.2f", $dns_rr)); + &put_output("dns_rq", sprintf("%8.2f", $dns_rq)); + &put_output("dns_rother", sprintf("%8.2f", $dns_rother)); + + &put_output("dns_sans", sprintf("%8.2f", $dns_sans)); + &put_output("dns_snaans", sprintf("%8.2f", $dns_snaans)); + &put_output("dns_snxd", sprintf("%8.2f", $dns_snxd)); + &put_output("dns_sother", sprintf("%8.2f", $dns_sother)); + + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Radius.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Radius.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Radius.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,224 @@ +# +# Radius.pm : Orca_Services package for monitoring Radius +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Radius; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Radius}{File} = "/usr/local/lib/orca_services.DB.$nodename"; + $Services{Radius}{FileD} = ""; + $Services{Radius}{Ok} = -1; + $Services{Radius}{External} = 1; + $Services{Radius}{Init} = "init_radius"; + $Services{Radius}{Init_Vars} = ""; + $Services{Radius}{Measure} = "measure_radius"; + $Services{Radius}{Put} = "put_radius"; + + $PrgOptions{"radius_db=s"} = \$Services{Radius}{File}; + + $HelpText{$Services{Radius}{File}} = "--radius_db=FILE file for user/passwd for DB access (default:"; +} + +#use DBI; +use Orca_Services::Utils; +use Orca_Services::Output; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_radius + measure_radius + put_radius + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($radius_inc_time ,$radius_inc_sessions); +my ($radius_base_ts, $rad_sessions, $rad_time, $ACCUM_radius_DB); + +sub init_radius { + my ($filename) = @_; + my ($radius_ok); + + #check if database user/passwd is given! + if( ! -f $filename){ + print "Database init error: No such file: $filename\n"; + print "Not using Radius module\n"; + return -1; + } + + my($proto,$drv,$database,$user,$pass)= split(/:/,`$CAT $filename`); + + if(!$proto || !$drv || !$database || !$user || !$pass){ + print "Database init error: unable to parse $filename\n"; + print "Syntax must be: protocol:driver:database:user:passwd ex: DBI:oracle:ORCA:user:pass\n"; + print "Not using Radius module\n"; + return -1; + } + chomp($pass); + + if ( ($radius_ok = &init_radius_vars("$proto:$drv:$database",$user,$pass)) ) { + print "ERROR: Radius init failed! Aborting $radius_ok\n"; + return -1; + } +} + +# +# init_radius - set RADIATOR_RADIUS vars, connect to DB, calculate correct time stamp +# +# usage: &init_radius($db,$user,$pass); +# + +sub init_radius_vars { + my ($db,$user,$pass) = @_; + my ($BASE_ACCUM_radius_DB); + + + $Services{Radius}{FileD} = DBI->connect($db,$user,$pass); + if(!$Services{Radius}{FileD}) { + print "Connect error $DBI::errstr\n"; + return 1; + } + + #get the lower time limit that our queries will start from + #get a "history" of 5minutes + + $radius_base_ts= time - 5*60; + + #get accumulated values for what we want to measure: + + #jcp correct this please! + my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, undef) = localtime($radius_base_ts); + $year += 1900; + $mon++; + + + $BASE_ACCUM_radius_DB="/var/orca/orca_services/$nodename"; + if ($mon<10) { + $ACCUM_radius_DB= "$BASE_ACCUM_radius_DB/radiatorRadiusAccum.$year"."0"."$mon.txt"; + } else { + $ACCUM_radius_DB= "$BASE_ACCUM_radius_DB/radiatorRadiusAccum.$year$mon.txt"; + } + `$TOUCH $ACCUM_radius_DB`; + + ($radius_inc_time,$radius_inc_sessions) = split(/:/,`$CAT $ACCUM_radius_DB`); + chomp $radius_inc_sessions if $radius_inc_sessions; + + $radius_inc_time ||= 0; + $radius_inc_sessions ||= 0; + + #END jcp correct this please! + + return 0; +} + + +# +# Get values for radiator radius columns +# +# usage: &measure_radius( ); +# + +sub measure_radius () { + my ($query); + + my $upper_ts= time; + + #Begin GET Accounting + + $query = "SELECT ACCT_SESSION_TIME,ACCT_STATUS_TYPE FROM ACCOUNTING "; + $query .= " WHERE ACCT_STATUS_TYPE = 'Stop'"; + $query .= " AND TIMESTAMP > $radius_base_ts"; + $query .= " AND TIMESTAMP < $upper_ts"; + + ($rad_time,$rad_sessions) = calculateRadVals($query); + + ## incremental/accumulated values + $radius_inc_time += $rad_time; + $radius_inc_sessions += $rad_sessions; + + #END GET Accounting + + `$ECHO "$radius_inc_time:$radius_inc_sessions" > $ACCUM_radius_DB`; + $radius_base_ts += ($upper_ts - $radius_base_ts); + return 0; +} + +## +# IN: query +# RET: time, sessions +## +sub calculateRadVals{ + my $query = shift(@_); + my ($sth, @row); + + #print "radius query: $query\n"; + + my ($rad_t,$rad_s)= (0,0); + $sth = $Services{Radius}{FileD}->prepare($query); + $sth ->execute(); + + $"=" \t "; + while ( @row = $sth -> fetchrow_array()){ + #print "$row[0].$row[1]: $eca\n"; + $rad_t += $row[0]; + $rad_s++; + } + + #print "Time: $rad_t seconds\t Sess: $rad_s sessions\n"; +return ($rad_t,$rad_s); +} + + +# +# Put the radiator radius values for output +# +# usage: &put_radius(); +# + +sub put_radius() { + &put_output("rad_time", sprintf("%8.2f", $rad_time)); + &put_output("rad_sessions", sprintf("%8.2f", $rad_sessions)); + + #incremental graph + &put_output("radius_inc_time", sprintf("%8.2f", $radius_inc_time)); + &put_output("radius_inc_sessions", sprintf("%8.2f", $radius_inc_sessions)); + + return 0; +} + + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/MeritRad.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/MeritRad.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/MeritRad.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,274 @@ +# +# MeritRad.pm : Orca_Services package for monitoring Merit Radius +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::MeritRad; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Merit}{File} = "/usr/local/etc/raddb/logfile"; + $Services{Merit}{FileD} = ""; + $Services{Merit}{Ok} = -1; + $Services{Merit}{External} = 0; + $Services{Merit}{Init} = "init_merit_radius"; + $Services{Merit}{Init_Vars} = "init_merit_radius_vars"; + $Services{Merit}{Measure} = "measure_merit_radius"; + $Services{Merit}{Put} = "put_merit_radius"; + + $PrgOptions{"merit_radius_logfile=s"} = \$Services{Merit}{File}; + + $HelpText{$Services{Merit}{File}} = "--merit_radius_logile=FILE syslog from merit radius (default:"; +} + +use Orca_Services::Output; +use Orca_Services::Utils; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_merit_radius + init_merit_radius_vars + measure_merit_radius + put_merit_radius + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($merit_radius_auth, $merit_radius_auth_ok, $merit_radius_auth_nok); +my ($merit_radius_acct_start, $merit_radius_acct_stop); +my ($merit_radius_rem_auth, $merit_radius_rem_auth_ok); +my ($merit_radius_rem_auth_nok, $merit_radius_undefs); +my ($merit_radius_ino, $merit_radius_size); + +# +# init_merit_radius - set Merit_RADIUS vars, open the logfile and seek into the end. +# +# usage: &init_merit_radius($radius_logfile); +# + +sub init_merit_radius { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Merit", \$merit_radius_ino, \$merit_radius_size); + } + + if($retval == 0) { + &init_merit_radius_vars (); + } + return $retval; +} + + +# +# init merit_radius vars +# +# usage: &init_merit_radius_vars(); +# + +sub init_merit_radius_vars() { + $merit_radius_auth = 0; + $merit_radius_auth_ok = 0; + $merit_radius_auth_nok = 0; + + $merit_radius_acct_start = 0; + $merit_radius_acct_stop = 0; + + $merit_radius_rem_auth = 0; + $merit_radius_rem_auth_ok = 0; + $merit_radius_rem_auth_nok = 0; + + $merit_radius_undefs = 0; +} + + +# +# Get values for merit_radius columns +# +# usage: &measure_merit_radius( ); +# + +sub measure_merit_radius () { + my ($buf); + + $buf = $Services{Merit}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + &process_merit_radius_line ($buf); + } + if ($Services{Merit}{FileD}->eof) { + printf "Merit_RADIUS: eof on $Services{Merit}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Merit}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Merit", \$merit_radius_ino, \$merit_radius_size); + + return $retval; +} + + +# +# Parse merit_radius log line +# +# usage: &process_merit_radius_line ($buf); +# + +sub process_merit_radius_line () { + my ($line) = @_; + + ### AUTH RECEIVED + # Mon Jul 24 00:02:16 2000: Received-Authentication: 214/28832 'luser' from 13.12.15.17 port 25 PPP + + if ($line =~ /: Received-Authentication: .* from /i) { + $merit_radius_auth ++; + printf "Merit_RADIUS_AUTH: %s", $line if $Options{debug}; + printf "merit_radius_auth=%s\n", $merit_radius_auth if $Options{debug}; + return 0; + } + + ### AUTH OK + # Mon Jul 24 00:02:16 2000: Authentication: 214/28832 'luser2' from 13.12.25.17 port 35 PPP - OK -- total 0, holding 0 + + if ($line =~ /: Authentication: .* from .* OK /i) { + $merit_radius_auth_ok ++; + printf "Merit_RADIUS_AUTH_OK: %s", $line if $Options{debug}; + printf "merit_radius_auth_ok=%s\n", $merit_radius_auth_ok if $Options{debug}; + return 0; + } + + ### AUTH FAILED + # Mon Jul 24 01:49:20 2000: Authentication: 201/29347 'luser3' from 13.16.19.20 port 2 PPP - FAILED Authentication failure -- total 0, holding 0 + + if ($line =~ /: Authentication: .* from .* FAILED Authentication /i) { + $merit_radius_auth_nok ++; + printf "Merit_RADIUS_AUTH_NOK: %s", $line if $Options{debug}; + printf "merit_radius_auth_nok=%s\n", $merit_radius_auth_nok if $Options{debug}; + return 0; + } + + ### ACCT START RECEIVED + # Mon Jul 24 00:02:16 2000: Received-Accounting: 215/8376 'luser4' from 13.16.15.17 port 35 $"5200DB70" PPP/13.16.19.25 Start + ### ACCT STOP RECEIVED + # Mon Jul 24 00:02:19 2000: Received-Accounting: 176/8377 'luser5' from 13.16.11.18 port 1 $"040065AE" PPP/13.16.24.22 Stop/User-Request + # Wed Aug 9 16:55:15 2000: getpwnam: good line for luser6 on file + if ( ($line =~ /: Received-Accounting: .* from /i) || + ($line =~ /: getpwnam: good line for /i) ){ + printf "Merit_RADIUS_IGNORE: %s", $line if $Options{debug}; + return 0; + } + + ### ACCT START OK + # Mon Jul 24 00:02:16 2000: Accounting: 215/8376 'luser6' from 13.16.15.17 port 35 $"5200DB70" PPP/13.16.19.24 Start - OK -- total 0, holding 0 + + if ($line =~ /: Accounting: .* from .* Start - OK /i) { + $merit_radius_acct_start ++; + printf "Merit_RADIUS_ACCT_START: %s", $line if $Options{debug}; + printf "merit_radius_acct_start=%s\n", $merit_radius_acct_start if $Options{debug}; + return 0; + } + + ### ACCT STOP OK + # Mon Jul 24 00:02:19 2000: Accounting: 176/8377 'luser7' from 13.16.11.18 port 1 $"040065AE" PPP/13.16.24.22 Stop/User-Request - OK -- total 0, holding 0 + + if ($line =~ /: Accounting: .* from .* Stop.* OK /i) { + $merit_radius_acct_stop ++; + printf "Merit_RADIUS_ACCT_STOP: %s", $line if $Options{debug}; + printf "merit_radius_acct_stop=%s\n", $merit_radius_acct_stop if $Options{debug}; + return 0; + } + + ### REMOTE AUTH RECEIVED + # Mon Jul 24 20:53:38 2000: Received-AUTHENTICATE: 167/44566 'luser9 at realm.com' via some.host.com from some.nas.com port 6 PPP + + if ($line =~ /: Received-AUTHENTICATE: .* via .* from /i) { + $merit_radius_rem_auth ++; + printf "Merit_RADIUS_REM_AUTH: %s", $line if $Options{debug}; + printf "merit_radius_rem_auth=%s\n", $merit_radius_rem_auth if $Options{debug}; + return 0; + } + + ### REMOTE AUTH OK + # Mon Jul 24 20:53:38 2000: AUTHENTICATE: 167/44566 'luser9 at realm.com' via some.host.com from some.nas.com port 6 PPP - OK -- total 0, holding 0 + + if ($line =~ /: AUTHENTICATE: .* via .* from .* OK /i) { + $merit_radius_rem_auth_ok ++; + printf "Merit_RADIUS_REM_AUTH_OK: %s", $line if $Options{debug}; + printf "merit_radius_rem_auth_ok=%s\n", $merit_radius_rem_auth_ok if $Options{debug}; + return 0; + } + + ### REMOTE AUTH FAILED + # Mon Jul 24 14:05:56 2000: AUTHENTICATE: 230/37578 'luser9 at realm.com' via some.host.com from i-Pass VNAS\0\0\0\0 port 1 - FAILED Authentication failure -- total 0, holding 0 + + if ($line =~ /: AUTHENTICATE: .* via .* from .* FAILED Authentication /i) { + $merit_radius_rem_auth_nok ++; + printf "Merit_RADIUS_REM_AUTH_NOK: %s", $line if $Options{debug}; + printf "merit_radius_rem_auth_nok=%s\n", $merit_radius_rem_auth_nok if $Options{debug}; + return 0; + } + + $merit_radius_undefs ++; + printf "Merit_RADIUS_UNDEF: %s", $line if $Options{debug}; + printf "merit_radius_undefs=%s\n", $merit_radius_undefs if $Options{debug}; + return 0; +} + + +# +# Put the merit_radius values for output +# +# usage: &put_merit_radius(); +# + +sub put_merit_radius() { + &put_output("merit_radius_auth", sprintf("%8.2f", $merit_radius_auth)); + &put_output("merit_radius_auth_ok", sprintf("%8.2f", $merit_radius_auth_ok)); + &put_output("merit_radius_auth_nok", sprintf("%8.2f", $merit_radius_auth_nok)); + &put_output("merit_radius_acct_start", sprintf("%8.2f", $merit_radius_acct_start)); + &put_output("merit_radius_acct_stop", sprintf("%8.2f", $merit_radius_acct_stop)); + &put_output("merit_radius_rem_auth", sprintf("%8.2f", $merit_radius_rem_auth)); + &put_output("merit_radius_rem_auth_ok", sprintf("%8.2f", $merit_radius_rem_auth_ok)); + &put_output("merit_radius_rem_auth_nok", sprintf("%8.2f", $merit_radius_rem_auth_nok)); + + &put_output("merit_radius_undefs", sprintf("%8.2f", $merit_radius_undefs)); + + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Vars.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Vars.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Vars.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,133 @@ +# +# Var.pm : Orca_Services package for global vars +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Vars; + +use strict; +use Exporter; +use vars qw(@EXPORT @ISA $VERSION); + at ISA = qw(Exporter); + +# +# program VERSION +# +push(@EXPORT, qw($VERSION)); +$VERSION = "2.0a1"; + + +# +# progra name +# +use vars qw($progname); +push(@EXPORT, qw($progname)); +$progname = "orca_services"; + +# +# vars for syslogging +# +use vars qw($log_facility $log_priority); +push(@EXPORT, qw($log_facility $log_priority)); +$log_facility = "user"; +$log_priority = "info"; + +# +# some helper programs +# +use vars qw($CAT $ECHO $TOUCH); +push(@EXPORT, qw($CAT $ECHO $TOUCH)); +$CAT="/usr/local/bin/cat"; +$ECHO="/usr/local/bin/echo"; +$TOUCH="/usr/local/bin/touch"; + +# +# +# +use vars qw($SaveDay $OutputFilename $print_header $current_column); +push(@EXPORT, qw($SaveDay $Compress $OutputFilename $print_header $current_column)); +$SaveDay = 0; +$OutputFilename = ""; +$print_header = 0; +$current_column = 0; + +# +# the mailq command +# +# mailq when postfix is installed +# $MAILQCMD = "/usr/bin/mailq | egrep -v '^-' | egrep '^[A-Z0-9]' | egrep -v 'empty' | wc -l"; +# +use vars qw($MAILQCMD); +push(@EXPORT, qw($MAILQCMD)); +$MAILQCMD = "/usr/bin/mailq | egrep -v '^-' | egrep '^[A-Z0-9]' | egrep -v 'empty' | wc -l"; + +# +# Central Hash for Services parameter +# +use vars qw(%Services %Options %PrgOptions %HelpText); +push(@EXPORT, qw(%Services %Options %PrgOptions %HelpText)); +%Services=(); +%Options=("interval" => 300, + "outputdir" => "/opt/SWorca/var/orca/orca_services", + "compress" => "/usr/bin/gzip -9", + "debug" => 0, + "help" => 0 + ); +$Options{pidfile} = "$Options{outputdir}/${progname}.pid"; + +%PrgOptions = ("pidfile=s" => \$Options{pidfile}, + "debug:s" => \$Options{debug}, + "interval=i" => \$Options{interval}, + "outputdir=s" => \$Options{outputdir}, + "compress=s" => \$Options{compress}, + "help" => \$Options{help}, + "version" => \$Options{help} + ); + +%HelpText = ($Options{pidfile} => "--pidfile=FILE write my PID here (default:", + $Options{debug} => "--debug[=0|1] show copious debugging info (default:", + $Options{interval} => "--interval=i pooling interval in sec. (default:", + $Options{outputdir} => "--outputdir=DIR (default:", + $Options{compress} => "--compress=COMMAND use this to compress files (default:", + ); + +# +# +# +use vars qw($interval $nodename); +push(@EXPORT, qw($interval $nodename)); +$interval=0; + +my $UNAME = "/usr/bin/uname"; +$nodename = `$UNAME -n`; +chop($nodename); + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Sendmail.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Sendmail.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Sendmail.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,352 @@ +# +# Sendmail.pm : Orca_Services package to process sendmail log +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# + +package Orca_Services::Sendmail; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + + $Services{Sendmail}{File} = "/var/log/mail.log"; + $Services{Sendmail}{FileD} = ""; + $Services{Sendmail}{Ok} = -1; + $Services{Sendmail}{External} = 0; + $Services{Sendmail}{Init} = "init_smtp"; + $Services{Sendmail}{Init_Vars} = "init_smtp_vars"; + $Services{Sendmail}{Measure} = "measure_smtp"; + $Services{Sendmail}{Put} = "put_smtp"; + + $PrgOptions{"smtp_logfile=s"} = \$Services{Sendmail}{File}; + + $HelpText{$Services{Sendmail}{File}} = "--smtp_logfile=FILE syslog from sendmail (default:"; +} + +use Orca_Services::Output; +use Orca_Services::Utils; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_smtp + init_smtp_vars + measure_smtp + put_smtp + ); + + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($smtp_froms, $smtp_MaxSize, $smtp_sizes, $smtp_MaxSeconds, $smtp_seconds); +my ($smtp_sent, $smtp_fail, $smtp_retries, $smtp_queued, $smtp_t_or_f); +my ($smtp_check_mail, $smtp_check_rcpt, $smtp_notifies, $smtp_dsns); +my ($smtp_spam, $smtp_virus, $smtp_overquota, $smtp_undefs); +my ($smtp_ino, $smtp_size); + +# ------------------------------------------------------------------- +# +# init_smtp - set SMTP vars, open the logfile and seek into the end. +# +# usage: &init_smtp($smtp_logfile); +# + +sub init_smtp { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Sendmail", \$smtp_ino, \$smtp_size); + } + + if($retval == 0) { + &init_smtp_vars (); + } + return $retval; +} + +# ------------------------------------------------------------------- +# +# Get values for smtp columns +# +# usage: &measure_smtp( ); +# + +sub measure_smtp () { + my ($buf); + + $buf = $Services{Sendmail}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + process_smtp_line ($buf); + } + if ($Services{Sendmail}{FileD}->eof) { + printf "SMTP: eof on $Services{Sendmail}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Sendmail}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Sendmail", \$smtp_ino, \$smtp_size); + + return $retval; +} + + +# ------------------------------------------------------------------- +# +# init smtp vars +# +# usage: &init_smtp_vars(); +# + +sub init_smtp_vars() { + $smtp_froms = 0; + $smtp_MaxSize = 0; + $smtp_sizes = 0; + + $smtp_MaxSeconds = 0; + $smtp_seconds = 0; + $smtp_sent = 0; + + $smtp_fail = 0; + $smtp_retries = 0; + $smtp_queued = 0; + $smtp_t_or_f = 0; + + $smtp_check_mail = 0; + $smtp_check_rcpt = 0; + $smtp_notifies = 0; + $smtp_dsns = 0; + + $smtp_spam = 0; + $smtp_virus = 0; + + $smtp_overquota = 0; + + $smtp_undefs = 0; +} + + +# ------------------------------------------------------------------- +# +# Parse smtp log line +# +# usage: &process_smtp_line ($buf); +# + +sub process_smtp_line () { + my ($line) = @_; + my ($size, $seconds); + + if (($line !~ /\ssendmail\[\d+\]:\s/) && ($line !~ /\smailscanner\[\d+\]:\s/) && ($line !~ /\sllmail\[\d+\]:\s/)) { + return 0; + } + + + # from + # Jul 16 03:22:12 server123 sendmail[4977]: e6G2M7O04977: from=, size=981, class=0, nrcpts=1, msgid=<200007152000.VAA24441 at server321.domain.com>, proto=ESMTP, daemon=MTA, relay=server321.domain.com [10.0.0.65] + # 0 Month, 1 Day, 2 hh:mm:ss, 3 nodename, 4 sendmail[NNNNN]:, 5 msg-id:, 6 from=FROM\,, 7 size=NNNNN\,, ... + if ($line =~ /: from=.*, size=(\d+)/i) { + $smtp_froms ++; + $size = $1; + $smtp_sizes += $size; + if ($size > $smtp_MaxSize) { + $smtp_MaxSize = $size; + } + printf "SMTP_FROM: %s", $line if $Options{debug}; + # printf "smtp_froms=%s, size=%s, smtp_sizes=%s, smtp_MaxSize=%s\n", $smtp_froms, $size, $smtp_sizes, $smtp_MaxSize if $Options{debug}; + return 0; + } + + # to + #Jul 16 03:26:32 server123 sendmail[5060]: e6G2PqO05058: to=, delay=00:00:35, xdelay=00:00:35, mailer=esmtp, pri=120745, relay=server321.domain.com. [10.0.0.65], dsn=2.0.0, stat=Sent (DAA19487 Message accepted for delivery) + #Jul 16 03:15:16 server123 sendmail[4828]: e6EBXrO12616: to=, delay=1+14:41:13, xdelay=00:00:55, mailer=esmtp, pri=3001977, relay=mail.domain2.pt. [11.0.0.130], dsn=4.0.0, stat=Deferred: Connection refused by mail.domain2.pt. + #Jul 16 22:31:20 server123 sendmail[881]: e6GLUxP00881: to=, delay=00:00:11, xdelay=00:00:11, mailer=esmtp, pri=37973, relay=mail.domain4.pt. [12.0.0.15], dsn=5.0.0, stat=Service unavailable + #Jul 24 18:33:05 server999 sendmail[15932]: SAA15929: to=, ctladdr= (16306/1984), delay=00:00:10, xdelay=00:00:09, mailer=esmtp, relay=mail.domain4.pt. [13.0.0.3], stat=Sent (Ok) + if ($line =~ /: to=/) { + if ($line =~ /, delay=(\d+)*\+*(\d+):(\d+):(\d+), .*, stat=Sent/i) { + $seconds = 86400*$1 + 3600*$2 + 60*$3 + $4; + + $smtp_seconds += $seconds; + if ($seconds > $smtp_MaxSeconds) { + $smtp_MaxSeconds = $seconds; + } + $smtp_sent ++; + printf "SMTP_SENT: %s", $line if $Options{debug}; + # printf "seconds=%s, smtp_seconds=%s, smtp_MaxSeconds=%s, smtp_sent=%s\n", $seconds, $smtp_seconds, $smtp_MaxSeconds, $smtp_sent if $Options{debug}; + return 0; + } + if ($line =~ /, dsn=5/i) { + $smtp_fail++; + printf "SMTP_FAIL: %s", $line if $Options{debug}; + # printf "smtp_fail=%s\n", $smtp_fail if $Options{debug}; + return 0; + } + if (($line =~ /, dsn=4/i) || ($line =~ /, stat=Deferred:/i)) { + $smtp_retries++; + printf "SMTP_RETRY: %s", $line if $Options{debug}; + # printf "smtp_retries=%s\n", $smtp_retries if $Options{debug}; + return 0; + } + if ($line =~ /, stat=queued/i) { + $smtp_queued++; + printf "SMTP_QUEUE: %s", $line if $Options{debug}; + # printf "smtp_queued=%s\n", $smtp_queued if $Options{debug}; + return 0; + } + $smtp_t_or_f++; + printf "SMTP_T_OR_F: %s", $line if $Options{debug}; + # printf "smtp_t_or_f=%s\n", $smtp_t_or_f if $Options{debug}; + return 0; + } + + # ruleset=check_mail + #Jul 16 22:24:43 server123 sendmail[604]: e6GLNMO00604: ruleset=check_mail, arg1=, relay=server321.domain.com [10.0.0.65], reject=451 4.1.8 ... Domain of sender address Mary.Wilson at domain10.pt does not resolve + if ($line =~ /: ruleset=check_mail, /i) { + $smtp_check_mail ++; + printf "SMTP_CHECK_MAIL: %s", $line if $Options{debug}; + # printf "smtp_check_mail=%s\n", $smtp_check_mail if $Options{debug}; + return 0; + } + + # ruleset=check_rcpt + #Jul 19 16:54:55 server123 sendmail[11437]: e6JFsoO11437: ruleset=check_rcpt, arg1=, relay=a.b.c.net [6.1.6.7], reject=550 5.7.1 ... Relaying denied + #Jul 19 17:34:54 server123 sendmail[12479]: e6JGYKO12479: ruleset=check_rcpt, arg1=, relay=individual [10.0.0.67], reject=450 4.7.1 ... Can not check MX records for recipient host mail.soso.domain8888.pt + if ($line =~ /: ruleset=check_rcpt, /i) { + $smtp_check_rcpt ++; + printf "SMTP_CHECK_RCPT: %s", $line if $Options{debug}; + # printf "smtp_check_rcpt=%s\n", $smtp_check_rcpt if $Options{debug}; + return 0; + } + + # postmaster notify: + #Jul 17 05:30:04 server123 sendmail[10016]: e6EKWRO24933: e6H401o10016: postmaster notify: Cannot send message within 2 days + if ($line =~ /: postmaster notify: /i) { + $smtp_notifies ++; + printf "SMTP_NOTIFIES: %s", $line if $Options{debug}; + # printf "smtp_notifies=%s\n", $smtp_notifies if $Options{debug}; + return 0; + } + + # DSN + #Jul 18 22:28:58 server123 sendmail[7172]: e6ILQlO07170: e6ILSwO07172: DSN: Service unavailable + #Jul 19 14:38:00 server123 sendmail[1846]: e6HBWSO21997: e6JDU0t01846: DSN: Cannot send message within 2 days + #Jul 19 17:33:51 server123 sendmail[12272]: e6JGTlO12270: e6JGXpO12272: DSN: Return receipt + if ($line =~ /: DSN: /i) { + $smtp_dsns ++; + printf "SMTP_DSN: %s", $line if $Options{debug}; + # printf "smtp_dsns=%s\n", $smtp_dsns if $Options{debug}; + return 0; + } + + # Jun 7 11:37:08 server24 mailscanner[494]: Message g57Aam400830 is spam according to SpamAssassin (score=10.5, required 5, FROM_MALFORMED, FROM_NO_USER, PLING, PLING_PLING, HTML_EMBEDS, RAZOR_CHECK, CTYPE_JUST_HTML) + if ($line =~ /: Message .* is spam according to/) { + $smtp_spam ++; + printf "SMTP_SPAM: %s", $line if $Options{debug}; + # printf "smtp_spam=%s\n", $smtp_spam if $Options{debug}; + return 0; + } + + + # Jun 7 10:31:33 ns2 mailscanner[23848]: Found 3 viruses in messages g579Uu428481,g579Uv428484 + # Jun 7 10:34:20 ns2 mailscanner[23848]: Found 1 viruses in messages g579Xm428666 + if ($line =~ /: Found (\d+) viruses in message/i) { + $smtp_virus += $1; + printf "SMTP_VIRUS: %s", $line if $Options{debug}; + # printf "smtp_virus=%s\n", $smtp_virus if $Options{debug}; + return 0; + } + + # ignore the rest of mailscanner + # Jun 7 10:31:33 ns2 mailscanner[23848]: + if ($line =~ / mailscanner\[\d+\]: /) { + return 0; + } + + # Nov 4 16:30:29 host2 llmail[9188]: OverQuota: user4 current: 15808428 bytes limit: 15728640 bytes + if ($line =~ / llmail\[\d+\]: OverQuota: /) { + $smtp_overquota ++; + printf "SMTP_OVERQUOTA: %s", $line if $Options{debug}; + # printf "smtp_overquota: %s\n", $smtp_overquota if $Options{debug}; + return 0; + } + + $smtp_undefs ++; + printf "SMTP_UNDEF: %s", $line if $Options{debug}; + # printf "smtp_undefs=%s\n", $smtp_undefs if $Options{debug}; + return 0; +} + +# ------------------------------------------------------------------- +# +# Put the smtp values for output +# +# usage: &put_smtp(); +# + +sub put_smtp() { + &put_output("smtp_from", sprintf("%8.2f", $smtp_froms)); + &put_output("smtp_tops", sprintf("%8.2f", $smtp_MaxSize)); + if ($smtp_froms) { + &put_output("smtp_sizes", sprintf("%8.2f", $smtp_sizes/$smtp_froms)); + } else { + &put_output("smtp_sizes", sprintf("%8.2f", 0)); + } + &put_output("smtp_sent", sprintf("%8.2f", $smtp_sent)); + &put_output("smtp_maxd", sprintf("%8.2f", $smtp_MaxSeconds)); + if ($smtp_sent) { + &put_output("smtp_delay", sprintf("%8.2f", $smtp_seconds/$smtp_sent)); + } else { + &put_output("smtp_delay", sprintf("%8.2f", 0)); + } + &put_output("smtp_fail", sprintf("%8.2f", $smtp_fail)); + &put_output("smtp_rtrs", sprintf("%8.2f", $smtp_retries)); + &put_output("smtp_queued", sprintf("%8.2f", $smtp_queued)); + &put_output("smtp_torf", sprintf("%8.2f", $smtp_t_or_f)); + &put_output("smtp_c_ml", sprintf("%8.2f", $smtp_check_mail)); + &put_output("smtp_c_rt", sprintf("%8.2f", $smtp_check_rcpt)); + &put_output("smtp_ntfs", sprintf("%8.2f", $smtp_notifies)); + &put_output("smtp_dsns", sprintf("%8.2f", $smtp_dsns)); + + &put_output("smtp_spam", sprintf("%8.2f", $smtp_spam)); + &put_output("smtp_virus", sprintf("%8.2f", $smtp_virus)); + + &put_output("smtp_overquota", sprintf("%8.2f", $smtp_overquota)); + + &put_output("smtp_undf", sprintf("%8.2f", $smtp_undefs)); + + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Pop.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Pop.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Pop.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,294 @@ +# +# Pop.pm : Orca_Services package for monitoring pop service +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Pop; +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Pop}{File} = "/var/log/ipop3d.log"; + $Services{Pop}{FileD} = ""; + $Services{Pop}{Ok} = -1; + $Services{Pop}{External} = 0; + $Services{Pop}{Init} = "init_pop"; + $Services{Pop}{Init_Vars} = "init_pop_vars"; + $Services{Pop}{Measure} = "measure_pop"; + $Services{Pop}{Put} = "put_pop"; + + $PrgOptions{"pop_logfile=s"} = \$Services{Pop}{File}; + + $HelpText{$Services{Dns}{File}} = "--pop_logfile=FILE syslog from pop (default:"; +} + +use Orca_Services::Utils; +use Orca_Services::Output; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_pop + init_pop_vars + measure_pop + put_pop + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($pop_connect, $pop_login , $pop_logout, $pop_failure, $pop_refused); +my ($pop_net_error, $pop_local_error, $pop_undefs); +my ($pop_ino, $pop_size); + +# +# init_pop - set POP vars, open the logfile and seek into the end. +# +# usage: &init_pop($pop_logfile); +# +sub init_pop { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Pop", \$pop_ino, \$pop_size); + } + + if($retval == 0) { + &init_pop_vars (); + } + return $retval; +} + + +# +# init pop vars +# +# usage: &init_pop_vars(); +# +sub init_pop_vars() { + $pop_connect = 0; + $pop_login = 0; + $pop_logout = 0; + + $pop_failure = 0; + $pop_refused = 0; + + $pop_net_error = 0; + $pop_local_error = 0; + + $pop_undefs = 0; +} + + +# +# Get values for pop columns +# +# usage: &measure_pop( ); +# + +sub measure_pop () { + my($buf); + + $buf = $Services{Pop}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + &process_pop_line ($buf); + } + if ($Services{Pop}{FileD}->eof) { + printf "POP: eof on $Services{Pop}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Pop}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Pop", \$pop_ino, \$pop_size); + + return $retval; + +} + + +# +# Parse pop log line +# +# usage: &process_pop_line ($buf); +# +sub process_pop_line () { + my ($line) = @_; + + + # Oct 27 04:03:00 host2 pop3d: Connection, ip=[::ffff:10.0.0.133] + # Oct 27 04:03:00 host2 pop3d: LOGIN, user=user7, ip=[::ffff:10.0.0.133] + # Oct 27 04:03:00 host2 pop3d: LOGOUT, user=user7, ip=[::ffff:10.0.0.133], top=0, retr=0 + + if (($line !~ / ipop3d\[\d+\]: /) && + ($line !~ / perdition\[\d+\]: /) && + ($line !~ / pop3d: /)) { + return 0; + } + + ### connect + # Aug 11 07:01:50 host1 ipop3d[13929]: connect from 14.5.8.10 + # Feb 28 22:13:34 host1 perdition[26127]: Connect: 10.0.0.1->12.1.1.1 user="id1" server="host1.KPNQwest.pt" port="110" + # Oct 27 04:03:00 host2 pop3d: Connection, ip=[::ffff:10.0.0.133] + + if (($line =~ /: connect from /i) || + ($line =~ /: Connect: /i) || + ($line =~ /: Connection, /i)) { + $pop_connect ++; + printf "POP_CONNECT: %s", $line if $Options{debug}; + printf "pop_connect=%s\n", $pop_connect if $Options{debug}; + return 0; + } + + ### login + auth + # Aug 11 07:01:57 host1 ipop3d[13928]: Login user=luser2 host=host.domain.pt [13.16.6.27] nmsgs=0/0 + # Aug 11 07:02:06 host1 ipop3d[13936]: Auth user=luser3 host=2-4-4.domain.pt [13.16.2.18] nmsgs=0/0 + # Feb 28 22:13:34 host1 perdition[26121]: Auth: 10.0.0.1->12.1.1.1 user="id1" server="host1.KPNQwest.pt" port="110" + # Oct 27 04:03:00 host2 pop3d: LOGIN, user=user7, ip=[::ffff:10.0.0.133] + + if ( ($line =~ /: Login user=/i) || + ($line =~ /: Auth user=/i) || + ($line =~ /: Auth: /i) || + ($line =~ /: LOGIN, /i)) { + $pop_login ++; + printf "POP_LOGIN: %s", $line if $Options{debug}; + printf "pop_login=%s\n", $pop_login if $Options{debug}; + return 0; + } + + ### logout + # Aug 11 07:01:50 host1 ipop3d[13929]: Logout user=luser4 host=[14.6.8.10] nmsgs=0 ndele=0 + # Aug 11 11:20:24 host1 ipop3d[1866]: Autologout user=luser5 host=3-0-0.domain.pt [13.16.1.18] + # Feb 28 22:13:35 host1 perdition[26127]: Closing: 10.0.0.1->12.1.1.1 user=id1 12 18 + # Oct 27 04:03:48 host2 perdition[14872]: Close: 11.1.1.2->13.3.3.4 user="user2" received=6 sent=0 + # Oct 27 04:03:00 host2 pop3d: LOGOUT, user=user7, ip=[::ffff:10.0.0.133], top=0, retr=0 + + if (($line =~ /: .*[lL]ogout user=/i) || + ($line =~ /: Closing: /i) || + ($line =~ /: Close: /i) || + ($line =~ /: LOGOUT, /i)) { + $pop_logout ++; + printf "POP_LOGOUT: %s", $line if $Options{debug}; + printf "pop_LOGOUT=%s\n", $pop_logout if $Options{debug}; + return 0; + } + + ### failure + # Aug 11 09:19:19 host1 ipop3d[22171]: Login failure user=luser44 host=4-0-0.domain.pt [13.16.12.1] + # Aug 11 09:19:22 host1 ipop3d[22171]: AUTHENTICATE LOGIN failure host=4-0-0.domain.pt [13.16.12.1] + # Aug 11 09:47:47 host1 ipop3d[25308]: AUTHENTICATE luser323 failure host=[13.12.24.24] + # Feb 28 21:42:54 host1 perdition[21930]: Fatal Error reading authentication information from client "10.0.0.1->12.1.1.1 ": Exiting child + # Feb 28 21:46:56 host1 perdition[22466]: Fail reauthentication for user id1 + + if (($line =~ / failure /i) || + ($line =~ /: Fatal Error reading authentication information from client /i) || + ($line =~ /: Fail reauthentication for user /i)) { + $pop_failure ++; + printf "POP_FAILURE: %s", $line if $Options{debug}; + printf "pop_failure=%s\n", $pop_failure if $Options{debug}; + return 0; + } + + ### refused + # Aug 11 13:32:14 host1 ipop3d[28886]: refused connect from 13.17.8.28 + + if ($line =~ /: refused connect from /i) { + $pop_refused ++; + printf "POP_REFUSED: %s", $line if $Options{debug}; + printf "pop_refused=%s\n", $pop_refused if $Options{debug}; + return 0; + } + + ### local_error + # Aug 11 11:50:36 host1 ipop3d[13132]: Error opening or locking INBOX user=luser10 host=3-4-3.domain.pt [13.16.4.7] + # Feb 28 21:41:53 host1 perdition[20588]: Fatal error piping data. Exiting child. + + if (($line =~ /: Error opening or locking INBOX user=/i) || + ($line =~ /: Fatal error piping data. Exiting child./i)) { + $pop_local_error ++; + printf "POP_LOCAL_ERROR: %s", $line if $Options{debug}; + printf "pop_local_error=%s\n", $pop_local_error if $Options{debug}; + return 0; + } + + ### net_error + # Aug 11 07:36:14 host1 ipop3d[15759]: Command stream end of file while reading line user=luser234 host=9-9-9-domain.pt [13.16.4.5] + # Aug 11 09:50:09 host1 ipop3d[24960]: Connection reset by peer while reading line user=luser555 host=[12.5.19.16] + # Aug 11 12:15:01 host1 ipop3d[16601]: Connection timed out while reading line user=luser7985 host=4-5-6.domain.pt [13.16.1.15] + # Oct 27 04:17:16 host2 pop3d: Disconnected, ip=[::ffff:10.0.0.132] + # Oct 27 04:19:59 host2 pop3d: DISCONNECTED, user=user4, ip=[::ffff:10.0.0.133], top=0, retr=0 + # Oct 27 10:46:50 host2 pop3d: TIMEOUT, user=user55, ip=[::ffff:10.0.0.133], top=0, retr=0 + + if ( ($line =~ /: Command stream end of file while reading line user=/i) || + ($line =~ /: Connection reset by peer while reading line user=/i) || + ($line =~ /: Connection timed out while reading line user=/i) || + ($line =~ /: Disconnected,/i) || + ($line =~ /: TIMEOUT,/i) ) { + $pop_net_error ++; + printf "POP_NET_ERROR: %s", $line if $Options{debug}; + printf "pop_net_error=%s\n", $pop_net_error if $Options{debug}; + return 0; + } + + + $pop_undefs ++; + printf "POP_UNDEF: %s", $line if $Options{debug}; + printf "pop_undefs=%s\n", $pop_undefs if $Options{debug}; + return 0; +} + + +# +# Put the pop values for output +# +# usage: &put_pop(); +# + +sub put_pop() { + &put_output("pop_connect", sprintf("%8.2f", $pop_connect)); + &put_output("pop_login", sprintf("%8.2f", $pop_login)); + &put_output("pop_logout", sprintf("%8.2f", $pop_logout)); + + &put_output("pop_failure", sprintf("%8.2f", $pop_failure)); + &put_output("pop_refused", sprintf("%8.2f", $pop_refused)); + + &put_output("pop_net_error", sprintf("%8.2f", $pop_net_error)); + &put_output("pop_local_error", sprintf("%8.2f", $pop_local_error)); + + &put_output("pop_undefs", sprintf("%8.2f", $pop_undefs)); + + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Http.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Http.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Http.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,278 @@ +# +# Http.pm : Orca_Services package for http monitoring +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Http; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Http}{File} = "/export/home/squid/logs/access.log"; + $Services{Http}{FileD} = ""; + $Services{Http}{Ok} = -1; + $Services{Http}{External} = 0; + $Services{Http}{Init} = "init_http"; + $Services{Http}{Init_Vars} = "init_http_vars"; + $Services{Http}{Measure} = "measure_http"; + $Services{Http}{Put} = "put_http"; + + # + # something you want to do in the external loop + $Services{Http}{Extra} = "count_http_procs"; + + $PrgOptions{"http_logfile=s"} = \$Services{Http}{File}; + + $HelpText{$Services{Http}{File}} = "--http_logfile=FILE log from http (default:"; +} + +use Proc::ProcessTable; +use Orca_Services::Utils; +use Orca_Services::Output; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_http + init_http_vars + measure_http + put_http + count_http_procs + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($http_procs, $http_condgets, $http_gets, $http_heads, $http_posts); +my ($http_hits, $http_errors, $http_total_bytes, $http_1k, $http_10k); +my ($http_100k, $http_1000k, $http_1M, $http_undefs); +my ($http_ino, $http_size); + +# +# init_http - set HTTP vars, open the logfile and seek into the end. +# +# usage: &init_http($http_logfile); +# +sub init_http { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Http", \$http_ino, \$http_size); + } + + if($retval == 0) { + &init_http_vars (); + } + return $retval; +} + +# +# Get values for http columns +# +# usage: &measure_http( ); +# + +sub measure_http () { + my ($buf); + + $buf = $Services{Http}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + &process_http_line ($buf); + } + if ($Services{Http}{FileD}->eof) { + printf "HTTP: eof on $Services{Http}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Http}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Http", \$http_ino, \$http_size); + + return $retval; +} + + +# +# init http vars +# +# usage: &init_http_vars(); +# + +sub init_http_vars() { + $http_procs = 0; + + $http_condgets = 0; + $http_gets = 0; + $http_heads = 0; + $http_posts = 0; + + $http_hits = 0; + $http_errors = 0; + $http_total_bytes = 0; + $http_1k = $http_10k = $http_100k = $http_1000k = $http_1M = 0; + + $http_undefs = 0; +} + +# +# Parse http log line +# +# usage: &process_http_line ($buf); +# + +sub process_http_line () { + my ($line) = @_; + + printf "HTTP_LINE: %s", $line if $Options{debug}; + + ### mix-bayonne-102-1-111.abo.wanadoo.fr - - [28/Feb/2001:17:46:54 +0000] "GET /Lisboa/i/lisboa.html HTTP/1.1" 301 328 "http://www.quid.fr/generation/detail_selectweb.php?iso=pt" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 95; DigExt; KITV4.7 Wanadoo)" + if ($line =~ / \"GET\s.*\"\s(3\d+)\s(\d+)/) { + $http_condgets++; + &process_http_values( $1, $2 ); + return 0 + } + ### mail.abola.pt - - [28/Feb/2001:17:49:24 +0000] "GET /images/mc_kpnq.gif HTTP/1.1" 304 - "http://www.kpnqwest.pt/entrada.html" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" + if ($line =~ / \"GET\s.*\"\s(3\d+)\s\-/) { + $http_condgets++; + &process_http_values( $1, 0 ); + return 0 + } + + ### p153a155.teleweb.pt - - [27/Feb/2001:02:02:28 +0000] "GET /images/menu_0.gif HTTP/1.1" 200 6356 "http://www.kpnqwest.pt/menu.html" "Mozilla/4.0 (compatible; MSIE 5.5; Windows 98; Win 9x 4.90)" + if ($line =~ / \"GET\s.*\"\s(\d+)\s(\d+)/) { + $http_gets++; + &process_http_values( $1, $2 ); + return 0 + } + + + ### marvin.northernlight.com - - [27/Feb/2001:17:55:52 +0000] "HEAD /corporate/press_130100.html HTTP/1.1" 200 0 "-" "Gulliver/1.3" + if ($line =~ / \"HEAD\s.*\"\s(\d+)\s(\d+)/) { + $http_heads++; + &process_http_values( $1, $2 ); + return 0 + } + + ### p87.b.shuttle.de - - [27/Feb/2001:10:55:58 +0000] "POST /cgi-bin/idx/eunet/search.dat HTTP/1.0" 200 5932 "http://www.kpnqwest.pt/entrada.html" "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)" + if ($line =~ / \"HEAD\s.*\"\s(\d+)\s(\d+)/) { + $http_posts++; + &process_http_values( $1, $2 ); + return 0 + } + + $http_undefs++; + printf "HTTP_UNDEF: %s", $line if $Options{debug}; + return 0; +} + +sub process_http_values () { + my ($code, $bytes) = @_; + + + $http_hits++; + $http_total_bytes += $bytes; + + if ($code =~ /^[45]\d\d/) { + $http_errors++; + } + + printf "HTTP_code_bytes: %s %s", $code, $bytes if $Options{debug}; + if ($bytes < 1024) { + $http_1k ++; + } elsif ($bytes < 10240) { + $http_10k ++; + } elsif ($bytes < 102400) { + $http_100k ++; + } elsif ($bytes < 1024000) { + $http_1000k ++; + } else { + $http_1M ++; + } + + return 0; +} + + + +# ------------------------------------------------------------------- +# +# Put the http values for output +# +# usage: &put_http(); +# + +sub put_http() { + &put_output("http_hits", sprintf("%8.2f", $http_hits)); + &put_output("http_condgets", sprintf("%8.2f", $http_condgets)); + &put_output("http_gets", sprintf("%8.2f", $http_gets)); + &put_output("http_heads", sprintf("%8.2f", $http_heads)); + &put_output("http_posts", sprintf("%8.2f", $http_posts)); + &put_output("http_errors", sprintf("%8.2f", $http_errors)); + &put_output("http_undefs", sprintf("%8.2f", $http_undefs)); + + if ($interval) { + &put_output("http_Bps", sprintf("%8.2f", $http_total_bytes/$interval)); + } else { + &put_output("http_Bps", sprintf("%8.2f", 0)); + } + + if ($http_hits) { + &put_output("http_1k", sprintf("%8.2f", $http_1k/$http_hits)); + &put_output("http_10k", sprintf("%8.2f", $http_10k/$http_hits)); + &put_output("http_100k", sprintf("%8.2f", $http_100k/$http_hits)); + &put_output("http_1000k", sprintf("%8.2f", $http_1000k/$http_hits)); + &put_output("http_1M", sprintf("%8.2f", $http_1M/$http_hits)); + } else { + &put_output("http_1k", sprintf("%8.2f", 0)); + &put_output("http_10k", sprintf("%8.2f", 0)); + &put_output("http_100k", sprintf("%8.2f", 0)); + &put_output("http_1000k", sprintf("%8.2f", 0)); + &put_output("http_1M", sprintf("%8.2f", 0)); + } + + &put_output("http_procs", sprintf("%8.2f", $http_procs)); +} + +sub count_http_procs { + my $t = new Proc::ProcessTable; + $http_procs = 0; + foreach $p ( @{$t->table} ){ + if ($p->cmndline =~ /http/) { + $http_procs++; + } + } +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Nntp.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Nntp.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Nntp.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,191 @@ +# +# Nntp.pm : Orca_Services package for monitoring nntp +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Nntp; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Nntp}{File} = "/var/log/news/news.debug"; + $Services{Nntp}{FileD} = ""; + $Services{Nntp}{Ok} = -1; + $Services{Nntp}{External} = 0; + $Services{Nntp}{Init} = "init_nntpcache"; + $Services{Nntp}{Init_Vars} = "init_nntpcache"; + $Services{Nntp}{Measure} = "measure_nntpcache"; + $Services{Nntp}{Put} = "put_nntpcache"; + + $PrgOptions{"nntpcache_logfile=s"} = \$Services{Nntp}{File}; + + $HelpText{$Services{Nntp}{File}} = "--nntpcache_logfile=FILE log from nntpcache (default:"; +} + +use Orca_Services::Utils; +use Orca_Services::Output; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_nntpcache + init_nntpcache_vars + measure_nntpcache + put_nntpcache + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($nntpcache_connects,$nntpcache_groups,$nntpcache_articles); +my ($nntpcache_ino, $nntpcache_size); + +# +# init_nntpcache - set NNTPCACHE vars, open the logfile and seek into the end. +# +# usage: &init_nntpcache($nntpcache_logfile); +# +sub init_nntpcache { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Nntp", \$nntpcache_ino, \$nntpcache_size); + } + + if($retval == 0) { + &init_nntpcache_vars (); + } + return $retval; +} + + +# +# Get values for nntpcache columns +# +# usage: &measure_nntpcache( ); +# + +sub measure_nntpcache () { + my($buf); + + $buf = $Services{Nntp}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + &process_nntpcache_line ($buf); + } + if ($Services{Nntp}{FileD}->eof) { + printf "NNTPCACHE: eof on $Services{Nntp}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Nntp}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Nntp", \$nntpcache_ino, \$nntpcache_size); + + return $retval; +} + + +# +# init nntpcache vars +# +# usage: &init_nntpcache_vars(); +# + +sub init_nntpcache_vars() { + $nntpcache_connects = 0; + $nntpcache_groups = 0; + $nntpcache_articles = 0; +} + + +# +# Parse nntpcache log line +# +# usage: &process_nntpcache_line ($buf); +# + +sub process_nntpcache_line () { + my ($line) = @_; + + if ($line !~ /\snntpcache-client\[\d+\]:\s/) { + return 0; + } + + + # connect from + # Nov 5 16:27:01 news nntpcache-client[6789]: 10.1.2.2 connect from (10.1.2.2) + + if ($line =~ /\sconnect\sfrom\s/) { + $nntpcache_connects ++; + printf "NNTPCACHE_CONNECTS: %s", $line if $Options{debug}; + return 0; + } + + # GROUP + # Nov 5 16:27:01 news nntpcache-client[6789]: sockets.c:455: <- GROUP microsoft.public.visual.sourcesafe + + if ($line =~ /:\s<-\sGROUP\s/) { + $nntpcache_groups ++; + printf "NNTPCACHE_GROUPS: %s", $line if $Options{debug}; + return 0; + } + + # ARTICLE + # Nov 5 16:27:07 news nntpcache-client[6789]: sockets.c:455: <- ARTICLE 13460 + + if ($line =~ /:\s<-\sARTICLE\s/) { + $nntpcache_articles ++; + printf "NNTPCACHE_ARTICLES: %s", $line if $Options{debug}; + return 0; + } + + return 0; +} + + +# +# Put the nntpcache values for output +# +# usage: &put_nntpcache(); +# +sub put_nntpcache() { + &put_output("nntpcache_connects", sprintf("%8.2f", $nntpcache_connects)); + &put_output("nntpcache_groups", sprintf("%8.2f", $nntpcache_groups)); + &put_output("nntpcache_articles", sprintf("%8.2f", $nntpcache_articles)); + + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Utils.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Utils.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Utils.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,128 @@ +# +# Utils.pm : Orca_Services package for some usefull functions +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Utils; + +use strict; +use Carp; +use Exporter; +use IO::File; +use Sys::Syslog; +use Orca_Services::Vars; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(logit + OpenFile + CheckFileChange + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +# +# logit -- send MSG(s) to the syslog. +# +# usage: &logit($msg_to_log); +# + +sub logit { + my($Msg) = @_; + + &Sys::Syslog::openlog("$progname", 'cons,pid', "$log_facility"); + &Sys::Syslog::syslog("$log_priority", $Msg); + &Sys::Syslog::closelog(); +} + +sub OpenFile { + my ($filename, $ServName, $ref_ino, $ref_size) = @_; + my ($retval, $seek_ok); + + $retval = 0; + $Services{$ServName}{FileD} = new IO::File "$filename", "r"; + if (defined($Services{$ServName}{FileD})) { + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat($Services{$ServName}{FileD}); + if (!$dev) { + &logit ("can't stat $filename"); + warn "$progname: can't stat $filename\n"; + $retval = 1; + } + $$ref_ino = $ino; + $$ref_size = $size; + $seek_ok = seek($Services{$ServName}{FileD}, 0, SEEK_END); + if (!$seek_ok) { + &logit ("can't seek into EOF on $filename"); + warn "$progname: can't seek into EOF on $filename\n"; + $retval = 2; + } + } else { + &logit ("can't open $filename"); + warn "$progname: can't open $filename\n"; + $retval = 3; + } + + return $retval; +} + +sub CheckFileChange { + my ($ServName, $ref_ino, $ref_size) = @_; + my ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev ); + my ($size, $atime, $mtime, $ctime, $blksize, $blocks); + + # test for file change via different inode or filesize decrease + $dev = $ino = $mode = $nlink = $uid = $gid = $rdev = + $size = $atime = $mtime = $ctime = $blksize = $blocks = ''; + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) = stat($Services{$ServName}{File}); + if (!$dev) { + &logit ("can't stat $Services{$ServName}{File}"); + warn "$progname: can't stat $Services{$ServName}{File}\n"; + return 1; + } + printf "Filedesc %s old_ino=%s vs. ino=%s\told_size=%s vs. size=%s\n", $ServName, $$ref_ino, $ino, $$ref_size, $size if $Options{debug}; + if (($$ref_ino != $ino) || ($$ref_size > $size)) { + undef $Services{$ServName}{FileD}; + printf "Ffile change on $Services{$ServName}{File}\n" if $Options{debug}; + $Services{$ServName}{FileD} = new IO::File "$Services{$ServName}{File}", "r"; + if (!defined ($Services{$ServName}{FileD})) { + &logit ("can't re-open $Services{$ServName}{File}"); + warn "$progname: can't re-open $Services{$ServName}{File}\n"; + $$ref_ino = $$ref_size = 0; + return 2; + } + $$ref_ino = $ino; + $$ref_size = $size; + } + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Output.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Output.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Output.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,158 @@ +# +# Output.pm : Orca_Services package for output funcions +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Output; + +use strict; +use Carp; +use Exporter; +use POSIX; +use IO::File; +use Sys::Syslog; +use Orca_Services::Utils; +use Orca_Services::Vars; + +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(put_output + flush_output + check_output + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my (@col_data, @col_comment); + +# +# check_output - set outputfile vars, open the outputfile. +# +# usage: &check_output($outputdir); +# + +sub check_output { + my ($outputdir) = @_; + my ($sec1,$min1,$hour1,$mday1,$mon1,$year1,$wday1,$yday1,$isdst1); + my ($now_string); + + $sec1=$min1=$hour1=$mday1=$mon1=$year1=$wday1=$yday1=$isdst1 = 0; + + ($sec1,$min1,$hour1,$mday1,$mon1,$year1,$wday1,$yday1,$isdst1) = localtime(); + + if ($mday1 != $SaveDay) { + # First time or day has changed, start new logfile. + if (OUTFD->opened) { + close(OUTFD); # ignore error + } + if (($Options{compress}) && ($SaveDay)) { # just on day change + if ($OutputFilename) { + &logit ("compressing $OutputFilename"); + system ("$Options{compress} $OutputFilename"); # ignore error ?? + } + } + + $now_string = strftime "%Y-%m-%d", localtime; + + my $subday = 0; + my $tempfilename = "$outputdir/orca_services-" . $now_string . "-" . sprintf("%03d", $subday); + while (-f $tempfilename) { + $subday ++; + $tempfilename = "$outputdir/orca_services-" . $now_string . "-" . sprintf("%03d", $subday); + } + $OutputFilename = $tempfilename; + + if (!open (OUTFD, ">$OutputFilename")) { + &logit ("can't open outputfile $OutputFilename"); + die "$progname: can't open outputfile $OutputFilename\n"; + } + + $SaveDay = $mday1; + $print_header = 1; + } + + return 0; +} + + +# +# flush_output - dumps line into outputfile +# +# usage: &flush_output(); +# + +sub flush_output() { + if ($print_header) { + &print_columns(\@col_comment); + $print_header = 0; + } + &print_columns(\@col_data); + $current_column = 0; +} + +# +# Send the stored columns of information to the output. +# +# usage: &print_columns( \@array ); +# + +sub print_columns() { + my ($ref) = @_; + my ($i, @col); + + @col = @$ref; + + for ($i=0; $i < $current_column; $i++) { + printf OUTFD "%s", $col[$i]; + if ($i != $current_column - 1) { + printf OUTFD " "; + } + } + printf OUTFD "\n"; + OUTFD->flush; +} + +# +# Add one column of comments and data to the buffers. +# +# usage: &put_output( $comment, $data ); +# + +sub put_output() { + my ($comment, $data) = @_; + + printf "OUT: --%s-- %s\n", $comment, $data if $Options{debug}; + $col_comment[$current_column] = $comment; + $col_data[$current_column] = $data; + $current_column++; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Mailq.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Mailq.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Mailq.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,134 @@ +# +# Mailq.pm : Orca_Services package for mailq monitoring +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# + +package Orca_Services::Mailq; + +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Mailq}{File} = "on"; + $Services{Mailq}{FileD} = ""; + $Services{Mailq}{Ok} = -1; + $Services{Mailq}{External} = 1; + $Services{Mailq}{Init} = "init_mailq"; + $Services{Mailq}{Init_Vars} = "init_mailq_vars"; + $Services{Mailq}{Measure} = "measure_mailq"; + $Services{Mailq}{Put} = "put_mailq"; + + $PrgOptions{"mailq=s"} = \$Services{Mailq}{File}; + + $HelpText{$Services{Mailq}{File}} = "--mailq=[on|off] get mailq total requests (default:"; +} + +use Orca_Services::Output; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_mailq + init_mailq_vars + measure_mailq + put_mailq + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($mailq_total); + +# +# Get values for mailq columns +# +# usage: &measure_mailq( ); +# + +sub measure_mailq () { + my ($mailq_t, $line); + + open (MFD, "$MAILQCMD |"); + $line = ; + close (MFD); + + if ($line =~ /(\d+)/i) { + $mailq_t = $1; + } else { + $mailq_t = 0; + } + + print "MAILQ : $mailq_t\n" if $Options{debug}; + $mailq_total += $mailq_t; + + return 0; +} + + +# +# init mailq +# +# usage: &init_mailq(); +# + +sub init_mailq() { + if ($Services{Mailq}{File} eq "off" ){ + return -1; + } + return 0; +} + + +# +# init mailq vars +# +# usage: &init_mailq_vars(); +# + +sub init_mailq_vars() { + $mailq_total = 0; +} + + +# +# Put the mailq values for output +# +# usage: &put_mailq(); +# + +sub put_mailq() { + + &put_output("mailq_total", sprintf("%8.2f", $mailq_total)); + + return 0; +} + +1; Added: branches/orca/import_orca_services_2.0/lib/Orca_services/Slapd.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_services/Slapd.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_services/Slapd.pm 2003-03-08 10:26:13.000000000 -0800 @@ -0,0 +1,183 @@ +# +# Slapd.pm : Orca_Services package for monitoring slapd +# +# Author: Sjaak Westdijk +# +# thanks to : +# Carlos Canau +# Jose Carlos Pereira +# +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau +# +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts +# +# +# BUGS: +# +# +# TODO: +# +# +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira +# +# +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it +# +# +# + +package Orca_Services::Slapd; +BEGIN { + use strict; + use Carp; + use Exporter; + use IO::File; + use Sys::Syslog; + use Orca_Services::Vars; + $Services{Slapd}{File} = "/var/ds5/slapd-velsatis/logs/access"; + $Services{Slapd}{FileD} = ""; + $Services{Slapd}{Ok} = -1; + $Services{Slapd}{External} = 0; + $Services{Slapd}{Init} = "init_slapd"; + $Services{Slapd}{Init_Vars} = "init_slapd_vars"; + $Services{Slapd}{Measure} = "measure_slapd"; + $Services{Slapd}{Put} = "put_slapd"; + + $PrgOptions{"slapd_logfile=s"} = \$Services{Slapd}{File}; + + $HelpText{$Services{Slapd}{File}} = "--slapd_logfile=FILE log from slapd (default:"; +} + + +use Orca_Services::Output; +use Orca_Services::Utils; +use vars qw(@EXPORT @ISA $VERSION); + + at EXPORT = qw(init_slapd + init_slapd_vars + measure_slapd + put_slapd + ); + at ISA = qw(Exporter); +$VERSION = substr q$Revision: 0.01 $, 10; + +my ($slapd_binds, $slapd_searchs); +my ($slapd_ino, $slapd_size); + +# +# When we do a Iplanet access file, all records are valid +# +my ($Iplanet) = 1; + + +# +# init_slapd - set SLAPD vars, open the logfile and seek into the end. +# +# usage: &init_slapd($slapd_logfile); +# +sub init_slapd { + my ($filename) = @_; + my ($retval); + + if ($filename) { + $retval = OpenFile($filename, "Slapd", \$slapd_ino, \$slapd_size); + } + + if($retval == 0) { + &init_slapd_vars (); + } + return $retval; +} + + +# +# Get values for slapd columns +# +# usage: &measure_slapd( ); +# +sub measure_slapd () { + my ($buf); + + $buf = $Services{Slapd}{FileD}->getline; + while ($buf) { + ## process line read and check for eof + if ($buf) { + &process_slapd_line ($buf); + } + if ($Services{Slapd}{FileD}->eof) { + printf "SLAPD: eof on $Services{Slapd}{File}\n" if $Options{debug}; + last; # get out of while($buf) + } + $buf = $Services{Slapd}{FileD}->getline; + } ## while ($buf) + + my $retval = CheckFileChange ("Slapd", \$slapd_ino, \$slapd_size); + + return $retval; +} + + +# +# init slapd vars +# +# usage: &init_slapd_vars(); +# +sub init_slapd_vars() { + $slapd_binds = 0; + $slapd_searchs = 0; +} + + +# +# Parse slapd log line +# +# usage: &process_slapd_line ($buf); +# + +sub process_slapd_line () { + my ($line) = @_; + + if ($line !~ /\sslapd\[\d+\]:\s/ && $Iplanet == 0) { + return 0; + } + + # BIND + # Nov 6 18:24:05 ldap1 slapd[259]: conn=808413 op=0 BIND dn="xxxxxxxxxxxx" method=128 + if ($line =~ /\sBIND\s/) { + $slapd_binds ++; + printf "SLAPD_BINDS: %s", $line if $Options{debug}; + return 0; + } + + # SRCH + # Nov 6 18:24:05 ldap10 slapd[3456]: conn=32453 op=1 SRCH base="zzzzzzzzzzzzzz" scope=1 filter="yyyyyyyyyyyyyyyyyyy" + if ($line =~ /\sSRCH\s/) { + $slapd_searchs ++; + printf "SLAPD_SEARCHS: %s", $line if $Options{debug}; + return 0; + } + + return 0; +} + + +# +# Put the slapd values for output +# +# usage: &put_slapd(); +# + +sub put_slapd() { + &put_output("slapd_binds", sprintf("%8.2f", $slapd_binds)); + &put_output("slapd_searchs", sprintf("%8.2f", $slapd_searchs)); + + return 0; +} + +1; Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in 2003-03-08 10:26:13.000000000 -0800 @@ -1,32 +1,37 @@ #!/bin/sh -# This script runs orca_services with the proper options for your -# site. +# This script runs orca_services with the proper options for your site. # Define program locations that will be needed. prefix=@prefix@ exec_prefix=@exec_prefix@ -libexecdir=@libexecdir@ -sysconfdir=@sysconfdir@ +libdir=@libexecdir@ AWK=@AWK@ CUT=@CUT@ UNAME=@UNAME@ -RAW_ORCA_SERVICES_DIR=@VAR_DIR@/orca_services +ORCA_SERVICES_DIR=@VAR_DIR@/orca_services # Get the hostname without the fully qualified part; that is, trim off # anything past the first `.'. uname=`$UNAME -n | $CUT -d. -f1` -# The directory these files go into is $RAW_ORCA_SERVICES_DIR/HOSTNAME. -OUTDIR=$RAW_ORCA_SERVICES_DIR/$uname +OPERSYS=`$UNAME -s` +if test "${OPERSYS}" = "Linux"; then + PSCMD="/bin/ps" +else + PSCMD="/usr/ucb/ps" # Solaris +fi + +# The directory these files go into is $ORCA_SERVICES_DIR/HOSTNAME +OUTDIR=$ORCA_SERVICES_DIR/$uname # Export the environmental variables. export OUTDIR # Check if orca_services is already running. -pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` +pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/start_orca_services/ && !/daemon/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then - echo "Orca_services already running. Exiting." + echo "Orca_Services already running. Exiting." exit 1 fi @@ -49,16 +54,15 @@ # Now start the logging. echo "Starting logging" HOSTNAME=`hostname` -if test -f "$libexecdir/orca_services.$HOSTNAME"; then - $libexecdir/orca_services `cat $sysconfdir/orca_services.$HOSTNAME` +if test -f "$libdir/orca_services.$HOSTNAME"; then + $libdir/orca_services `cat $libdir/orca_services.$HOSTNAME` else - $libexecdir/orca_services + $libdir/orca_services fi -# Write the PID of orca_services to a file to make killing easier. -pid=$! -echo $pid > $OUTDIR/orca_services.pid +### # Write the PID of orca_services to a file to make killing easier. +### pid=$! +### echo $pid > $OUTDIR/orca_services.pid -# Sleep for a couple of seconds to allow any orca_services startup -# warnings to appear on the terminal before exiting. +# Sleep for a couple of seconds to allow any orca_services warnings to appear. sleep 5 Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in 2003-03-08 10:26:13.000000000 -0800 @@ -1,2022 +1,281 @@ -## -## -## Orca_services.pl, a log generating services usage monitor -## -## - -## -## This program logs many different services usage to a log file -## for later processing. -## - -## -## Author: Carlos Canau -## With: Jose Carlos Pereira -## - -## -## Portions adapted from Orcallator.se written by Blair Zajac -## Portions ported to perl from Orcallator.se written by Blair Zajac -## other portions adapted from several other open source scripts -## -## - -## -## Version 1.5.5.dist: 06 Nov 2000 First distribution version -## -## Version 1.5.5: 31 Oct 2000 Bug with increasing "others" in named -## -## Version 1.5.4: 31 Oct 2000 DB radiator more secure method of getting DB user/pass -## -## Version 1.5.3: 31 Oct 2000 DB radiator accounting -## -## Version 1.5.2: 30 Oct 2000 Bugs---, bugs---, ... -## -## Version 1.5.1: 27 Oct 2000 Bugs--, bugs--, ... -## -## Version 1.5.0: 27 Oct 2000 Radiator/SQL accounting -## -## Version 1.4.1: 26 Oct 2000 on/off on services -## -## Version 1.4.0.3: 25 Oct 2000 some bugs crashed -## -## Version 1.4.0: 24 Oct 2000 DNS / named added -## -## Version 1.3.10: 17 Oct 2000 1 query/5min mechanism -## -## Version 1.3.9: 12 Oct 2000 New value: mailq -## -## Version 1.2.0: 11 Aug 2000 CAC.Washington.EDU ipop3d logfile added -## -## Version 1.1.0: 09 Aug 2000 Merit Radius logfile added -## -## Version 1.0.3: 09 Aug 2000 Re-open bug fixed (?) -## -## Version 1.0.2: 27 Jul 2000 Changes in SMTP regex -## -## Version 1.0.1: 25 Jul 2000 Lots of bugs smashed. -## -## Version 1.0.0: 23 Jul 2000 First release. Just SMTP. -## -## - -## -## BUGS: -## several ?... -## - -## -## TODO: -## more services and diferent logfile reading synchronization -## code optimization and cleaning -## debugging -## can this code be GPLed ?? -## - -## -## LICENSE: -## GPL. -## (c) 2000 Carlos Canau & Jose Carlos Pereira -## - -## -## DISCLAIMER: -## you use this program at your own and complete risk -## if you don't agree with that then delete it -## - -$version = "1.5.5.dist"; - -# -# ATTENTION: you might need to edit this variables -# -$CAT="/usr/local/bin/cat"; -$ECHO="/usr/local/bin/echo"; -$TOUCH="/usr/local/bin/touch"; - -$UNAME = "/usr/bin/uname"; -$nodename = `$UNAME -n`; -chop($nodename); - -require 5.004_05; -use Fcntl; -use Getopt::Long; # option handler -use POSIX; # useful functions -use IO::Handle; -use IO::File; -use Sys::Syslog; - at PERL_USE_TIME_HIRES@ # import time from Time::HiRes - # for nanosecond precision - -$log_facility = "user"; -$log_priority = "info"; - -($progname = $0) =~ s(.*/)(); - -$SaveDay = 0; - -# put this in an option -# -# ATTENTION: you might need to edit this -# -$MAILQCMD = "/usr/bin/mailq | /usr/bin/tail -1"; - -## -## options -## -local %options; -# my $def_poll = 5; -# my $def_lines = 10; -# my $def_count = (-1); -my $def_interval = 300; # 5 minutes -my $def_dns_logfile = "/var/log/named"; -my $def_smtp_logfile = "/var/log/syslog"; -my $def_merit_radius_logfile = "/usr/local/etc/raddb/logfile"; -my $def_pop_logfile = "/var/log/ipop3d.log"; -my $def_outputdir = "@VAR_DIR@/orca_services"; -my $def_pid = "$def_outputdir/${progname}.pid"; -my $def_compress = "@COMPRESSOR@"; - -my $def_radius_auth = "/usr/local/lib/orca_services.DB.$nodename"; - -my $def_mailq = "on"; - -GetOptions("pidfile=s" => \$options{pidfile}, - "debug:s" => \$options{debug}, - "interval=i" => \$options{interval}, - "dns_logfile=s" => \$options{dns_logfile}, - "smtp_logfile=s" => \$options{smtp_logfile}, - "merit_radius_logfile=s" => \$options{merit_radius_logfile}, - "radius_db=s" => \$options{radius_db}, - "pop_logfile=s" => \$options{pop_logfile}, - "outputdir=s" => \$options{outputdir}, - "compress=s" => \$options{compress}, - "mailq=s" => \$options{mailq}, - "help" => \$options{help}, - "version" => \$options{help} - ) || usage(); -usage() if $options{help}; - -if ($options{debug}) { - if ($options{debug} ne "on") { - $debug = 0; - exit if fork; - } else { - $debug = 1; - } -} else { - $debug = 0; - exit if fork; -} - -if ($options{interval}) { - $interval = $options{interval}; -} else { - $interval = $def_interval; -} - -if ($options{compress}) { - $Compress = $options{compress}; -} else { - $Compress = $def_compress; -} - -if ($options{outputdir}) { - $OutputDir = $options{outputdir}; -} else { - $OutputDir = $def_outputdir; -} -system ("mkdir $OutputDir 2>/dev/null"); # ignore return value -system ("chmod 0755 $OutputDir 2>/dev/null"); # if you can change these - # two systems bye the perl - # syscall ... :-) -system ("mkdir $OutputDir/$nodename 2>/dev/null"); # ignore return value -system ("chmod 0755 $OutputDir/$nodename 2>/dev/null"); -if ($options{pidfile}) { - $PidFile = $options{pidfile}; -} else { - $PidFile = "$OutputDir/$nodename/${progname}.pid";; -} - -if ($options{dns_logfile}) { - $DNSFile = $options{dns_logfile}; -} else { - $DNSFile = $def_dns_logfile; -} - -if ($options{smtp_logfile}) { - $SMTPFile = $options{smtp_logfile}; -} else { - $SMTPFile = $def_smtp_logfile; -} - -if ($options{mailq}) { - $MAILQ = $options{mailq}; -} else { - $MAILQ = $def_mailq; -} - -if ($options{merit_radius_logfile}) { - $Merit_RADIUSFile = $options{merit_radius_logfile}; -} else { - $Merit_RADIUSFile = $def_merit_radius_logfile; -} - -if ($options{pop_logfile}) { - $POPFile = $options{pop_logfile}; -} else { - $POPFile = $def_pop_logfile; -} - -if ($options{radius_db}) { - $RADIUS_DB = $options{radius_db}; -### print "\n\nWARNING: radius_db option not being used via cmd line. Using default\n\n"; -### $RADIUS_DB = $def_radius_auth; -} else { - $RADIUS_DB = $def_radius_auth; -} - -## -## options -## - - - - -&logit ("ready (pid $$)"); -if (open(P, "> $PidFile")) { - print P "$$\n"; - close P; -} else { - &logit("can't save pid (can't write to \`$PidFile')"); - warn "$progname: can't save pid (can't write to \`$PidFile')\n"; -} - - - -## -## init logfiles -## -my ($dns_ino, $dns_size, $dns_ok) = (0,0,0); -if ($DNSFile !~ /^off$/i) { - $dns_ok = &init_dns ($DNSFile); # inits DNSFD -} - -my ($smtp_ino, $smtp_size, $smtp_ok) = (0,0,0); -if ($SMTPFile !~ /^off$/i) { - $smtp_ok = &init_smtp ($SMTPFile); # inits SMTPFD -} - -my ($merit_radius_ino, $merit_radius_size, $merit_radius_ok) = (0,0,0); -if ($Merit_RADIUSFile !~ /^off$/i) { - $merit_radius_ok = &init_merit_radius ($Merit_RADIUSFile); # inits RADIUSFD -} - -my ($pop_ino, $pop_size, $pop_ok) = (0,0,0); -if ($POPFile !~ /^off$/i) { - $pop_ok = &init_pop ($POPFile); # inits POPFD -} - -if ($RADIUS_DB !~ /^off$/i) { - - #check if database user/passwd is given! - if( ! -f $RADIUS_DB){ - print "Database init error: No such file: $RADIUS_DB\n"; - print "Aborting\n"; - exit; - } - - my($proto,$drv,$database,$user,$pass)= split(/:/,`$CAT $RADIUS_DB`); - - if(!$proto || !$drv || !$database || !$user || !$pass){ - print "Database init error: unable to parse $RADIUS_DB\n"; - print "Syntax must be: protocol:driver:database:user:passwd ex: DBI:oracle:ORCA:user:pass\n"; - print "Aborting\n"; - exit; - } - chomp($pass); - - if ( ($radius_ok = &init_radius("$proto:$drv:$database",$user,$pass)) ) { # inits $RADdbh - print "ERROR: Radius init failed! Aborting $radius_ok\n"; - exit; - } -} - -$print_header = 0; -$current_column = 0; - -## -## init outpufile -## -my $OutputFilename = ""; -#$outputfile_ok = &check_output ("$OutputDir/$nodename"); # inits OUTFD -# # & $OutputFilename - - -# incremental -if (defined($DNSFD)) { - &init_dns_vars (); -} - -while () { - my $outputfile_ok = 0; - my ($now, $sleep_till); - - $now = time; - $sleep_till = ($now/$interval) * $interval; - while ($sleep_till < $now + $interval*0.5) { - $sleep_till += $interval; - } - - &measure_head ($now); - - if (defined($SMTPFD)) { - &init_smtp_vars (); - } - if ($MAILQ eq "on") { - &init_mailq_vars (); - } - if (defined($Merit_RADIUSFD)) { - &init_merit_radius_vars (); - } - if (defined($POPFD)) { - &init_pop_vars (); - } - - ### call the measure routines... - &measure ($sleep_till); - - if (defined($RADdbh)) { - &put_radius (); - } - - if (defined($DNSFD)) { - &put_dns (); - } - if (defined($SMTPFD)) { - &put_smtp (); - } - if ($MAILQ eq "on") { - &put_mailq (); - } - if (defined($Merit_RADIUSFD)) { - &put_merit_radius (); - } - if (defined($POPFD)) { - &put_pop (); - } - - $outputfile_ok = &check_output ("$OutputDir/$nodename"); - - &flush_output (); - -} - -exit 0; - - - -# ---------------------------------------------------------------------------- - -sub usage { - die "Usage: $progname [options] - ($progname uses the GNU extended POSIX option format) - - --pidfile=FILE write my PID here (default: $def_pid) - --debug[=on|off] show copious debugging info (default: off) - --interval=i pooling interval in sec. (default: $def_interval) - --dns_logfile=FILE syslog from named (default: $def_dns_logfile) - --smtp_logfile=FILE syslog from sendmail (default: $def_smtp_logfile) - --merit_radius_logfile=FILE syslog from merit_radius (default: $def_merit_radius_logfile) - --radius_db=FILE file for user/passwd for DB access (default: $def_radius_auth) - --pop_logfile=FILE syslog from pop (default: $def_pop_logfile) - --outputdir=DIR write here output files (default: $def_outputdir) - --compress=COMMAND use this to compress files (default: $def_compress) - --mailq=[on|off] get mailq total requests (default: $def_mailq) - --help, --version this option summary - - Note: use filename 'off' to turn off the specific service - - This is $progname version $version - -"; -} - - -# ------------------------------------------------------------------- -# -# logit -- send MSG(s) to the syslog. -# -# usage: &logit($msg_to_log); -# - -sub logit { - local($Msg) = @_; - - &Sys::Syslog::openlog("$progname", 'cons,pid', "$log_facility"); - &Sys::Syslog::syslog("$log_priority", $Msg); - &Sys::Syslog::closelog(); -} - - -# ------------------------------------------------------------------- -# -# measure_head -- put first values -# -# usage: &measure_head($time) -# - -sub measure_head() { - my ($time) = @_; - - $now_string = strftime "%T", localtime; - put_output(" timestamp", sprintf("%10d", $time)); - put_output("locltime", $now_string); -} - - -# ---------------------------------------------------------------------- -# -# init_radius - set RADIATOR_RADIUS vars, connect to DB, calculate correct time stamp -# -# usage: &init_radius($db,$user,$pass); -# - -sub init_radius { - my ($db,$user,$pass) = @_; - - use DBI; - - $RADdbh = DBI->connect($db,$user,$pass); - if(!$RADdbh) { - print "Connect error $DBI::errstr\n"; - return 1; - } - - #get the lower time limit that our queries will start from - #get a "history" of 5minutes - - $radius_base_ts= time - 5*60; - - #get accumulated values for what we want to measure: - -#jcp correct this please! -## my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, undef) = localtime($radius_base_ts); -## $year += 1900; -## $mon++; - - -## $BASE_ACCUM_radius_DB="/var/orca/orca_services/$nodename"; -## $ACCUM_radius_DB= "$BASE_ACCUM_radius_DB/radiatorRadiusAccum.$year$mon.txt"; -## `$TOUCH $ACCUM_radius_DB`; - -## $radius_inc_time ||= 0; -## $radius_inc_sessions ||= 0; - -#END jcp correct this please! - - return 0; -} - - -# ------------------------------------------------------------------- -# -# init_dns - set DNS vars, open the logfile and seek into the end. -# -# usage: &init_dns($dns_logfile); -# - -sub init_dns { - my ($filename) = @_; - - if ($filename) { - $DNSFD = new IO::File "$filename", "r"; - if (defined($DNSFD)) { - my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($DNSFD); - if (!$dev) { - &logit ("can't stat $filename"); - warn "$progname: can't stat $filename\n"; - return 1; - } - $dns_ino = $ino; - $dns_size = $size; - $seek_ok = seek($DNSFD, 0, SEEK_END); - if (!$seek_ok) { - &logit ("can't seek into EOF on $filename"); - warn "$progname: can't seek into EOF on $filename\n"; - return 2; - } - } else { - &logit ("can't open $filename"); - warn "$progname: can't open $filename\n"; - return 3; - } - } - &init_dns_vars (); - return 0; -} - -# ------------------------------------------------------------------- -# -# init_smtp - set SMTP vars, open the logfile and seek into the end. -# -# usage: &init_smtp($smtp_logfile); -# - -sub init_smtp { - my ($filename) = @_; - - if ($filename) { - $SMTPFD = new IO::File "$filename", "r"; - if (defined($SMTPFD)) { - my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($SMTPFD); - if (!$dev) { - &logit ("can't stat $filename"); - warn "$progname: can't stat $filename\n"; - return 1; - } - $smtp_ino = $ino; - $smtp_size = $size; - $seek_ok = seek($SMTPFD, 0, SEEK_END); - if (!$seek_ok) { - &logit ("can't seek into EOF on $filename"); - warn "$progname: can't seek into EOF on $filename\n"; - return 2; - } - } else { - &logit ("can't open $filename"); - warn "$progname: can't open $filename\n"; - return 3; - } - } - &init_smtp_vars (); - return 0; -} - - -# ---------------------------------------------------------------------- -# -# init_merit_radius - set Merit_RADIUS vars, open the logfile and seek into the end. +# orca_services.pl, a log generating services usage monitor # -# usage: &init_merit_radius($radius_logfile); +# This program logs many different services usage to a log file +# for later processing. # - -sub init_merit_radius { - my ($filename) = @_; - - if ($filename) { - $Merit_RADIUSFD = new IO::File "$filename", "r"; - if (defined($Merit_RADIUSFD)) { - my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($Merit_RADIUSFD); - if (!$dev) { - &logit ("can't stat $filename"); - warn "$progname: can't stat $filename\n"; - return 1; - } - $merit_radius_ino = $ino; - $merit_radius_size = $size; - $seek_ok = seek($Merit_RADIUSFD, 0, SEEK_END); - if (!$seek_ok) { - &logit ("can't seek into EOF on $filename"); - warn "$progname: can't seek into EOF on $filename\n"; - return 2; - } - } else { - &logit ("can't open $filename"); - warn "$progname: can't open $filename\n"; - return 3; - } - } - &init_merit_radius_vars (); - return 0; -} - - -# ---------------------------------------------------------------------- +# Author: Sjaak Westdijk # -# init_pop - set POP vars, open the logfile and seek into the end. +# thanks to : +# Carlos Canau +# Jose Carlos Pereira # -# usage: &init_pop($pop_logfile); +# Most code is adapted from Orca_servcies 1.X written by Carlos Canau # - -sub init_pop { - my ($filename) = @_; - - if ($filename) { - $POPFD = new IO::File "$filename", "r"; - if (defined($POPFD)) { - my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($POPFD); - if (!$dev) { - &logit ("can't stat $filename"); - warn "$progname: can't stat $filename\n"; - return 1; - } - $pop_ino = $ino; - $pop_size = $size; - $seek_ok = seek($POPFD, 0, SEEK_END); - if (!$seek_ok) { - &logit ("can't seek into EOF on $filename"); - warn "$progname: can't seek into EOF on $filename\n"; - return 2; - } - } else { - &logit ("can't open $filename"); - warn "$progname: can't open $filename\n"; - return 3; - } - } - &init_pop_vars (); - return 0; -} - - -# ------------------------------------------------------------------- +# Portions ported to perl from Orcallator.se written by Blair Zajac +# other portions adapted from several other open source scripts # -# check_output - set outputfile vars, open the outputfile. # -# usage: &check_output($outputdir); +# BUGS: # - -sub check_output { - my ($outputdir) = @_; - $sec1=$min1=$hour1=$mday1=$mon1=$year1=$wday1=$yday1=$isdst1 = 0; - - ($sec1,$min1,$hour1,$mday1,$mon1,$year1,$wday1,$yday1,$isdst1) = localtime(); - - if ($mday1 != $SaveDay) { - # First time or day has changed, start new logfile. - if (OUTFD->opened) { - close(OUTFD); # ignore error - } - if (($Compress) && ($SaveDay)) { # just on day change - if ($OutputFilename) { - &logit ("compressing $OutputFilename"); - system ("$Compress $OutputFilename"); # ignore error ?? - } - } - - $now_string = strftime "%Y-%m-%d", localtime; - - $OutputFilename = "$outputdir/percol-$now_string"; - - if (!open (OUTFD, ">>$OutputFilename")) { - &logit ("can't open outputfile $OutputFilename"); - die "$progname: can't open outputfile $OutputFilename\n"; - } - - $SaveDay = $mday1; - - $print_header = 1; - } - - return 0; -} - - -# ------------------------------------------------------------------- # -# flush_output - dumps line into outputfile +# TODO: # -# usage: &flush_output(); # - -sub flush_output() { - - if ($print_header) { - &print_columns(\@col_comment); - $print_header = 0; - } - &print_columns(\@col_data); - $current_column = 0; -} - -# ------------------------------------------------------------------- +# LICENSE: +# GPL. +# (c) 2003 Sjaak Westdijk +# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira # -# Send the stored columns of information to the output. # -# usage: &print_columns( \@array ); +# DISCLAIMER: +# you use this program at your own and complete risk +# if you don't agree with that then delete it # -sub print_columns() { - my ($ref) = @_; - - @col = @$ref; - - for ($i=0; $i < $current_column; $i++) { - printf OUTFD "%s", $col[$i]; - if ($i != $current_column - 1) { - printf OUTFD " "; - } - } - printf OUTFD "\n"; - - OUTFD->flush; +# Set the location of the Orca_Services modules. +BEGIN { + my $prefix = "@prefix@"; + my $exec_prefix = "@exec_prefix@"; + my $libdir = "@libdir@"; + unshift(@INC, $libdir); } -# ------------------------------------------------------------------- -# -# Add one column of comments and data to the buffers. # -# usage: &put_output( $comment, $data ); +# which standard modules to use # +require 5.004; +use Fcntl; +use Getopt::Long; # option handler +use POSIX; # useful functions +use IO::Handle; +use IO::File; -sub put_output() { - my ($comment, $data) = @_; - - printf "OUT: --%s-- %s\n", $comment, $data if $debug; - $col_comment[$current_column] = $comment; - $col_data[$current_column] = $data; - $current_column++; -} - - -# ------------------------------------------------------------------- -# -# Cycle several measurables # -# usage: &measure( $sleep_till ); +# which Orca_Services modules to use # +use Orca_Services::Vars; +use Orca_Services::Utils; +use Orca_Services::Output; +use Orca_Services::Sendmail; +#use Orca_Services::Dns; +use Orca_Services::Mailq; +use Orca_Services::Http; +#use Orca_Services::Nntp; +#use Orca_Services::Pop; +use Orca_Services::Slapd; +#use Orca_Services::MeritRad; +#use Orca_Services::Radius; -sub measure () { - my ($sleep_till) = @_; - - - $now = time; - while ($now < $sleep_till) { - - printf "SMTP: sleeping for 5\n" if $debug; - sleep(5); - $now = time; - - # measure... - if (defined($SMTPFD)) { - &measure_smtp(); - } - if (defined($Merit_RADIUSFD)) { - &measure_merit_radius(); - } - if (defined($POPFD)) { - &measure_pop(); - } - # - # stats only once an hour... but better not have logfile reading picks - # - if (defined($DNSFD)) { - &measure_dns(); - } - - # measure... - - $now = time; - - } ## while ($now < $sleep_till) - # put in the end... calls external prog. - if ($MAILQ eq "on") { - &measure_mailq(); - } - - if (defined($RADdbh)) { - &measure_radius(); - } - - return 0; -} - - -# ------------------------------------------------------------------- -# -# Get values for smtp columns # -# usage: &measure_smtp( ); +# See if the modules load succesfully # - -sub measure_smtp () { - - - #################################### insert bail out for too much - #################################### time spent ?? - $buf = <$SMTPFD>; - while ($buf) { - ## process line read and check for eof - if ($buf) { - &process_smtp_line ($buf); - } - if ($SMTPFD->eof) { - printf "SMTP: eof on $SMTPFile\n" if $debug; - last; # get out of while($buf) - } - $buf = <$SMTPFD>; - } ## while ($buf) - - - # test for file change via different inode or filesize decrease - $dev = $ino = $mode = $nlink = $uid = $gid = $rdev = - $size = $atime = $mtime = $ctime = $blksize = $blocks = ''; - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($SMTPFile); - if (!$dev) { - &logit ("can't stat $SMTPFile"); - warn "$progname: can't stat $SMTPFile\n"; - return 1; - } - printf "SMTPFD: smtp_ino=%s vs. ino=%s\tsmtp_size=%s vs. size=%s\n", $smtp_ino, $ino, $smtp_size, $size if $debug; - if (($smtp_ino != $ino) || ($smtp_size > $size)) { - undef $SMTPFD; - printf "SMTP: file change on $SMTPFile\n" if $debug; - $SMTPFD = new IO::File "$SMTPFile", "r"; - if (!defined ($SMTPFD)) { - &logit ("can't re-open $SMTPFile"); - warn "$progname: can't re-open $SMTPFile\n"; - $smtp_ino = $smtp_size = 0; - return 2; +if ($Options{debug}) { + while ( ($service, $params) = each %Services) { + print "$service:\n"; + while ( ($par, $val) = each %$params) { + print "\t$par=$val\n"; + } + print "\n"; } - $smtp_ino = $ino; - $smtp_size = $size; - } - - return 0; } - -# ------------------------------------------------------------------- -# -# init smtp vars # -# usage: &init_smtp_vars(); +# Get the options # +GetOptions(%PrgOptions) || usage(); +usage() if $Options{help}; -sub init_smtp_vars() { - $smtp_froms = 0; - $smtp_MaxSize = 0; - $smtp_sizes = 0; - - $smtp_MaxSeconds = 0; - $smtp_seconds = 0; - $smtp_sent = 0; - - $smtp_fail = 0; - $smtp_retries = 0; - $smtp_queued = 0; - $smtp_t_or_f = 0; - - $smtp_check_mail = 0; - $smtp_check_rcpt = 0; - $smtp_notifies = 0; - $smtp_dsns = 0; - $smtp_undefs = 0; -} - - -# ------------------------------------------------------------------- # -# Parse smtp log line +# Look if the options succesfully set # -# usage: &process_smtp_line ($buf); -# - -sub process_smtp_line () { - my ($line) = @_; - - - if ($line !~ / sendmail\[\d+\]: /) { - return 0; - } - - - # from -# Jul 16 03:22:12 server123 sendmail[4977]: e6G2M7O04977: from=, size=981, class=0, nrcpts=1, msgid=<200007152000.VAA24441 at server321.domain.com>, proto=ESMTP, daemon=MTA, relay=server321.domain.com [10.0.0.65] -# 0 Month, 1 Day, 2 hh:mm:ss, 3 nodename, 4 sendmail[NNNNN]:, 5 msg-id:, 6 from=FROM\,, 7 size=NNNNN\,, ... - if ($line =~ /: from=.*, size=(\d+)/i) { - $smtp_froms ++; - $size = $1; - $smtp_sizes += $size; - if ($size > $smtp_MaxSize) { - $smtp_MaxSize = $size; +if ($Options{debug}) { + while ( ($options) = each %PrgOptions) { + print "$options => $PrgOptions{$options}\n"; } - printf "SMTP_FROM: %s", $line if $debug; -# printf "smtp_froms=%s, size=%s, smtp_sizes=%s, smtp_MaxSize=%s\n", $smtp_froms, $size, $smtp_sizes, $smtp_MaxSize if $debug; - return 0; - } + print "\n"; - # to -#Jul 16 03:26:32 server123 sendmail[5060]: e6G2PqO05058: to=, delay=00:00:35, xdelay=00:00:35, mailer=esmtp, pri=120745, relay=server321.domain.com. [10.0.0.65], dsn=2.0.0, stat=Sent (DAA19487 Message accepted for delivery) -#Jul 16 03:15:16 server123 sendmail[4828]: e6EBXrO12616: to=, delay=1+14:41:13, xdelay=00:00:55, mailer=esmtp, pri=3001977, relay=mail.domain2.pt. [11.0.0.130], dsn=4.0.0, stat=Deferred: Connection refused by mail.domain2.pt. -#Jul 16 22:31:20 server123 sendmail[881]: e6GLUxP00881: to=, delay=00:00:11, xdelay=00:00:11, mailer=esmtp, pri=37973, relay=mail.domain4.pt. [12.0.0.15], dsn=5.0.0, stat=Service unavailable -#Jul 24 18:33:05 server999 sendmail[15932]: SAA15929: to=, ctladdr= (16306/1984), delay=00:00:10, xdelay=00:00:09, mailer=esmtp, relay=mail.domain4.pt. [13.0.0.3], stat=Sent (Ok) - if ($line =~ /: to=/) { - if ($line =~ /, delay=(\d+)*\+*(\d+):(\d+):(\d+), .*, stat=Sent/i) { - $seconds = 86400*$1 + 3600*$2 + 60*$3 + $4; - - $smtp_seconds += $seconds; - if ($seconds > $smtp_MaxSeconds) { - $smtp_MaxSeconds = $seconds; - } - $smtp_sent ++; - printf "SMTP_SENT: %s", $line if $debug; -# printf "seconds=%s, smtp_seconds=%s, smtp_MaxSeconds=%s, smtp_sent=%s\n", $seconds, $smtp_seconds, $smtp_MaxSeconds, $smtp_sent if $debug; - return 0; - } - if ($line =~ /, dsn=5/i) { - $smtp_fail++; - printf "SMTP_FAIL: %s", $line if $debug; -# printf "smtp_fail=%s\n", $smtp_fail if $debug; - return 0; - } - if (($line =~ /, dsn=4/i) || ($line =~ /, stat=Deferred:/i)) { - $smtp_retries++; - printf "SMTP_RETRY: %s", $line if $debug; -# printf "smtp_retries=%s\n", $smtp_retries if $debug; - return 0; + while ( ($options) = each %Options) { + print "$options => $Options{$options}\n"; } - if ($line =~ /, stat=queued/i) { - $smtp_queued++; - printf "SMTP_QUEUE: %s", $line if $debug; -# printf "smtp_queued=%s\n", $smtp_queued if $debug; - return 0; - } - $smtp_t_or_f++; - printf "SMTP_T_OR_F: %s", $line if $debug; -# printf "smtp_t_or_f=%s\n", $smtp_t_or_f if $debug; - return 0; - } - - # ruleset=check_mail -#Jul 16 22:24:43 server123 sendmail[604]: e6GLNMO00604: ruleset=check_mail, arg1=, relay=server321.domain.com [10.0.0.65], reject=451 4.1.8 ... Domain of sender address Mary.Wilson at domain10.pt does not resolve - if ($line =~ /: ruleset=check_mail, /i) { - $smtp_check_mail ++; - printf "SMTP_CHECK_MAIL: %s", $line if $debug; -# printf "smtp_check_mail=%s\n", $smtp_check_mail if $debug; - return 0; - } - - # ruleset=check_rcpt -#Jul 19 16:54:55 server123 sendmail[11437]: e6JFsoO11437: ruleset=check_rcpt, arg1=, relay=a.b.c.net [6.1.6.7], reject=550 5.7.1 ... Relaying denied -#Jul 19 17:34:54 server123 sendmail[12479]: e6JGYKO12479: ruleset=check_rcpt, arg1=, relay=individual [10.0.0.67], reject=450 4.7.1 ... Can not check MX records for recipient host mail.soso.domain8888.pt - if ($line =~ /: ruleset=check_rcpt, /i) { - $smtp_check_rcpt ++; - printf "SMTP_CHECK_RCPT: %s", $line if $debug; -# printf "smtp_check_rcpt=%s\n", $smtp_check_rcpt if $debug; - return 0; - } - - # postmaster notify: -#Jul 17 05:30:04 server123 sendmail[10016]: e6EKWRO24933: e6H401o10016: postmaster notify: Cannot send message within 2 days - if ($line =~ /: postmaster notify: /i) { - $smtp_notifies ++; - printf "SMTP_NOTIFIES: %s", $line if $debug; -# printf "smtp_notifies=%s\n", $smtp_notifies if $debug; - return 0; - } - - # DSN -#Jul 18 22:28:58 server123 sendmail[7172]: e6ILQlO07170: e6ILSwO07172: DSN: Service unavailable -#Jul 19 14:38:00 server123 sendmail[1846]: e6HBWSO21997: e6JDU0t01846: DSN: Cannot send message within 2 days -#Jul 19 17:33:51 server123 sendmail[12272]: e6JGTlO12270: e6JGXpO12272: DSN: Return receipt - if ($line =~ /: DSN: /i) { - $smtp_dsns ++; - printf "SMTP_DSN: %s", $line if $debug; -# printf "smtp_dsns=%s\n", $smtp_dsns if $debug; - return 0; - } - - $smtp_undefs ++; - printf "SMTP_UNDEF: %s", $line if $debug; -# printf "smtp_undefs=%s\n", $smtp_undefs if $debug; - return 0; -} - - -# ------------------------------------------------------------------- -# -# Put the smtp values for output -# -# usage: &put_smtp(); -# - -sub put_smtp() { - - &put_output("smtp_from", sprintf("%8.2f", $smtp_froms)); - &put_output("smtp_tops", sprintf("%8.2f", $smtp_MaxSize)); - if ($smtp_froms) { - &put_output("smtp_sizes", sprintf("%8.2f", $smtp_sizes/$smtp_froms)); - } else { - &put_output("smtp_sizes", sprintf("%8.2f", 0)); - } - &put_output("smtp_sent", sprintf("%8.2f", $smtp_sent)); - &put_output("smtp_maxd", sprintf("%8.2f", $smtp_MaxSeconds)); - if ($smtp_sent) { - &put_output("smtp_delay", sprintf("%8.2f", $smtp_seconds/$smtp_sent)); - } else { - &put_output("smtp_delay", sprintf("%8.2f", 0)); - } - &put_output("smtp_fail", sprintf("%8.2f", $smtp_fail)); - &put_output("smtp_rtrs", sprintf("%8.2f", $smtp_retries)); - &put_output("smtp_queued", sprintf("%8.2f", $smtp_queued)); - &put_output("smtp_torf", sprintf("%8.2f", $smtp_t_or_f)); - &put_output("smtp_c_ml", sprintf("%8.2f", $smtp_check_mail)); - &put_output("smtp_c_rt", sprintf("%8.2f", $smtp_check_rcpt)); - &put_output("smtp_ntfs", sprintf("%8.2f", $smtp_notifies)); - &put_output("smtp_dsns", sprintf("%8.2f", $smtp_dsns)); - - &put_output("smtp_undf", sprintf("%8.2f", $smtp_undefs)); - - return 0; + print "\n"; } - -# ------------------------------------------------------------------- -# -# Get values for mailq columns -# -# usage: &measure_mailq( ); -# - -sub measure_mailq () { - - open (MFD, "$MAILQCMD |"); - $line = ; - close (MFD); - - if ($line =~ /(\d+)/i) { - $mailq_t = $1; - } else { - $mailq_t = 0; - } - $mailq_total += $mailq_t; - - return 0; -} - - -# ------------------------------------------------------------------- -# -# init mailq vars -# -# usage: &init_mailq_vars(); -# - -sub init_mailq_vars() { - $mailq_total = 0; +if ($Options{debug} == 0) { + exit if fork; } - -# ------------------------------------------------------------------- # -# Put the mailq values for output +# Create the ouput dir structure # -# usage: &put_mailq(); -# - -sub put_mailq() { - - &put_output("mailq_total", sprintf("%8.2f", $mailq_total)); +system ("mkdir $Options{outputdir} 2>/dev/null"); # ignore return value +system ("chmod 0755 $Options{outputdir} 2>/dev/null"); # if you can change these + # two systems bye the perl + # syscall ... :-) +system ("mkdir $Options{outputdir}/$nodename 2>/dev/null"); # ignore return value +system ("chmod 0755 $Options{outputdir}/$nodename 2>/dev/null"); - return 0; +&logit ("ready (pid $$)"); +if (open(P, "> $Options{pidfile}")) { + print P "$$\n"; + close P; +} else { + &logit("can't save pid (can't write to \`$Options{pidfile}')"); + warn "$progname: can't save pid (can't write to \`$Options{pidfile}')\n"; } -# ------------------------------------------------------------------- -# -# init merit_radius vars -# -# usage: &init_merit_radius_vars(); -# - -sub init_merit_radius_vars() { - $merit_radius_auth = 0; - $merit_radius_auth_ok = 0; - $merit_radius_auth_nok = 0; - - $merit_radius_acct_start = 0; - $merit_radius_acct_stop = 0; - - $merit_radius_rem_auth = 0; - $merit_radius_rem_auth_ok = 0; - $merit_radius_rem_auth_nok = 0; - - $merit_radius_undefs = 0; -} - -# ------------------------------------------------------------------- # -# Get values for merit_radius columns +# init the services # -# usage: &measure_merit_radius( ); -# - -sub measure_merit_radius () { - - - #################################### insert bail out for too much - #################################### time spent ?? - $buf = <$Merit_RADIUSFD>; - while ($buf) { - ## process line read and check for eof - if ($buf) { - &process_merit_radius_line ($buf); - } - if ($Merit_RADIUSFD->eof) { - printf "Merit_RADIUS: eof on $Merit_RADIUSFile\n" if $debug; - last; # get out of while($buf) - } - $buf = <$Merit_RADIUSFD>; - } ## while ($buf) - - - # test for file change via different inode or filesize decrease - $dev = $ino = $mode = $nlink = $uid = $gid = $rdev = - $size = $atime = $mtime = $ctime = $blksize = $blocks = ''; - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($Merit_RADIUSFile); - if (!$dev) { - &logit ("can't stat $Merit_RADIUSFile"); - warn "$progname: can't stat $Merit_RADIUSFile\n"; - return 1; - } - printf "Merit_RADIUSFD: merit_radius_ino=%s vs. ino=%s\tmerit_radius_size=%s vs. size=%s\n", $merit_radius_ino, $ino, $merit_radius_size, $size if $debug; - if (($merit_radius_ino != $ino) || ($merit_radius_size > $size)) { - undef $Merit_RADIUSFD; - printf "Merit_RADIUS: file change on $Merit_RADIUSFile\n" if $debug; - $Merit_RADIUSFD = new IO::File "$Merit_RADIUSFile", "r"; - if (!defined ($Merit_RADIUSFD)) { - &logit ("can't re-open $Merit_RADIUSFile"); - warn "$progname: can't re-open $Merit_RADIUSFile\n"; - $merit_radius_ino = $merit_radius_size = 0; - return 2; +print "Initializing : "; +while ( ($service) = each %Services) { + if ($Services{$service}{File} !~ /^off$/i) { + my $func= $Services{$service}{Init}; + if ($func eq "") { + next; + } + $Services{$service}{Ok} = &$func($Services{$service}{File}); } - $merit_radius_ino = $ino; - $merit_radius_size = $size; - } - - return 0; -} - - -# ------------------------------------------------------------------- -# -# Parse merit_radius log line -# -# usage: &process_merit_radius_line ($buf); -# - -sub process_merit_radius_line () { - my ($line) = @_; - - -### AUTH RECEIVED -# Mon Jul 24 00:02:16 2000: Received-Authentication: 214/28832 'luser' from 13.12.15.17 port 25 PPP - - if ($line =~ /: Received-Authentication: .* from /i) { - $merit_radius_auth ++; - printf "Merit_RADIUS_AUTH: %s", $line if $debug; - printf "merit_radius_auth=%s\n", $merit_radius_auth if $debug; - return 0; - } - -### AUTH OK -# Mon Jul 24 00:02:16 2000: Authentication: 214/28832 'luser2' from 13.12.25.17 port 35 PPP - OK -- total 0, holding 0 - - if ($line =~ /: Authentication: .* from .* OK /i) { - $merit_radius_auth_ok ++; - printf "Merit_RADIUS_AUTH_OK: %s", $line if $debug; - printf "merit_radius_auth_ok=%s\n", $merit_radius_auth_ok if $debug; - return 0; - } - -### AUTH FAILED -# Mon Jul 24 01:49:20 2000: Authentication: 201/29347 'luser3' from 13.16.19.20 port 2 PPP - FAILED Authentication failure -- total 0, holding 0 - - if ($line =~ /: Authentication: .* from .* FAILED Authentication /i) { - $merit_radius_auth_nok ++; - printf "Merit_RADIUS_AUTH_NOK: %s", $line if $debug; - printf "merit_radius_auth_nok=%s\n", $merit_radius_auth_nok if $debug; - return 0; - } - -### ACCT START RECEIVED -# Mon Jul 24 00:02:16 2000: Received-Accounting: 215/8376 'luser4' from 13.16.15.17 port 35 $"5200DB70" PPP/13.16.19.25 Start -### ACCT STOP RECEIVED -# Mon Jul 24 00:02:19 2000: Received-Accounting: 176/8377 'luser5' from 13.16.11.18 port 1 $"040065AE" PPP/13.16.24.22 Stop/User-Request -# Wed Aug 9 16:55:15 2000: getpwnam: good line for luser6 on file - if ( ($line =~ /: Received-Accounting: .* from /i) || - ($line =~ /: getpwnam: good line for /i) ){ - printf "Merit_RADIUS_IGNORE: %s", $line if $debug; - return 0; - } - -### ACCT START OK -# Mon Jul 24 00:02:16 2000: Accounting: 215/8376 'luser6' from 13.16.15.17 port 35 $"5200DB70" PPP/13.16.19.24 Start - OK -- total 0, holding 0 - - if ($line =~ /: Accounting: .* from .* Start - OK /i) { - $merit_radius_acct_start ++; - printf "Merit_RADIUS_ACCT_START: %s", $line if $debug; - printf "merit_radius_acct_start=%s\n", $merit_radius_acct_start if $debug; - return 0; - } - -### ACCT STOP OK -# Mon Jul 24 00:02:19 2000: Accounting: 176/8377 'luser7' from 13.16.11.18 port 1 $"040065AE" PPP/13.16.24.22 Stop/User-Request - OK -- total 0, holding 0 - - if ($line =~ /: Accounting: .* from .* Stop.* OK /i) { - $merit_radius_acct_stop ++; - printf "Merit_RADIUS_ACCT_STOP: %s", $line if $debug; - printf "merit_radius_acct_stop=%s\n", $merit_radius_acct_stop if $debug; - return 0; - } - -### REMOTE AUTH RECEIVED -# Mon Jul 24 20:53:38 2000: Received-AUTHENTICATE: 167/44566 'luser9 at realm.com' via some.host.com from some.nas.com port 6 PPP - - if ($line =~ /: Received-AUTHENTICATE: .* via .* from /i) { - $merit_radius_rem_auth ++; - printf "Merit_RADIUS_REM_AUTH: %s", $line if $debug; - printf "merit_radius_rem_auth=%s\n", $merit_radius_rem_auth if $debug; - return 0; - } - -### REMOTE AUTH OK -# Mon Jul 24 20:53:38 2000: AUTHENTICATE: 167/44566 'luser9 at realm.com' via some.host.com from some.nas.com port 6 PPP - OK -- total 0, holding 0 - - if ($line =~ /: AUTHENTICATE: .* via .* from .* OK /i) { - $merit_radius_rem_auth_ok ++; - printf "Merit_RADIUS_REM_AUTH_OK: %s", $line if $debug; - printf "merit_radius_rem_auth_ok=%s\n", $merit_radius_rem_auth_ok if $debug; - return 0; - } - -### REMOTE AUTH FAILED -# Mon Jul 24 14:05:56 2000: AUTHENTICATE: 230/37578 'luser9 at realm.com' via some.host.com from i-Pass VNAS\0\0\0\0 port 1 - FAILED Authentication failure -- total 0, holding 0 - - if ($line =~ /: AUTHENTICATE: .* via .* from .* FAILED Authentication /i) { - $merit_radius_rem_auth_nok ++; - printf "Merit_RADIUS_REM_AUTH_NOK: %s", $line if $debug; - printf "merit_radius_rem_auth_nok=%s\n", $merit_radius_rem_auth_nok if $debug; - return 0; - } - - - $merit_radius_undefs ++; - printf "Merit_RADIUS_UNDEF: %s", $line if $debug; - printf "merit_radius_undefs=%s\n", $merit_radius_undefs if $debug; - return 0; -} - - -# ------------------------------------------------------------------- -# -# Put the merit_radius values for output -# -# usage: &put_merit_radius(); -# - -sub put_merit_radius() { - - &put_output("merit_radius_auth", sprintf("%8.2f", $merit_radius_auth)); - &put_output("merit_radius_auth_ok", sprintf("%8.2f", $merit_radius_auth_ok)); - &put_output("merit_radius_auth_nok", sprintf("%8.2f", $merit_radius_auth_nok)); - &put_output("merit_radius_acct_start", sprintf("%8.2f", $merit_radius_acct_start)); - &put_output("merit_radius_acct_stop", sprintf("%8.2f", $merit_radius_acct_stop)); - &put_output("merit_radius_rem_auth", sprintf("%8.2f", $merit_radius_rem_auth)); - &put_output("merit_radius_rem_auth_ok", sprintf("%8.2f", $merit_radius_rem_auth_ok)); - &put_output("merit_radius_rem_auth_nok", sprintf("%8.2f", $merit_radius_rem_auth_nok)); - - &put_output("merit_radius_undefs", sprintf("%8.2f", $merit_radius_undefs)); - - return 0; -} - - - -# ------------------------------------------------------------------- -# -# init pop vars -# -# usage: &init_pop_vars(); -# - -sub init_pop_vars() { - $pop_connect = 0; - $pop_login = 0; - $pop_logout = 0; - - $pop_failure = 0; - $pop_refused = 0; - - $pop_net_error = 0; - $pop_local_error = 0; - - $pop_undefs = 0; + print "$service($Services{$service}{Ok}) "; } +print "\n"; +while () { + my $outputfile_ok = 0; + my ($now, $sleep_till); -# ------------------------------------------------------------------- -# -# Get values for pop columns -# -# usage: &measure_pop( ); -# - -sub measure_pop () { - - - #################################### insert bail out for too much - #################################### time spent ?? - $buf = <$POPFD>; - while ($buf) { - ## process line read and check for eof - if ($buf) { - &process_pop_line ($buf); - } - if ($POPFD->eof) { - printf "POP: eof on $POPFile\n" if $debug; - last; # get out of while($buf) - } - $buf = <$POPFD>; - } ## while ($buf) - - - # test for file change via different inode or filesize decrease - $dev = $ino = $mode = $nlink = $uid = $gid = $rdev = - $size = $atime = $mtime = $ctime = $blksize = $blocks = ''; - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($POPFile); - if (!$dev) { - &logit ("can't stat $POPFile"); - warn "$progname: can't stat $POPFile\n"; - return 1; - } - printf "POPFD: pop_ino=%s vs. ino=%s\tpop_size=%s vs. size=%s\n", $pop_ino, $ino, $pop_size, $size if $debug; - if (($pop_ino != $ino) || ($pop_size > $size)) { - undef $POPFD; - printf "POP: file change on $POPFile\n" if $debug; - $POPFD = new IO::File "$POPFile", "r"; - if (!defined ($POPFD)) { - &logit ("can't re-open $POPFile"); - warn "$progname: can't re-open $POPFile\n"; - $pop_ino = $pop_size = 0; - return 2; + $now = time; + $sleep_till = ($now/$Options{interval}) * $Options{interval}; + while ($sleep_till < $now + $Options{interval}*0.5) { + $sleep_till += $Options{interval}; } - $pop_ino = $ino; - $pop_size = $size; - } - - return 0; -} - - -# ------------------------------------------------------------------- -# -# Parse pop log line -# -# usage: &process_pop_line ($buf); -# - -sub process_pop_line () { - my ($line) = @_; - - if ($line !~ / ipop3d\[\d+\]: /) { - return 0; - } + &measure_head ($now); -### connect -# Aug 11 07:01:50 host1 ipop3d[13929]: connect from 14.5.8.10 - - if ($line =~ /: connect from /i) { - $pop_connect ++; - printf "POP_CONNECT: %s", $line if $debug; - printf "pop_connect=%s\n", $pop_connect if $debug; - return 0; - } - -### login + auth -# Aug 11 07:01:57 host1 ipop3d[13928]: Login user=luser2 host=host.domain.pt [13.16.6.27] nmsgs=0/0 -# Aug 11 07:02:06 host1 ipop3d[13936]: Auth user=luser3 host=2-4-4.domain.pt [13.16.2.18] nmsgs=0/0 - - if ( ($line =~ /: Login user=/i) || - ($line =~ /: Auth user=/i) ) { - $pop_login ++; - printf "POP_LOGIN: %s", $line if $debug; - printf "pop_login=%s\n", $pop_login if $debug; - return 0; - } - -### logout -# Aug 11 07:01:50 host1 ipop3d[13929]: Logout user=luser4 host=[14.6.8.10] nmsgs=0 ndele=0 -# Aug 11 11:20:24 host1 ipop3d[1866]: Autologout user=luser5 host=3-0-0.domain.pt [13.16.1.18] - - if ($line =~ /: .*[lL]ogout user=/i) { - $pop_logout ++; - printf "POP_LOGOUT: %s", $line if $debug; - printf "pop_LOGOUT=%s\n", $pop_logout if $debug; - return 0; - } - -### failure -# Aug 11 09:19:19 host1 ipop3d[22171]: Login failure user=luser44 host=4-0-0.domain.pt [13.16.12.1] -# Aug 11 09:19:22 host1 ipop3d[22171]: AUTHENTICATE LOGIN failure host=4-0-0.domain.pt [13.16.12.1] -# Aug 11 09:47:47 host1 ipop3d[25308]: AUTHENTICATE luser323 failure host=[13.12.24.24] - - if ($line =~ / failure /i) { - $pop_failure ++; - printf "POP_FAILURE: %s", $line if $debug; - printf "pop_failure=%s\n", $pop_failure if $debug; - return 0; - } - -### refused -# Aug 11 13:32:14 host1 ipop3d[28886]: refused connect from 13.17.8.28 - - if ($line =~ /: refused connect from /i) { - $pop_refused ++; - printf "POP_REFUSED: %s", $line if $debug; - printf "pop_refused=%s\n", $pop_refused if $debug; - return 0; - } - -### local_error -# Aug 11 11:50:36 host1 ipop3d[13132]: Error opening or locking INBOX user=luser10 host=3-4-3.domain.pt [13.16.4.7] - - if ($line =~ /: Error opening or locking INBOX user=/i) { - $pop_local_error ++; - printf "POP_LOCAL_ERROR: %s", $line if $debug; - printf "pop_local_error=%s\n", $pop_local_error if $debug; - return 0; - } - -### net_error -# Aug 11 07:36:14 host1 ipop3d[15759]: Command stream end of file while reading line user=luser234 host=9-9-9-domain.pt [13.16.4.5] -# Aug 11 09:50:09 host1 ipop3d[24960]: Connection reset by peer while reading line user=luser555 host=[12.5.19.16] -# Aug 11 12:15:01 host1 ipop3d[16601]: Connection timed out while reading line user=luser7985 host=4-5-6.domain.pt [13.16.1.15] - - if ( ($line =~ /: Command stream end of file while reading line user=/i) || - ($line =~ /: Connection reset by peer while reading line user=/i) || - ($line =~ /: Connection timed out while reading line user=/i) ){ - $pop_net_error ++; - printf "POP_NET_ERROR: %s", $line if $debug; - printf "pop_net_error=%s\n", $pop_net_error if $debug; - return 0; - } - - - $pop_undefs ++; - printf "POP_UNDEF: %s", $line if $debug; - printf "pop_undefs=%s\n", $pop_undefs if $debug; - return 0; -} - - -# ------------------------------------------------------------------- -# -# Put the pop values for output -# -# usage: &put_pop(); -# - -sub put_pop() { - - &put_output("pop_connect", sprintf("%8.2f", $pop_connect)); - &put_output("pop_login", sprintf("%8.2f", $pop_login)); - &put_output("pop_logout", sprintf("%8.2f", $pop_logout)); - - &put_output("pop_failure", sprintf("%8.2f", $pop_failure)); - &put_output("pop_refused", sprintf("%8.2f", $pop_refused)); - - &put_output("pop_net_error", sprintf("%8.2f", $pop_net_error)); - &put_output("pop_local_error", sprintf("%8.2f", $pop_local_error)); - - &put_output("pop_undefs", sprintf("%8.2f", $pop_undefs)); - - return 0; -} - - -# ------------------------------------------------------------------- -# -# Get values for radiator radius columns -# -# usage: &measure_radius( ); -# - -sub measure_radius () { - #################################### insert bail out for too much - #################################### time spent ?? - - my $upper_ts= time; - -#Begin GET Accounting - - $query = "SELECT ACCT_SESSION_TIME,ACCT_STATUS_TYPE FROM ACCOUNTING "; - $query .= " WHERE ACCT_STATUS_TYPE = 'Stop'"; - $query .= " AND TIMESTAMP > $radius_base_ts"; - $query .= " AND TIMESTAMP < $upper_ts"; - - ($rad_time,$rad_sessions) = calculateRadVals($query); - - ## incremental/accumulated values -## $radius_inc_time += $rad_time; -## $radius_inc_sessions += $rad_sessions; - -#END GET Accounting - -## `$ECHO "$radius_inc_time:$radius_inc_sessions" > $ACCUM_radius_DB`; - $radius_base_ts += ($upper_ts - $radius_base_ts); - return 0; -} - -## -# IN: query -# RET: time, sessions -## -sub calculateRadVals{ - my $query = shift(@_); - -#print "radius query: $query\n"; - - my ($rad_t,$rad_s)= (0,0); - $sth = $RADdbh->prepare($query); - $sth ->execute(); - - $"=" \t "; - while ( @row = $sth -> fetchrow_array()){ - #print "$row[0].$row[1]: $eca\n"; - $rad_t += $row[0]; - $rad_s++; - } - - #print "Time: $rad_t seconds\t Sess: $rad_s sessions\n"; - return ($rad_t,$rad_s); -} - - -# ------------------------------------------------------------------- -# -# Put the radiator radius values for output -# -# usage: &put_radius(); -# - -sub put_radius() { - - &put_output("rad_time", sprintf("%8.2f", $rad_time)); - &put_output("rad_sessions", sprintf("%8.2f", $rad_sessions)); - -#incremental graph -## &put_output("radius_inc_time", sprintf("%8.2f", $radius_inc_time)); - ## &put_output("radius_inc_sessions", sprintf("%8.2f", $radius_inc_sessions)); - - - return 0; -} - - -# ------------------------------------------------------------------- -# -# Get values for dns columns -# -# usage: &measure_dns( ); -# - -sub measure_dns () { - - - #################################### insert bail out for too much - #################################### time spent ?? - $buf = <$DNSFD>; - while ($buf) { - ## process line read and check for eof - if ($buf) { - &process_dns_line ($buf); - } - if ($DNSFD->eof) { - printf "DNS: eof on $DNSFile\n" if $debug; - last; # get out of while($buf) + # + # Init the services vars + # + while ( ($service) = each %Services) { + if ($Services{$service}{Ok} == 0) { + my $func= $Services{$service}{Init_Vars}; + if ($func eq "") { + next; + } + &$func(); + } } - $buf = <$DNSFD>; - } ## while ($buf) + # + # call the measure routines... + # + &measure ($sleep_till); - # test for file change via different inode or filesize decrease - $dev = $ino = $mode = $nlink = $uid = $gid = $rdev = - $size = $atime = $mtime = $ctime = $blksize = $blocks = ''; - ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, - $atime,$mtime,$ctime,$blksize,$blocks) = stat($DNSFile); - if (!$dev) { - &logit ("can't stat $DNSFile"); - warn "$progname: can't stat $DNSFile\n"; - return 1; - } - printf "DNSFD: dns_ino=%s vs. ino=%s\tdns_size=%s vs. size=%s\n", $dns_ino, $ino, $dns_size, $size if $debug; - if (($dns_ino != $ino) || ($dns_size > $size)) { - undef $DNSFD; - printf "DNS: file change on $DNSFile\n" if $debug; - $DNSFD = new IO::File "$DNSFile", "r"; - if (!defined ($DNSFD)) { - &logit ("can't re-open $DNSFile"); - warn "$progname: can't re-open $DNSFile\n"; - $dns_ino = $dns_size = 0; - return 2; + while ( ($service) = each %Services) { + if ($Services{$service}{Ok} == 0) { + my $func= $Services{$service}{Put}; + if ($func eq "") { + next; + } + &$func(); + } } - $dns_ino = $ino; - $dns_size = $size; - } - - return 0; -} - - -# ------------------------------------------------------------------- -# -# init dns vars -# -# usage: &init_dns_vars(); -# -sub init_dns_vars() { + $outputfile_ok = &check_output ("$Options{outputdir}/$nodename"); - $dns_usage_started = 0; - $dns_nstats_started = 0; - $dns_xstats_started = 0; + &flush_output (); - &init_dns_usage_vars(); - &init_dns_nstats_vars(); - &init_dns_xstats_vars(); - - &init_odns_vars(); -} -sub init_dns_usage_vars () { - $dns_cpu_u = 0; - $dns_cpu_s = 0; - $dns_ccpu_u = 0; - $dns_ccpu_s = 0; -} -sub init_dns_nstats_vars () { - $dns_a = 0; - $dns_ptr = 0; - $dns_mx = 0; - $dns_any = 0; - - $dns_ns = 0; - $dns_soa = 0; - $dns_axfr = 0; - $dns_aaaa = 0; - $dns_other = 0; -} -sub init_dns_xstats_vars () { - $dns_rr = 0; - $dns_rq = 0; - $dns_rother = 0; - - $dns_sans = 0; - $dns_snaans = 0; - $dns_snxd = 0; - $dns_sother = 0; -} - - -# ------------------------------------------------------------------- -# -# init odns vars (save old values) -# -# usage: &init_odns_vars(); -# - -sub init_odns_vars() { - &init_odns_usage_vars(); - &init_odns_nstats_vars(); - &init_odns_xstats_vars(); -} - -sub init_odns_usage_vars() { - $odns_cpu_u = $dns_cpu_u ; - $odns_cpu_s = $dns_cpu_s ; - $odns_ccpu_u = $dns_ccpu_u ; - $odns_ccpu_s = $dns_ccpu_s ; - - &init_dns_usage_vars(); -} -sub init_odns_nstats_vars() { - $odns_a = $dns_a ; - $odns_ptr = $dns_ptr ; - $odns_mx = $dns_mx ; - $odns_any = $dns_any ; - - $odns_ns = $dns_ns ; - $odns_soa = $dns_soa ; - $odns_axfr = $dns_axfr ; - $odns_aaaa = $dns_aaaa ; - $odns_other = $dns_other ; - - &init_dns_nstats_vars(); -} -sub init_odns_xstats_vars() { - $odns_rr = $dns_rr ; - $odns_rq = $dns_rq ; - $odns_rother = $dns_rother ; - - $odns_sans = $dns_sans ; - $odns_snaans = $dns_snaans ; - $odns_snxd = $dns_snxd ; - $odns_sother = $dns_sother ; - - &init_dns_xstats_vars(); } +# got here ? how ?? +exit 0; -# ------------------------------------------------------------------- -# -# calc dns delta # -# usage: &calc_dns_delta(); +# The usage stuff # +sub usage { + print "Usage: $progname [options]\n"; + print "($progname uses the GNU extended POSIX option format)\n"; + print "\n"; + + while ( ($helpline) = each %HelpText) { + print "$HelpText{$helpline} $helpline)\n"; + } + print "--help, --version this option summary\n"; + + print "\n"; + print "Note: use filename 'off' to turn off the specific service\n"; + print "\n"; + print " This is $progname version $VERSION\n"; + print "\n"; -sub calc_dns_delta() { - &calc_dns_usage_delta(); - &calc_dns_nstats_delta(); - &calc_dns_xstats_delta(); -} - -sub calc_dns_usage_delta() { - my $temp = 0; - - if ($dns_cpu_u < $odns_cpu_u) { - $odns_cpu_u = $dns_cpu_u; - } else { - $temp = $dns_cpu_u; $dns_cpu_u = $dns_cpu_u - $odns_cpu_u; $odns_cpu_u = $temp; - } - if ($dns_cpu_s < $odns_cpu_s) { - $odns_cpu_s = $dns_cpu_s; - } else { - $temp = $dns_cpu_s; $dns_cpu_s = $dns_cpu_s - $odns_cpu_s; $odns_cpu_s = $temp; - } - if ($dns_ccpu_u < $odns_ccpu_u) { - $odns_ccpu_u = $dns_ccpu_u; - } else { - $temp = $dns_ccpu_u; $dns_ccpu_u = $dns_ccpu_u - $odns_ccpu_u; $odns_ccpu_u = $temp; - } - if ($dns_ccpu_s < $odns_ccpu_s) { - $odns_ccpu_s = $dns_ccpu_s; - } else { - $temp = $dns_ccpu_s; $dns_ccpu_s = $dns_ccpu_s - $odns_ccpu_s; $odns_ccpu_s = $temp; - } -} -sub calc_dns_nstats_delta() { - my $temp = 0; - - if ($dns_a < $odns_a) { - $odns_a = $dns_a; - } else { - $temp = $dns_a; $dns_a = $dns_a - $odns_a; $odns_a = $temp; - } - if ($dns_ptr < $odns_ptr) { - $odns_ptr = $dns_ptr; - } else { - $temp = $dns_ptr; $dns_ptr = $dns_ptr - $odns_ptr; $odns_ptr = $temp; - } - if ($dns_mx < $odns_mx) { - $odns_mx = $dns_mx; - } else { - $temp = $dns_mx; $dns_mx = $dns_mx - $odns_mx; $odns_mx = $temp; - } - if ($dns_any < $odns_any) { - $odns_any = $dns_any; - } else { - $temp = $dns_any; $dns_any = $dns_any - $odns_any; $odns_any = $temp; - } - - if ($dns_ns < $odns_ns) { - $odns_ns = $dns_ns; - } else { - $temp = $dns_ns; $dns_ns = $dns_ns - $odns_ns; $odns_ns = $temp; - } - if ($dns_soa < $odns_soa) { - $odns_soa = $dns_soa; - } else { - $temp = $dns_soa; $dns_soa = $dns_soa - $odns_soa; $odns_soa = $temp; - } - if ($dns_axfr < $odns_axfr) { - $odns_axfr = $dns_axfr; - } else { - $temp = $dns_axfr; $dns_axfr = $dns_axfr - $odns_axfr; $odns_axfr = $temp; - } - if ($dns_aaaa < $odns_aaaa) { - $odns_aaaa = $dns_aaaa; - } else { - $temp = $dns_aaaa; $dns_aaaa = $dns_aaaa - $odns_aaaa; $odns_aaaa = $temp; - } - if ($dns_other < $odns_other) { - $odns_other = $dns_other; - } else { - $temp = $dns_other; $dns_other = $dns_other - $odns_other; $odns_other = $temp; - } -} -sub calc_dns_xstats_delta() { - my $temp = 0; - - if ($dns_rr < $odns_rr) { - $odns_rr = $dns_rr; - } else { - $temp = $dns_rr; $dns_rr = $dns_rr - $odns_rr; $odns_rr = $temp; - } - if ($dns_rq < $odns_rq) { - $odns_rq = $dns_rq; - } else { - $temp = $dns_rq; $dns_rq = $dns_rq - $odns_rq; $odns_rq = $temp; - } - if ($dns_rother < $odns_rother) { - $odns_rother = $dns_rother; - } else { - $temp = $dns_rother; $dns_rother = $dns_rother - $odns_rother; $odns_rother = $temp; - } - - if ($dns_sans < $odns_sans) { - $odns_sans = $dns_sans; - } else { - $temp = $dns_sans; $dns_sans = $dns_sans - $odns_sans; $odns_sans = $temp; - } - if ($dns_snaans < $odns_snaans) { - $odns_snaans = $dns_snaans; - } else { - $temp = $dns_snaans; $dns_snaans = $dns_snaans - $odns_snaans; $odns_snaans = $temp; - } - if ($dns_snxd < $odns_snxd) { - $odns_snxd = $dns_snxd; - } else { - $temp = $dns_snxd; $dns_snxd = $dns_snxd - $odns_snxd; $odns_snxd = $temp; - } - if ($dns_sother < $odns_sother) { - $odns_sother = $dns_sother; - } else { - $temp = $dns_sother; $dns_sother = $dns_sother - $odns_sother; $odns_sother = $temp; - } + exit; } - -# ------------------------------------------------------------------- -# -# Parse dns log line # -# usage: &process_dns_line ($buf); -# - -sub process_dns_line () { - my ($line) = @_; - +# Cycle several measurables # -# Oct 24 14:27:49 Ns named[17279]: USAGE 972394069 970586866 CPU=188.82u/82.79s CHILDCPU=0u/0s -# Oct 24 14:27:49 Ns named[17279]: NSTATS 972394069 970586866 0=6 A=322014 NS=25 SOA=415 PTR=35772 MX=111 SRV=110 ANY=238 -# Oct 24 14:27:49 Ns named[17279]: XSTATS 972394069 970586866 RR=293985 RNXD=22941 RFwdR=205718 RDupR=3603 RFail=508 RFErr=0 RErr=141 RAXFR=0 RLame=2636 ROpts=0 SSysQ=58851 SAns=205888 SFwdQ=169140 SDupQ=23529 SErr=0 RQ=358773 RIQ=0 RFwdQ=0 RDupQ=8397 RTCP=206 SFwdR=205718 SFail=3 SFErr=0 SNaAns=204478 SNXD=45736 +# usage: &measure( $sleep_till ); # - if ($line !~ / named\[\d+\]: (USAGE|NSTATS|XSTATS) /) { - return 0; - } - - -# Oct 24 14:27:49 Ns named[17279]: USAGE 972394069 970586866 CPU=188.82u/82.79s CHILDCPU=0u/0s - if ($line =~ /: USAGE \d+ \d+ CPU=([\d\.]+)u\/([\d\.]+)s CHILDCPU=([\d\.]+)u\/([\d\.]+)s/) { - - $dns_cpu_u = $1; - $dns_cpu_s = $2; - $dns_ccpu_u = $3; - $dns_ccpu_s = $4; - - printf "DNS_USAGE: %s", $line if $debug; - printf "dns_cpu_u=%s, dns_cpu_s=%s, dns_ccpu_u=%s, dns_ccpu_s=%s\n", $dns_cpu_u, $dns_cpu_s, $dns_ccpu_u, $dns_ccpu_s if $debug; - - if ($dns_usage_started) { - &calc_dns_usage_delta(); # puts delta into vars to print -&- saves into old - } else { - $dns_usage_started = 1; - &init_odns_usage_vars(); # saves old and cleans current values - } - -# Oct 24 14:27:49 Ns named[17279]: NSTATS 972394069 970586866 0=6 A=322014 NS=25 SOA=415 PTR=35772 MX=111 SRV=110 ANY=238 - } elsif ($line =~ /: NSTATS \d+ \d+ /) { - my $l; - - ($l = $line) =~ s/^.*: NSTATS \d+ \d+ //; # trim beginning - chop $l; - - @types = split(' ',$l); - - $dns_other = 0; - while (@types) { - ($t,$v) = split ('=', pop @types); - if ($t eq 'A') { - $dns_a = $v; - } elsif ($t eq 'PTR') { - $dns_ptr = $v; - } elsif ($t eq 'MX') { - $dns_mx = $v; - } elsif ($t eq 'ANY') { - $dns_any = $v; - } elsif ($t eq 'NS') { - $dns_ns = $v; - } elsif ($t eq 'SOA') { - $dns_soa = $v; - } elsif ($t eq 'AXFR') { - $dns_axfr = $v; - } elsif ($t eq 'AAAA') { - $dns_aaaa = $v; - } else { - $dns_other += $v; - } - } - - printf "DNS_NSTATS: %s", $line if $debug; - printf "dns_a=%s, dns_ptr=%s, dns_mx=%s, dns_any=%s, dns_ns=%s, dns_soa=%s, dns_axfr=%s, dns_aaaa=%s, dns_other=%s\n", $dns_a, $dns_ptr, $dns_mx, $dns_any, $dns_ns, $dns_soa, $dns_axfr, $dns_aaaa, $dns_other if $debug; - - if ($dns_nstats_started) { - &calc_dns_nstats_delta(); # puts delta into vars to print -&- saves into old - } else { - $dns_nstats_started = 1; - &init_odns_nstats_vars(); # saves old and cleans current values - } +sub measure () { + my ($sleep_till) = @_; + $now = time; -# Oct 24 14:27:49 Ns named[17279]: XSTATS 972394069 970586866 RR=293985 RNXD=22941 RFwdR=205718 RDupR=3603 RFail=508 RFErr=0 RErr=141 RAXFR=0 RLame=2636 ROpts=0 SSysQ=58851 SAns=205888 SFwdQ=169140 SDupQ=23529 SErr=0 RQ=358773 RIQ=0 RFwdQ=0 RDupQ=8397 RTCP=206 SFwdR=205718 SFail=3 SFErr=0 SNaAns=204478 SNXD=45736 - } elsif ($line =~ /: XSTATS \d+ \d+ /) { - my $l; - - ($l = $line) =~ s/^.*: XSTATS \d+ \d+ //; # trim beginning - chop $l; - - @types = split(' ',$l); - - $dns_rother = $dns_sother = 0; - while (@types) { - ($t,$v) = split ('=', pop @types); - if ($t eq 'RR') { - $dns_rr = $v; - } elsif ($t eq 'RQ') { - $dns_rq = $v; - } elsif ($t =~ /^R/) { - $dns_rother += $v; - } elsif ($t eq 'SAns') { - $dns_sans = $v; - } elsif ($t eq 'SNaAns') { - $dns_snaans = $v; - } elsif ($t eq 'SNXD') { - $dns_snxd = $v; - } elsif ($t =~ /^S/) { - $dns_sother += $v; - } - } + while ($now < $sleep_till) { + printf "MEASURE: sleeping for 5\n" if $Options{debug}; + sleep(5); + $now = time; + + # measure... + while ( ($service) = each %Services) { + if ($Services{$service}{Ok} == 0 && $Services{$service}{External} == 0) { + my $func= $Services{$service}{Measure}; + if ($func eq "") { + next; + } + &$func(); + } + } + # measure... - printf "DNS_XSTATS: %s", $line if $debug; - printf "dns_rr=%s, dns_rq=%s, dns_rother=%s, dns_sans=%s, dns_snaans=%s, dns_snxd=%s, dns_sother=%s\n", $dns_rr, $dns_rq, $dns_rother, $dns_sans, $dns_snaans, $dns_snxd, $dns_sother if $debug; + $now = time; + } # while ($now < $sleep_till) - if ($dns_xstats_started) { - &calc_dns_xstats_delta(); # puts delta into vars to print -&- saves into old - } else { - $dns_xstats_started = 1; - &init_odns_xstats_vars(); # saves old and cleans current values + # + # put in the end... calls external prog. + # + while ( ($service) = each %Services) { + if ($Services{$service}{Ok} == 0 && $Services{$service}{External} == 1) { + my $func= $Services{$service}{Measure}; + if ($func eq "") { + next; + } + &$func(); + } + # + # some internal services has something extra to check + # + if (defined($Services{$service}{Extra})) { + my $func= $Services{$service}{Extra}; + if ($func eq "") { + next; + } + &$func(); + } } - } - - return 0; + return 0; } - -# ------------------------------------------------------------------- # -# Put the dns values for output +# measure_head -- put first values # -# usage: &put_dns(); +# usage: &measure_head($time) # +sub measure_head() { + my ($time) = @_; -sub put_dns() { - - &put_output("dns_cpu_u", sprintf("%8.2f", $dns_cpu_u)); - &put_output("dns_cpu_s", sprintf("%8.2f", $dns_cpu_s)); - &put_output("dns_ccpu_u", sprintf("%8.2f", $dns_ccpu_u)); - &put_output("dns_ccpu_s", sprintf("%8.2f", $dns_ccpu_s)); - - &put_output("dns_a", sprintf("%8.2f", $dns_a)); - &put_output("dns_ptr", sprintf("%8.2f", $dns_ptr)); - &put_output("dns_mx", sprintf("%8.2f", $dns_mx)); - &put_output("dns_any", sprintf("%8.2f", $dns_any)); - - &put_output("dns_ns", sprintf("%8.2f", $dns_ns)); - &put_output("dns_soa", sprintf("%8.2f", $dns_soa)); - &put_output("dns_axfr", sprintf("%8.2f", $dns_axfr)); - &put_output("dns_aaaa", sprintf("%8.2f", $dns_aaaa)); - &put_output("dns_other", sprintf("%8.2f", $dns_other)); - - &put_output("dns_rr", sprintf("%8.2f", $dns_rr)); - &put_output("dns_rq", sprintf("%8.2f", $dns_rq)); - &put_output("dns_rother", sprintf("%8.2f", $dns_rother)); - - &put_output("dns_sans", sprintf("%8.2f", $dns_sans)); - &put_output("dns_snaans", sprintf("%8.2f", $dns_snaans)); - &put_output("dns_snxd", sprintf("%8.2f", $dns_snxd)); - &put_output("dns_sother", sprintf("%8.2f", $dns_sother)); - - return 0; + $now_string = strftime "%T", localtime; + &put_output(" timestamp", sprintf("%10d", $time)); + &put_output("locltime", $now_string); } - Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in 2003-03-08 10:26:15.000000000 -0800 @@ -1,18 +1,27 @@ #!/bin/sh AWK=@AWK@ +UNAME=/usr/bin/uname -# Kill any running orca_services. -pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` +OPERSYS=`$UNAME -s` + +# Kill any running orcallators. +if test "${OPERSYS}" = "Linux"; then + PSCMD="/bin/ps" +else + PSCMD="/usr/ucb/ps" # Solaris +fi + +pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then echo "Killing pids $pids." kill -HUP $pids sleep 1 - pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` + pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then kill -TERM $pids sleep 1 - pids=`/usr/ucb/ps auxww | $AWK '/orca_services/ && !/awk/ {print $2}'` + pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then kill -9 $pids sleep 1 Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in 2003-03-08 10:26:15.000000000 -0800 @@ -6,17 +6,19 @@ case "$1" in 'start') - if [ -x $bindir/start_orca_services ]; then + if [ -x $bindir/start_orca_services.sh ]; then umask 022 - $bindir/start_orca_services + $bindir/start_orca_services.sh else - echo "$0: $bindir/start_orca_services does not exist or is not executable." + echo "$0: $bindir/start_orca_services.sh does not exist or is not executable." fi ;; 'stop') - if [ -x $bindir/stop_orca_services ]; then - $bindir/stop_orca_services + if [ -x $bindir/stop_orca_services.sh ]; then + $bindir/stop_orca_services.sh + else + echo "$0: $bindir/stop_orca_services.sh does not exist or is not executable." fi ;; Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in 2003-03-08 10:26:15.000000000 -0800 @@ -39,6 +39,14 @@ warn_email root at localhost late_interval interval + 30 +# These parameters specify which plots to generate. +generate_hourly_plot 1 +generate_daily_plot 1 +generate_weekly_plot 1 +generate_monthly_plot 1 +generate_quarterly_plot 1 +generate_yearly_plot 1 + # This defines where the find the source data files and the format of # those files. Notes about the fields: # find_files @@ -53,9 +61,8 @@ # The interval here must match the interval used by orca_services to # record data. Do not change this, as it has an effect on the # generated RRD data files. - group orca_services { -find_files @VAR_DIR@/orca_services/(.*)/(?:(?:orca_services)|(?:percol))-\d{4}-\d{2}-\d{2}(?:\.(?:Z|gz|bz2))? +find_files @VAR_DIR@/orca_services/(.*)/(?:(?:orca_services)|(?:orcaservices))-\d{4}-\d{2}-\d{2}(?:-\d{3,})?(?:\.(?:Z|gz|bz2))? column_description first_line date_source column_name timestamp interval 300 @@ -75,17 +82,12 @@ # # ATTENTION: change this to your values # -html_top_title Services Status +html_top_title Orca_services Status # # ATTENTION: change this to your values # -html_page_header - - kpnQwest Portugal - +html_page_header

Put your site's logo here.

html_page_footer @@ -120,6 +122,36 @@ } plot { +title %g SMTP Virus & Spam in 5 minutes +source orca_services +data smtp_virus +data smtp_spam +legend Virus (5m) +legend Spam Messages (5m) +y_legend Number of Messages +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html +} + +plot { +title %g SMTP Failed +source orca_services +data smtp_torf +data smtp_c_ml +data smtp_c_rt +data smtp_ntfs +legend Temp or Fatal Error (5m) +legend Check Mail (5m) +legend Check Rcpt (5m) +legend Portmaster Notifies (5m) +y_legend Number of Messages +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Failed +} + +plot { title %g SMTP Size source orca_services data smtp_sizes @@ -163,33 +195,27 @@ } plot { -title %g SMTP Failed +title %g SMTP DSN and Undefs source orca_services -data smtp_torf -data smtp_c_ml -data smtp_c_rt -data smtp_ntfs -legend Temp or Fatal Error (5m) -legend Check Mail (5m) -legend Check Rcpt (5m) -legend Portmaster Notifies (5m) +data smtp_dsns +data smtp_undf +legend Number of DSNs (5m) +legend Undefined log (5m) y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Failed +href http://o-s.kpnqwest.pt/orca_services.html#SMTP_DSN_and_Undefs } plot { -title %g SMTP DSN and Undefs +title %g SMTP Over Quota in 5 minutes source orca_services -data smtp_dsns -data smtp_undf -legend Number of DSNs (5m) -legend Undefined log (5m) +data smtp_overquota +legend Over Quota (5m) y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_DSN_and_Undefs +href http://o-s.kpnqwest.pt/orca_services.html } @@ -307,7 +333,19 @@ title %g Radius time usage source orca_services line_type line2 -data rad_time/60 +data rad_time / 60 +legend Time consumption (5 min) +y_legend Minutes +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html#Radius_time_usage +} + +plot { +title %g Radius accumulated time usage +source orca_services +line_type line2 +data radius_inc_time / 60 legend Time consumption (5 min) y_legend Minutes data_min 0 @@ -327,10 +365,22 @@ href http://o-s.kpnqwest.pt/orca_services.html#Radius_sessions } +plot { +title %g Radius accumulated sessions +source orca_services +line_type line2 +data radius_inc_sessions +legend Number of Sessions (5 min) +y_legend Terminated Sessions +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html#Radius_sessions +} + plot { -title %g NAMED CPU Usage in 1 hour +title %g NAMED CPU Usage in 10 minutes source orca_services data dns_cpu_u data dns_cpu_s @@ -344,7 +394,7 @@ legend System legend Child User legend Child System -y_legend Seconds in 1 hour +y_legend Seconds in 10 minutes data_min 0 data_max U href http://o-s.kpnqwest.pt/orca_services.html#NAMED_CPU_Usage_in_1_hour @@ -365,7 +415,7 @@ legend PTR legend MX legend ANY -y_legend Units in 1 hour +y_legend Units in 10 minutes data_min 0 data_max U href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Major_queries @@ -389,7 +439,7 @@ legend AXFR legend AAAA legend OTHER -y_legend Units in 1 hour +y_legend Units in 10 minutes data_min 0 data_max U href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Minor_queries @@ -407,7 +457,7 @@ legend R-Responses legend R-Queries legend R-OTHER -y_legend Units in 1 hour +y_legend Units in 10 minutes data_min 0 data_max U href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Received @@ -428,8 +478,117 @@ legend S-NA Answer legend S-Negative legend S-OTHER -y_legend Units in 1 hour +y_legend Units in 10 minutes data_min 0 data_max U href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Sent } + +plot { +title %g HTTP Processes +source orca_services +data http_procs +line_type line2 +legend HTTP Processes +y_legend Number of processes +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html#HTTP_Processes +} + +plot { +title %g HTTP requests +source orca_services +data http_hits +data http_condgets +data http_gets +data http_heads +data http_posts +data http_errors +data http_undefs +line_type line2 +line_type line2 +line_type line2 +line_type line2 +line_type line2 +line_type line2 +line_type line2 +legend HIT +legend cond GET +legend GET +legend HEAD +legend POST +legend Errors +legend Undefs +y_legend Units in 5 minutes +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html#HTTP_requests +} + +plot { +title %g HTTP Bps +source orca_services +data http_Bps +line_type line2 +legend HTTP bandwidth +y_legend BYTES per Second +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html#HTTP_Bps +} + +plot { +title %g HTTP request size +source orca_services +data http_1k * 100 +data http_10k * 100 +data http_100k * 100 +data http_1000k * 100 +data http_1M * 100 +line_type area +line_type stack +line_type stack +line_type stack +line_type stack +legend % of < 1Kb requests +legend % of < 10Kb requests +legend % of < 100Kb requests +legend % of < 1000Kb requests +legend % of > 1Mb requests +y_legend Percent +data_min 0 +data_max 120 +href http://o-s.kpnqwest.pt/orca_services.html#HTTP_request_size +} + + + +plot { +title %g NNTP Statistics in 5 minutes +source orca_services +data nntpcache_connects +data nntpcache_groups +data nntpcache_articles +legend Connects (5m) +legend GROUPs (5m) +legend ARTICLEs (5m) +y_legend Units in 5 minutes +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html +} + +plot { +title %g SLAPD Statistics in 5 minutes +source orca_services +data slapd_binds +data slapd_searchs +legend BINDs (5m) +legend SRCHs (5m) +y_legend Units in 5 minutes +data_min 0 +data_max U +href http://o-s.kpnqwest.pt/orca_services.html +} + From blair at orcaware.com Sat Mar 8 13:26:22 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Sat, 8 Mar 2003 13:26:22 -0800 Subject: [Orca-checkins] rev 208 - / Message-ID: <200303082126.h28LQLmZ016704@orcaware.com> Author: blair Date: 2003-03-08 13:25:40 -0800 (Sat, 08 Mar 2003) New Revision: 208 Added: README Log: * README: Add a top level file describing the layout of the repository and how to and how not to check out the repository. Added: README ============================================================================== --- README (original) +++ README 2003-03-08 13:26:07.000000000 -0800 @@ -0,0 +1,44 @@ +This is the top of OrcaWare Consulting's Subversion repository. + + trunk/ ......... The latest development sources. When people say + "Get the head of trunk", they mean the latest + revision of an entire project directory located in + trunk/, such as trunk/find_badblocks or + trunk/orca. Normally, you wouldn't want to check + out an entire copy of trunk/, because it contains + many unrelated projects. + + branches/ ...... Various development branches. Typically a branch + contains a complete copy of a project's directory + in trunk/, even if the changes are isolated to one + subdirectory in the project. Note that branch + copies are generally removed after they've been + merged back into trunk/, so what's in branches/ + now does not reflect all the branches that have + ever been created. + + tags/ .......... Snapshots of releases. As a general policy, we + don't change these after they're created; if + something needs to change, we move it to branches + and work on it there. + +When checking out the source code on this server, please be extra +careful to check out only the package you need, otherwise you may +check out the entire repository and fill up a minimum of 300 Mbytes on +your disk and take forever to check out. Here are some sample +commands: + + Check out the HEAD, that is the latest working copy, of the Orca + package: + + svn co http://svn.orcaware.com:8000/repos/trunk/orca/ + + Check out Orca tagged at version 0.27: + + svn co http://svn.orcaware.com:8000/repos/tags/orca/0.27/ + + These are the commands to avoid, as they will check out everything + underneath the specified URL. Be careful :) : + + svn co http://svn.orcaware.com:8000/repos/ + svn co http://svn.orcaware.com:8000/repos/tags/ From sean at seanoneill.info Sun Mar 9 08:40:12 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Sun, 9 Mar 2003 08:40:12 -0800 Subject: [Orca-checkins] rev 209 - in branches/orca/import_orca_services_2.0: lib data_gatherers/orca_services Message-ID: <200303091640.h29GeCqd006667@orcaware.com> Author: sean at seanoneill.info Date: 2003-03-09 08:39:55 -0800 (Sun, 09 Mar 2003) New Revision: 209 Added: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.cfg.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services_running.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_Orca_Services.sh.in branches/orca/import_orca_services_2.0/lib/Orca_Services/ Removed: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services_running.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_orca_services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in branches/orca/import_orca_services_2.0/lib/Orca_services/ Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in branches/orca/import_orca_services_2.0/lib/Makefile.in Log: In branches/orca/import_orca_services_2.0: Moved: data_gatherers/orca_services/S99orca_services.sh.in data_gatherers/orca_services/orca_services.cfg.in data_gatherers/orca_services/orca_services.pl.in data_gatherers/orca_services/orca_services_running.pl.in data_gatherers/orca_services/restart_orca_services.sh.in data_gatherers/orca_services/stop_orca_services.sh.in lib/Orca_services/ -> lib/Orca_Services/ Modified: data_gatherers/orca_services/start_orca_services.sh.in Log: * Various file in data_gatherers/orca_services/ moved so that orca_services changed to Orca_Services in filename. * lib/Orca_services/ -> lib/Orca_Services/ At Sjaak's and Blair's request, moved lib/Orca_services/ to lib/Orca_Services/ * data_gathers/orca_services/start_orca_services.sh.in All references to orca_services changed to Orca_Services PSCMD variable value for Solaris changed to "ps -ef" Modified: branches/orca/import_orca_services_2.0/lib/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/lib/Makefile.in 2003-03-09 08:40:09.000000000 -0800 @@ -30,7 +30,7 @@ $(MKDIR) $(libdir)/Orca $(MKDIR) $(libdir)/SE/3.2.1 $(MKDIR) $(libdir)/SE/3.3 - $(MKDIR) $(libdir)/Orca_services + $(MKDIR) $(libdir)/Orca_Services @for f in Orca/*.pm; do \ echo $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ @@ -50,9 +50,9 @@ echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ done - @for f in Orca_services/*; do \ - echo $(INSTALL) -m 0644 $$f $(libdir)/Orca_services; \ - $(INSTALL) -m 0644 $$f $(libdir)/Orca_services; \ + @for f in Orca_Services/*; do \ + echo $(INSTALL) -m 0644 $$f $(libdir)/Orca_Services; \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca_Services; \ done clean: Copied: Orca_Services (from rev 207, branches/orca/import_orca_services_2.0/lib/Orca_services) Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,6 +1,6 @@ #!/bin/sh -# This script runs orca_services with the proper options for your site. +# This script runs Orca_Services with the proper options for your site. # Define program locations that will be needed. prefix=@prefix@ @@ -9,7 +9,7 @@ AWK=@AWK@ CUT=@CUT@ UNAME=@UNAME@ -ORCA_SERVICES_DIR=@VAR_DIR@/orca_services +ORCA_SERVICES_DIR=@VAR_DIR@/Orca_Services # Get the hostname without the fully qualified part; that is, trim off # anything past the first `.'. @@ -17,9 +17,9 @@ OPERSYS=`$UNAME -s` if test "${OPERSYS}" = "Linux"; then - PSCMD="/bin/ps" + PSCMD="/bin/ps auxww" else - PSCMD="/usr/ucb/ps" # Solaris + PSCMD="/usr/bin/ps -ef" # Solaris fi # The directory these files go into is $ORCA_SERVICES_DIR/HOSTNAME @@ -28,8 +28,8 @@ # Export the environmental variables. export OUTDIR -# Check if orca_services is already running. -pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/start_orca_services/ && !/daemon/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` +# Check if Orca_Services is already running. +pids=`$PSCMD | $AWK '/Orca_Services/ && !/awk/ && !/start_Orca_Services/ && !/daemon/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then echo "Orca_Services already running. Exiting." exit 1 @@ -54,15 +54,15 @@ # Now start the logging. echo "Starting logging" HOSTNAME=`hostname` -if test -f "$libdir/orca_services.$HOSTNAME"; then - $libdir/orca_services `cat $libdir/orca_services.$HOSTNAME` +if test -f "$libdir/Orca_Services.$HOSTNAME"; then + $libdir/Orca_Services `cat $libdir/Orca_Services.$HOSTNAME` else - $libdir/orca_services + $libdir/Orca_Services fi -### # Write the PID of orca_services to a file to make killing easier. +### # Write the PID of Orca_Services to a file to make killing easier. ### pid=$! -### echo $pid > $OUTDIR/orca_services.pid +### echo $pid > $OUTDIR/Orca_Services.pid -# Sleep for a couple of seconds to allow any orca_services warnings to appear. +# Sleep for a couple of seconds to allow any Orca_Services warnings to appear. sleep 5 Copied: Orca_Services_running.pl.in (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services_running.pl.in) Copied: Orca_Services.pl.in (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in) Copied: restart_Orca_Services.sh.in (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_orca_services.sh.in) Copied: stop_Orca_Services.sh.in (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in) Copied: Orca_Services.cfg.in (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in) Copied: S99Orca_Services.sh.in (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in) Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.pl.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,281 +0,0 @@ -# orca_services.pl, a log generating services usage monitor -# -# This program logs many different services usage to a log file -# for later processing. -# -# Author: Sjaak Westdijk -# -# thanks to : -# Carlos Canau -# Jose Carlos Pereira -# -# Most code is adapted from Orca_servcies 1.X written by Carlos Canau -# -# Portions ported to perl from Orcallator.se written by Blair Zajac -# other portions adapted from several other open source scripts -# -# -# BUGS: -# -# -# TODO: -# -# -# LICENSE: -# GPL. -# (c) 2003 Sjaak Westdijk -# (c) 2000-2002 Carlos Canau & Jose Carlos Pereira -# -# -# DISCLAIMER: -# you use this program at your own and complete risk -# if you don't agree with that then delete it -# - -# Set the location of the Orca_Services modules. -BEGIN { - my $prefix = "@prefix@"; - my $exec_prefix = "@exec_prefix@"; - my $libdir = "@libdir@"; - unshift(@INC, $libdir); -} - -# -# which standard modules to use -# -require 5.004; -use Fcntl; -use Getopt::Long; # option handler -use POSIX; # useful functions -use IO::Handle; -use IO::File; - -# -# which Orca_Services modules to use -# -use Orca_Services::Vars; -use Orca_Services::Utils; -use Orca_Services::Output; -use Orca_Services::Sendmail; -#use Orca_Services::Dns; -use Orca_Services::Mailq; -use Orca_Services::Http; -#use Orca_Services::Nntp; -#use Orca_Services::Pop; -use Orca_Services::Slapd; -#use Orca_Services::MeritRad; -#use Orca_Services::Radius; - -# -# See if the modules load succesfully -# -if ($Options{debug}) { - while ( ($service, $params) = each %Services) { - print "$service:\n"; - while ( ($par, $val) = each %$params) { - print "\t$par=$val\n"; - } - print "\n"; - } -} - -# -# Get the options -# -GetOptions(%PrgOptions) || usage(); -usage() if $Options{help}; - -# -# Look if the options succesfully set -# -if ($Options{debug}) { - while ( ($options) = each %PrgOptions) { - print "$options => $PrgOptions{$options}\n"; - } - print "\n"; - - while ( ($options) = each %Options) { - print "$options => $Options{$options}\n"; - } - print "\n"; -} - -if ($Options{debug} == 0) { - exit if fork; -} - -# -# Create the ouput dir structure -# -system ("mkdir $Options{outputdir} 2>/dev/null"); # ignore return value -system ("chmod 0755 $Options{outputdir} 2>/dev/null"); # if you can change these - # two systems bye the perl - # syscall ... :-) -system ("mkdir $Options{outputdir}/$nodename 2>/dev/null"); # ignore return value -system ("chmod 0755 $Options{outputdir}/$nodename 2>/dev/null"); - -&logit ("ready (pid $$)"); -if (open(P, "> $Options{pidfile}")) { - print P "$$\n"; - close P; -} else { - &logit("can't save pid (can't write to \`$Options{pidfile}')"); - warn "$progname: can't save pid (can't write to \`$Options{pidfile}')\n"; -} - - - -# -# init the services -# -print "Initializing : "; -while ( ($service) = each %Services) { - if ($Services{$service}{File} !~ /^off$/i) { - my $func= $Services{$service}{Init}; - if ($func eq "") { - next; - } - $Services{$service}{Ok} = &$func($Services{$service}{File}); - } - print "$service($Services{$service}{Ok}) "; -} -print "\n"; - -while () { - my $outputfile_ok = 0; - my ($now, $sleep_till); - - $now = time; - $sleep_till = ($now/$Options{interval}) * $Options{interval}; - while ($sleep_till < $now + $Options{interval}*0.5) { - $sleep_till += $Options{interval}; - } - - &measure_head ($now); - - # - # Init the services vars - # - while ( ($service) = each %Services) { - if ($Services{$service}{Ok} == 0) { - my $func= $Services{$service}{Init_Vars}; - if ($func eq "") { - next; - } - &$func(); - } - } - - # - # call the measure routines... - # - &measure ($sleep_till); - - while ( ($service) = each %Services) { - if ($Services{$service}{Ok} == 0) { - my $func= $Services{$service}{Put}; - if ($func eq "") { - next; - } - &$func(); - } - } - - $outputfile_ok = &check_output ("$Options{outputdir}/$nodename"); - - &flush_output (); - -} - -# got here ? how ?? -exit 0; - -# -# The usage stuff -# -sub usage { - print "Usage: $progname [options]\n"; - print "($progname uses the GNU extended POSIX option format)\n"; - print "\n"; - - while ( ($helpline) = each %HelpText) { - print "$HelpText{$helpline} $helpline)\n"; - } - print "--help, --version this option summary\n"; - - print "\n"; - print "Note: use filename 'off' to turn off the specific service\n"; - print "\n"; - print " This is $progname version $VERSION\n"; - print "\n"; - - exit; -} - -# -# Cycle several measurables -# -# usage: &measure( $sleep_till ); -# -sub measure () { - my ($sleep_till) = @_; - $now = time; - - while ($now < $sleep_till) { - printf "MEASURE: sleeping for 5\n" if $Options{debug}; - sleep(5); - $now = time; - - # measure... - while ( ($service) = each %Services) { - if ($Services{$service}{Ok} == 0 && $Services{$service}{External} == 0) { - my $func= $Services{$service}{Measure}; - if ($func eq "") { - next; - } - &$func(); - } - } - # measure... - - $now = time; - } # while ($now < $sleep_till) - - # - # put in the end... calls external prog. - # - while ( ($service) = each %Services) { - if ($Services{$service}{Ok} == 0 && $Services{$service}{External} == 1) { - my $func= $Services{$service}{Measure}; - if ($func eq "") { - next; - } - &$func(); - } - # - # some internal services has something extra to check - # - if (defined($Services{$service}{Extra})) { - my $func= $Services{$service}{Extra}; - if ($func eq "") { - next; - } - &$func(); - } - } - - return 0; -} - -# -# measure_head -- put first values -# -# usage: &measure_head($time) -# -sub measure_head() { - my ($time) = @_; - - $now_string = strftime "%T", localtime; - &put_output(" timestamp", sprintf("%10d", $time)); - &put_output("locltime", $now_string); -} Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services_running.pl.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services_running.pl.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services_running.pl.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,41 +0,0 @@ -# orca_services_running: warn if orca_services files are not up to date. -# -# Copyright (C) 2000 Carlos Canau and KPNQwest Portugal -# Copyright (C) 1998, 1999 Blair Zajac and Yahoo!, Inc. - -use strict; -use POSIX qw(strftime); - -# Set this to the list of directories that contain the output from -# percoservices.se. -my @stats_dirs = ('@VAR_DIR@/orca_services'); - -foreach my $stats_dir (@stats_dirs) { - - die "$0: unable to change to `$stats_dir'" unless chdir $stats_dir; - - die "$0: unable to open `.' for reading: $!\n" unless opendir(DIR, '.'); - - my @hosts = sort grep { $_ !~ /^\./ } readdir(DIR); - - closedir(DIR); - - print "Now in $stats_dir\n"; - - my $percol = strftime("percol-%Y-%m-%d", localtime()); - - foreach my $host (@hosts) { - my $file = "$host/$percol"; - unless (-f $file) { - warn "$0: $file does not exist.\n"; - next; - } - my $age = (-M $file)*(24*60); - if ( $age > 8) { - $file= sprintf "%35s", $file; - $age = sprintf "%8.2f", $age; - warn "$0: $file is $age minutes old.\n"; - next; - } - } -} Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_orca_services.sh.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,12 +0,0 @@ -#!/bin/sh - -# This stops and restarts orca_services. -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ - -# Kill any running orca_servicess. -$bindir/stop_orca_services - -# Start the orca_services. -$bindir/start_orca_services Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_orca_services.sh.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,30 +0,0 @@ -#!/bin/sh - -AWK=@AWK@ -UNAME=/usr/bin/uname - -OPERSYS=`$UNAME -s` - -# Kill any running orcallators. -if test "${OPERSYS}" = "Linux"; then - PSCMD="/bin/ps" -else - PSCMD="/usr/ucb/ps" # Solaris -fi - -pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` -if test "$pids" != ""; then - echo "Killing pids $pids." - kill -HUP $pids - sleep 1 - pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` - if test "$pids" != ""; then - kill -TERM $pids - sleep 1 - pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` - if test "$pids" != ""; then - kill -9 $pids - sleep 1 - fi - fi -fi Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99orca_services.sh.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,31 +0,0 @@ -#!/bin/sh - -prefix=@prefix@ -exec_prefix=@exec_prefix@ -bindir=@bindir@ - -case "$1" in -'start') - if [ -x $bindir/start_orca_services.sh ]; then - umask 022 - $bindir/start_orca_services.sh - else - echo "$0: $bindir/start_orca_services.sh does not exist or is not executable." - fi - ;; - -'stop') - if [ -x $bindir/stop_orca_services.sh ]; then - $bindir/stop_orca_services.sh - else - echo "$0: $bindir/stop_orca_services.sh does not exist or is not executable." - fi - ;; - -*) - echo "Usage: $0 { start | stop }" - exit 1 - ;; - -esac -exit 0 Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/orca_services.cfg.in 2003-03-09 08:40:09.000000000 -0800 @@ -1,594 +0,0 @@ -# Orca configuration file for orca_services files. - -# Require at least this version of Orca. -require 0.27 - -# base_dir is prepended to the paths find_files, html_dir, rrd_dir, -# and state_file only if the path does not match the regular -# expression ^\\?\.{0,2}/, which matches /, ./, ../, and \./. -base_dir @RRD_DIR@/orca_services - -# rrd_dir specifies the location of the generated RRD data files. If -# rrd_dir is a relative path, then it is made relative to base_dir if -# base_dir is set. -rrd_dir . - -# state_file specifies the location of the state file that remembers -# the modification time of each source data file. If state_file is a -# relative path, then it is made relative to base_dir is base_dir is -# set. -state_file orca.state -html_dir @HTML_DIR@/orca_services - -# By default create .meta tag files for all PNGs or GIFs so that the -# web browser will automatically reload them. -expire_images 1 - -# Find files at the following times: -# 0:10 to pick up new orca_services files for the new day. -# 1:00 to pick up late comer orca_services files for the new day. -# 6:00 to pick up new files before the working day. -# 12:00 to pick up new files during the working day. -# 19:00 to pick up new files after the working day. -find_times 0:10 1:00 6:00 12:00 19:00 - -# This defines the email address of people to warn when a file that is -# being updated constantly stops being updated. For mathematical -# expressions use the word `interval' to get the interval number for -# the data source. -warn_email root at localhost -late_interval interval + 30 - -# These parameters specify which plots to generate. -generate_hourly_plot 1 -generate_daily_plot 1 -generate_weekly_plot 1 -generate_monthly_plot 1 -generate_quarterly_plot 1 -generate_yearly_plot 1 - -# This defines where the find the source data files and the format of -# those files. Notes about the fields: -# find_files -# You'll notice that all but the first () has the form (?:...). -# This tells Perl to match the expression but not save the matched -# text in the $1, $2, variables. Orca uses the matched text to -# generate a subgroup name, which is used to place files into -# different subgroups. Here, only the hostname should be used to -# generate a subgroup name, hence all the (?:...) for matching -# anything else. -# interval -# The interval here must match the interval used by orca_services to -# record data. Do not change this, as it has an effect on the -# generated RRD data files. -group orca_services { -find_files @VAR_DIR@/orca_services/(.*)/(?:(?:orca_services)|(?:orcaservices))-\d{4}-\d{2}-\d{2}(?:-\d{3,})?(?:\.(?:Z|gz|bz2))? -column_description first_line -date_source column_name timestamp -interval 300 -reopen 1 -filename_compare sub { - my ($ay, $am, $ad) = $a =~ /-(\d{4})-(\d\d)-(\d\d)/; - my ($by, $bm, $bd) = $b =~ /-(\d{4})-(\d\d)-(\d\d)/; - if (my $c = (( $ay <=> $by) || - ( $am <=> $bm) || - (($ad >> 3) <=> ($bd >> 3)))) { - return 2*$c; - } - $ad <=> $bd; - } -} - -# -# ATTENTION: change this to your values -# -html_top_title Orca_services Status - -# -# ATTENTION: change this to your values -# -html_page_header

Put your site's logo here.

- -html_page_footer - - - These plots brought to you by your local system administrator. - - - -plot { -title %g SMTP Mail Queue -source orca_services -data mailq_total -legend Msgs. in queue (5m) -y_legend Number of Messages -line_type line2 -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Mail_Queue -} - -plot { -title %g SMTP Messages in 5 minutes -source orca_services -data smtp_from -data smtp_sent -legend Messages In (5m) -legend Messages Out (5m) -y_legend Number of Messages -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Messages_in_5_minutes -} - -plot { -title %g SMTP Virus & Spam in 5 minutes -source orca_services -data smtp_virus -data smtp_spam -legend Virus (5m) -legend Spam Messages (5m) -y_legend Number of Messages -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html -} - -plot { -title %g SMTP Failed -source orca_services -data smtp_torf -data smtp_c_ml -data smtp_c_rt -data smtp_ntfs -legend Temp or Fatal Error (5m) -legend Check Mail (5m) -legend Check Rcpt (5m) -legend Portmaster Notifies (5m) -y_legend Number of Messages -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Failed -} - -plot { -title %g SMTP Size -source orca_services -data smtp_sizes -data smtp_tops -line_type area -line_type line1 -legend 5 min average -legend Peak 5 minute -y_legend Message size (bytes) -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Size -} - -plot { -title %g SMTP Delay -source orca_services -data smtp_delay -data smtp_maxd -line_type area -line_type line1 -legend 5 min average -legend Peak 5 minute -y_legend Message Delay (seconds) -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Delay -} - -plot { -title %g SMTP Retries and Queueing -source orca_services -data smtp_rtrs -data smtp_queued -legend Retries (5m) -legend Messages Queued (5m) -y_legend Number of Messages -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Retries_and_Queueing -} - -plot { -title %g SMTP DSN and Undefs -source orca_services -data smtp_dsns -data smtp_undf -legend Number of DSNs (5m) -legend Undefined log (5m) -y_legend Number of Messages -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_DSN_and_Undefs -} - -plot { -title %g SMTP Over Quota in 5 minutes -source orca_services -data smtp_overquota -legend Over Quota (5m) -y_legend Number of Messages -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html -} - - - - -plot { -title %g MERIT RADIUS AUTH in 5 minutes -source orca_services -data radius_auth -data radius_auth_ok -data radius_auth_nok -legend Auth (5m) -legend Auth OK (5m) -legend Auth FAILED (5m) -y_legend Number of Auth Packets -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_AUTH_in_5_minutes -} - -plot { -title %g MERIT RADIUS ACCT in 5 minutes -source orca_services -data radius_acct_start -data radius_acct_stop -legend Start records (5m) -legend Stop records (5m) -y_legend Number of Acct Packets -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_ACCT_in_5_minutes -} - -plot { -title %g MERIT RADIUS REMOTE AUTH in 5 minutes -source orca_services -data radius_rem_auth -data radius_rem_auth_ok -data radius_rem_auth_nok -legend Remote Auth (5m) -legend Remote Auth OK (5m) -legend Remote Auth FAILED (5m) -y_legend Number of Remote Auth Packets -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_REMOTE_AUTH_in_5_minutes -} - -plot { -title %g MERIT RADIUS UNDEFS in 5 minutes -source orca_services -data radius_undefs -legend Undef lines (5m) -y_legend Number of undef lines -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_UNDEFS_in_5_minutes -} - - - -plot { -title %g POP SESSIONS in 5 minutes -source orca_services -data pop_connect -data pop_login -data pop_logout -legend Connect (5m) -legend Login (5m) -legend Logout (5m) -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_SESSIONS_in_5_minutes -} - -plot { -title %g POP DENIED in 5 minutes -source orca_services -data pop_failure -data pop_refused -legend Failures (5m) -legend Refused (5m) -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_DENIED_in_5_minutes -} - -plot { -title %g POP FAILURES in 5 minutes -source orca_services -data pop_net_error -data pop_local_error -legend Network errors (5m) -legend Local errors (5m) -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_FAILURES_in_5_minutes -} - -plot { -title %g POP UNDEFS in 5 minutes -source orca_services -data pop_undefs -legend Undefs (5m) -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_UNDEFS_in_5_minutes -} - -plot { -title %g Radius time usage -source orca_services -line_type line2 -data rad_time / 60 -legend Time consumption (5 min) -y_legend Minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_time_usage -} - -plot { -title %g Radius accumulated time usage -source orca_services -line_type line2 -data radius_inc_time / 60 -legend Time consumption (5 min) -y_legend Minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_time_usage -} - -plot { -title %g Radius sessions -source orca_services -line_type line2 -data rad_sessions -legend Number of Sessions (5 min) -y_legend Terminated Sessions -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_sessions -} - -plot { -title %g Radius accumulated sessions -source orca_services -line_type line2 -data radius_inc_sessions -legend Number of Sessions (5 min) -y_legend Terminated Sessions -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_sessions -} - - - -plot { -title %g NAMED CPU Usage in 10 minutes -source orca_services -data dns_cpu_u -data dns_cpu_s -data dns_ccpu_u -data dns_ccpu_s -line_type line2 -line_type line2 -line_type line2 -line_type line2 -legend User -legend System -legend Child User -legend Child System -y_legend Seconds in 10 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_CPU_Usage_in_1_hour -} - -plot { -title %g NAMED Major queries -source orca_services -data dns_a -data dns_ptr -data dns_mx -data dns_any -line_type line2 -line_type line2 -line_type line2 -line_type line2 -legend A -legend PTR -legend MX -legend ANY -y_legend Units in 10 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Major_queries -} - -plot { -title %g NAMED Minor queries -source orca_services -data dns_ns -data dns_soa -data dns_axfr -data dns_aaaa -data dns_other -line_type line2 -line_type line2 -line_type line2 -line_type line2 -line_type line2 -legend NS -legend SOA -legend AXFR -legend AAAA -legend OTHER -y_legend Units in 10 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Minor_queries -} - -plot { -title %g NAMED Received -source orca_services -data dns_rr -data dns_rq -data dns_rother -line_type line2 -line_type line2 -line_type line2 -legend R-Responses -legend R-Queries -legend R-OTHER -y_legend Units in 10 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Received -} - -plot { -title %g NAMED Sent -source orca_services -data dns_sans -data dns_snaans -data dns_snxd -data dns_sother -line_type line2 -line_type line2 -line_type line2 -line_type line2 -legend S-Answer -legend S-NA Answer -legend S-Negative -legend S-OTHER -y_legend Units in 10 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Sent -} - -plot { -title %g HTTP Processes -source orca_services -data http_procs -line_type line2 -legend HTTP Processes -y_legend Number of processes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_Processes -} - -plot { -title %g HTTP requests -source orca_services -data http_hits -data http_condgets -data http_gets -data http_heads -data http_posts -data http_errors -data http_undefs -line_type line2 -line_type line2 -line_type line2 -line_type line2 -line_type line2 -line_type line2 -line_type line2 -legend HIT -legend cond GET -legend GET -legend HEAD -legend POST -legend Errors -legend Undefs -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_requests -} - -plot { -title %g HTTP Bps -source orca_services -data http_Bps -line_type line2 -legend HTTP bandwidth -y_legend BYTES per Second -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_Bps -} - -plot { -title %g HTTP request size -source orca_services -data http_1k * 100 -data http_10k * 100 -data http_100k * 100 -data http_1000k * 100 -data http_1M * 100 -line_type area -line_type stack -line_type stack -line_type stack -line_type stack -legend % of < 1Kb requests -legend % of < 10Kb requests -legend % of < 100Kb requests -legend % of < 1000Kb requests -legend % of > 1Mb requests -y_legend Percent -data_min 0 -data_max 120 -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_request_size -} - - - -plot { -title %g NNTP Statistics in 5 minutes -source orca_services -data nntpcache_connects -data nntpcache_groups -data nntpcache_articles -legend Connects (5m) -legend GROUPs (5m) -legend ARTICLEs (5m) -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html -} - -plot { -title %g SLAPD Statistics in 5 minutes -source orca_services -data slapd_binds -data slapd_searchs -legend BINDs (5m) -legend SRCHs (5m) -y_legend Units in 5 minutes -data_min 0 -data_max U -href http://o-s.kpnqwest.pt/orca_services.html -} - From sean at seanoneill.info Sun Mar 9 13:02:31 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Sun, 9 Mar 2003 13:02:31 -0800 Subject: [Orca-checkins] rev 210 - in branches/orca/import_orca_services_2.0: . lib/Orca_Services data_gatherers data_gatherers/orca_services Message-ID: <200303092102.h29L2VeE008878@orcaware.com> Author: sean at seanoneill.info Date: 2003-03-09 13:02:12 -0800 (Sun, 09 Mar 2003) New Revision: 210 Added: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_Orca_Services.sh.in Removed: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in Modified: branches/orca/import_orca_services_2.0/Makefile.in branches/orca/import_orca_services_2.0/configure.in branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Makefile.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.cfg.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services_running.pl.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/README branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_Orca_Services.sh.in branches/orca/import_orca_services_2.0/lib/Orca_Services/Output.pm branches/orca/import_orca_services_2.0/lib/Orca_Services/Radius.pm branches/orca/import_orca_services_2.0/lib/Orca_Services/Vars.pm Log: In branches/orca/import_orca_services_2.0: Moved: data_gatherers/orca_services/start_orca_services.sh.in -> data_gatherers/orca_services/start_Orca_Services.sh.in Modified: data_gatherers/orca_services/start_orca_services.sh.in Makefile.in configure.in data_gatherers/Makefile.in data_gatherers/orca_services/Makefile.in data_gatherers/orca_services/Orca_Services.cfg.in data_gatherers/orca_services/Orca_Services.pl.in data_gatherers/orca_services/Orca_Services_running.pl.in data_gatherers/orca_services/README data_gatherers/orca_services/S99Orca_Services.sh.in data_gatherers/orca_services/restart_Orca_Services.sh.in data_gatherers/orca_services/stop_Orca_Services.sh.in lib/Orca_Services/Output.pm lib/Orca_Services/Radius.pm lib/Orca_Services/Vars.pm Log: * In all files above, change all references of orca_services (and a couple of Orca_services) to Orca_Services. * lib/Orca_Services/Vars.pm In addition to changes for Orca_Services, also changed "outputdir" hash value to "@VAR_DIR@/Orca_Services" and "compress" hash value to "@COMPRESSOR@". This file needs to be moved to Vars.pm.in next so these variables will be substituted correctly during configuration. Modified: branches/orca/import_orca_services_2.0/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/Makefile.in 2003-03-09 13:02:23.000000000 -0800 @@ -50,8 +50,8 @@ orcallator_run_at_boot: cd data_gatherers/orcallator && $(MAKE) orcallator_run_at_boot -orca_services_run_at_boot: - cd data_gatherers/orca_services && $(MAKE) orca_services_run_at_boot +Orca_Services_run_at_boot: + cd data_gatherers/Orca_Services && $(MAKE) Orca_Services_run_at_boot test_modules: cd packages && $(MAKE) CFLAGS="$(CFLAGS)" test_modules Modified: branches/orca/import_orca_services_2.0/configure.in ============================================================================== --- branches/orca/import_orca_services_2.0/configure.in (original) +++ branches/orca/import_orca_services_2.0/configure.in 2003-03-09 13:02:23.000000000 -0800 @@ -510,14 +510,14 @@ contrib/rotate_orca_graphs/rotate_orca_graphs.sh data_gatherers/Makefile $ORCALLATOR_OUTPUT - data_gatherers/orca_services/Makefile - data_gatherers/orca_services/orca_services.cfg - data_gatherers/orca_services/orca_services.pl - data_gatherers/orca_services/orca_services_running.pl - data_gatherers/orca_services/restart_orca_services.sh - data_gatherers/orca_services/start_orca_services.sh - data_gatherers/orca_services/stop_orca_services.sh - data_gatherers/orca_services/S99orca_services.sh + data_gatherers/Orca_Services/Makefile + data_gatherers/Orca_Services/Orca_Services.cfg + data_gatherers/Orca_Services/Orca_Services.pl + data_gatherers/Orca_Services/Orca_Services_running.pl + data_gatherers/Orca_Services/restart_Orca_Services.sh + data_gatherers/Orca_Services/start_Orca_Services.sh + data_gatherers/Orca_Services/stop_Orca_Services.sh + data_gatherers/Orca_Services/S99Orca_Services.sh docs/Makefile lib/Makefile packages/Makefile Modified: branches/orca/import_orca_services_2.0/lib/Orca_Services/Radius.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_Services/Radius.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_Services/Radius.pm 2003-03-09 13:02:23.000000000 -0800 @@ -40,7 +40,7 @@ use IO::File; use Sys::Syslog; use Orca_Services::Vars; - $Services{Radius}{File} = "/usr/local/lib/orca_services.DB.$nodename"; + $Services{Radius}{File} = "/usr/local/lib/Orca_Services.DB.$nodename"; $Services{Radius}{FileD} = ""; $Services{Radius}{Ok} = -1; $Services{Radius}{External} = 1; @@ -126,7 +126,7 @@ $mon++; - $BASE_ACCUM_radius_DB="/var/orca/orca_services/$nodename"; + $BASE_ACCUM_radius_DB="/var/orca/Orca_Services/$nodename"; if ($mon<10) { $ACCUM_radius_DB= "$BASE_ACCUM_radius_DB/radiatorRadiusAccum.$year"."0"."$mon.txt"; } else { Modified: branches/orca/import_orca_services_2.0/lib/Orca_Services/Vars.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_Services/Vars.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_Services/Vars.pm 2003-03-09 13:02:23.000000000 -0800 @@ -50,7 +50,7 @@ # use vars qw($progname); push(@EXPORT, qw($progname)); -$progname = "orca_services"; +$progname = "Orca_Services"; # # vars for syslogging @@ -96,8 +96,8 @@ push(@EXPORT, qw(%Services %Options %PrgOptions %HelpText)); %Services=(); %Options=("interval" => 300, - "outputdir" => "/opt/SWorca/var/orca/orca_services", - "compress" => "/usr/bin/gzip -9", + "outputdir" => "@VAR_DIR@/Orca_Services", + "compress" => "@COMPRESSOR@", "debug" => 0, "help" => 0 ); Modified: branches/orca/import_orca_services_2.0/lib/Orca_Services/Output.pm ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Orca_Services/Output.pm (original) +++ branches/orca/import_orca_services_2.0/lib/Orca_Services/Output.pm 2003-03-09 13:02:24.000000000 -0800 @@ -83,10 +83,10 @@ $now_string = strftime "%Y-%m-%d", localtime; my $subday = 0; - my $tempfilename = "$outputdir/orca_services-" . $now_string . "-" . sprintf("%03d", $subday); + my $tempfilename = "$outputdir/Orca_Services-" . $now_string . "-" . sprintf("%03d", $subday); while (-f $tempfilename) { $subday ++; - $tempfilename = "$outputdir/orca_services-" . $now_string . "-" . sprintf("%03d", $subday); + $tempfilename = "$outputdir/Orca_Services-" . $now_string . "-" . sprintf("%03d", $subday); } $OutputFilename = $tempfilename; Modified: branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in 2003-03-09 13:02:24.000000000 -0800 @@ -1,7 +1,7 @@ @SET_MAKE@ SUBDIRS = orcallator \ - orca_services + Orca_Services all: Makefile $(TARGETS) @for dir in $(SUBDIRS); do \ @@ -12,8 +12,8 @@ orcallator_run_at_boot: cd orcallator && $(MAKE) orcallator_run_at_boot -orca_services_run_at_boot: - cd orca_services && $(MAKE) orca_services_run_at_boot +Orca_Services_run_at_boot: + cd Orca_Services && $(MAKE) Orca_Services_run_at_boot install: @for dir in $(SUBDIRS); do \ Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Makefile.in 2003-03-09 13:02:24.000000000 -0800 @@ -13,21 +13,21 @@ RRD_DIR = @RRD_DIR@ INIT_D_DIR = @INIT_D_DIR@ RCX_D_CONTAINING_DIR = @RCX_D_CONTAINING_DIR@ -RAW_ORCA_SERVICES_DIR = $(VAR_DIR)/orca_services -RRD_ORCA_SERVICES_DIR = $(RRD_DIR)/orca_services +RAW_ORCA_SERVICES_DIR = $(VAR_DIR)/Orca_Services +RRD_ORCA_SERVICES_DIR = $(RRD_DIR)/Orca_Services -BIN_PERL_SCRIPTS = orca_services_running -LIBEXEC_PERL_SCRIPTS = orca_services +BIN_PERL_SCRIPTS = Orca_Services_running +LIBEXEC_PERL_SCRIPTS = Orca_Services NOINST_PERL_SCRIPTS = PERL_SCRIPTS = $(BIN_PERL_SCRIPTS) \ $(LIBEXEC_PERL_SCRIPTS) \ $(NOINST_PERL_SCRIPTS) -BIN_SHELL_SCRIPTS = restart_orca_services \ - stop_orca_services \ - start_orca_services -LIBEXEC_SHELL_SCRIPTS = orca_services -NOINST_SHELL_SCRIPTS = S99orca_services +BIN_SHELL_SCRIPTS = restart_Orca_Services \ + stop_Orca_Services \ + start_Orca_Services +LIBEXEC_SHELL_SCRIPTS = Orca_Services +NOINST_SHELL_SCRIPTS = S99Orca_Services SHELL_SCRIPTS = $(BIN_SHELL_SCRIPTS) \ $(LIBEXEC_SHELL_SCRIPTS) \ $(NOINST_SHELL_SCRIPTS) @@ -39,7 +39,7 @@ LIBEXEC_TARGETS = $(LIBEXEC_PERL_SCRIPTS) \ $(LIBEXEC_SHELL_SCRIPTS) -all: Makefile $(TARGETS) orca_services.cfg +all: Makefile $(TARGETS) Orca_Services.cfg install: all $(MKDIR) $(bindir) @@ -55,28 +55,28 @@ echo $(INSTALL) $$file $(libexecdir); \ $(INSTALL) $$file $(libexecdir); \ done - if test -r $(sysconfdir)/orca_services.cfg; then \ - cp -p $(sysconfdir)/orca_services.cfg $(sysconfdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + if test -r $(sysconfdir)/Orca_Services.cfg; then \ + cp -p $(sysconfdir)/Orca_Services.cfg $(sysconfdir)/Orca_Services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ fi - $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir) + $(INSTALL) -m 0644 Orca_Services.cfg $(sysconfdir) -orca_services_run_at_boot: all +Orca_Services_run_at_boot: all test "$(INIT_D_DIR)" test "$(RCX_D_CONTAINING_DIR)" - -$(RM) $(INIT_D_DIR)/orca_services - -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01orca_services - -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01orca_services - -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99orca_services - $(INSTALL) -m 0744 S99orca_services $(INIT_D_DIR)/orca_services - ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc0.d/K01orca_services - ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc1.d/K01orca_services - ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc3.d/S99orca_services + -$(RM) $(INIT_D_DIR)/Orca_Services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01Orca_Services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01Orca_Services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99Orca_Services + $(INSTALL) -m 0744 S99Orca_Services $(INIT_D_DIR)/Orca_Services + ln $(INIT_D_DIR)/Orca_Services $(RCX_D_CONTAINING_DIR)/rc0.d/K01Orca_Services + ln $(INIT_D_DIR)/Orca_Services $(RCX_D_CONTAINING_DIR)/rc1.d/K01Orca_Services + ln $(INIT_D_DIR)/Orca_Services $(RCX_D_CONTAINING_DIR)/rc3.d/S99Orca_Services clean: $(RM) $(TARGETS) distclean: clean - $(RM) *.sh orca_services.cfg orca_services_running.pl Makefile + $(RM) *.sh Orca_Services.cfg Orca_Services_running.pl Makefile .SUFFIXES: .pl .sh @@ -89,26 +89,26 @@ chmod 0755 $@ Makefile: Makefile.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/Makefile ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Makefile ./config.status $(MAKE) -orca_services.cfg: orca_services.cfg.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.cfg ./config.status +Orca_Services.cfg: Orca_Services.cfg.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Orca_Services.cfg ./config.status -orca_services.pl: orca_services.pl.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.pl ./config.status +Orca_Services.pl: Orca_Services.pl.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Orca_Services.pl ./config.status -orca_services_running.pl: orca_services_running.pl.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services_running.pl ./config.status +Orca_Services_running.pl: Orca_Services_running.pl.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Orca_Services_running.pl ./config.status -restart_orca_services.sh: restart_orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/restart_orca_services.sh ./config.status +restart_Orca_Services.sh: restart_Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/restart_Orca_Services.sh ./config.status -start_orca_services.sh: start_orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/start_orca_services.sh ./config.status +start_Orca_Services.sh: start_Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/start_Orca_Services.sh ./config.status -stop_orca_services.sh: stop_orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/stop_orca_services.sh ./config.status +stop_Orca_Services.sh: stop_Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/stop_Orca_Services.sh ./config.status -S99orca_services.sh: S99orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/S99orca_services.sh ./config.status +S99Orca_Services.sh: S99Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/S99Orca_Services.sh ./config.status Copied: start_Orca_Services.sh.in (from rev 209, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in) Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services_running.pl.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services_running.pl.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services_running.pl.in 2003-03-09 13:02:24.000000000 -0800 @@ -1,4 +1,4 @@ -# orca_services_running: warn if orca_services files are not up to date. +# Orca_Services_running: warn if Orca_Services files are not up to date. # # Copyright (C) 2000 Carlos Canau and KPNQwest Portugal # Copyright (C) 1998, 1999 Blair Zajac and Yahoo!, Inc. @@ -8,7 +8,7 @@ # Set this to the list of directories that contain the output from # percoservices.se. -my @stats_dirs = ('@VAR_DIR@/orca_services'); +my @stats_dirs = ('@VAR_DIR@/Orca_Services'); foreach my $stats_dir (@stats_dirs) { Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.pl.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.pl.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.pl.in 2003-03-09 13:02:24.000000000 -0800 @@ -1,4 +1,4 @@ -# orca_services.pl, a log generating services usage monitor +# Orca_Services.pl, a log generating services usage monitor # # This program logs many different services usage to a log file # for later processing. Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_Orca_Services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_Orca_Services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_Orca_Services.sh.in 2003-03-09 13:02:24.000000000 -0800 @@ -1,12 +1,12 @@ #!/bin/sh -# This stops and restarts orca_services. +# This stops and restarts Orca_Services. prefix=@prefix@ exec_prefix=@exec_prefix@ bindir=@bindir@ -# Kill any running orca_servicess. -$bindir/stop_orca_services +# Kill any running Orca_Servicess. +$bindir/stop_Orca_Services -# Start the orca_services. -$bindir/start_orca_services +# Start the Orca_Services. +$bindir/start_Orca_Services Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_Orca_Services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_Orca_Services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_Orca_Services.sh.in 2003-03-09 13:02:24.000000000 -0800 @@ -12,16 +12,16 @@ PSCMD="/usr/ucb/ps" # Solaris fi -pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` +pids=`$PSCMD auxww | $AWK '/Orca_Services/ && !/awk/ && !/stop_Orca_Services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then echo "Killing pids $pids." kill -HUP $pids sleep 1 - pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` + pids=`$PSCMD auxww | $AWK '/Orca_Services/ && !/awk/ && !/stop_Orca_Services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then kill -TERM $pids sleep 1 - pids=`$PSCMD auxww | $AWK '/orca_services/ && !/awk/ && !/stop_orca_services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` + pids=`$PSCMD auxww | $AWK '/Orca_Services/ && !/awk/ && !/stop_Orca_Services/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` if test "$pids" != ""; then kill -9 $pids sleep 1 Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.cfg.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.cfg.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.cfg.in 2003-03-09 13:02:24.000000000 -0800 @@ -1,4 +1,4 @@ -# Orca configuration file for orca_services files. +# Orca configuration file for Orca_Services files. # Require at least this version of Orca. require 0.27 @@ -6,7 +6,7 @@ # base_dir is prepended to the paths find_files, html_dir, rrd_dir, # and state_file only if the path does not match the regular # expression ^\\?\.{0,2}/, which matches /, ./, ../, and \./. -base_dir @RRD_DIR@/orca_services +base_dir @RRD_DIR@/Orca_Services # rrd_dir specifies the location of the generated RRD data files. If # rrd_dir is a relative path, then it is made relative to base_dir if @@ -18,15 +18,15 @@ # relative path, then it is made relative to base_dir is base_dir is # set. state_file orca.state -html_dir @HTML_DIR@/orca_services +html_dir @HTML_DIR@/Orca_Services # By default create .meta tag files for all PNGs or GIFs so that the # web browser will automatically reload them. expire_images 1 # Find files at the following times: -# 0:10 to pick up new orca_services files for the new day. -# 1:00 to pick up late comer orca_services files for the new day. +# 0:10 to pick up new Orca_Services files for the new day. +# 1:00 to pick up late comer Orca_Services files for the new day. # 6:00 to pick up new files before the working day. # 12:00 to pick up new files during the working day. # 19:00 to pick up new files after the working day. @@ -58,11 +58,11 @@ # generate a subgroup name, hence all the (?:...) for matching # anything else. # interval -# The interval here must match the interval used by orca_services to +# The interval here must match the interval used by Orca_Services to # record data. Do not change this, as it has an effect on the # generated RRD data files. -group orca_services { -find_files @VAR_DIR@/orca_services/(.*)/(?:(?:orca_services)|(?:orcaservices))-\d{4}-\d{2}-\d{2}(?:-\d{3,})?(?:\.(?:Z|gz|bz2))? +group Orca_Services { +find_files @VAR_DIR@/Orca_Services/(.*)/(?:(?:Orca_Services)|(?:orcaservices))-\d{4}-\d{2}-\d{2}(?:-\d{3,})?(?:\.(?:Z|gz|bz2))? column_description first_line date_source column_name timestamp interval 300 @@ -82,7 +82,7 @@ # # ATTENTION: change this to your values # -html_top_title Orca_services Status +html_top_title Orca_Services Status # # ATTENTION: change this to your values @@ -98,19 +98,19 @@ plot { title %g SMTP Mail Queue -source orca_services +source Orca_Services data mailq_total legend Msgs. in queue (5m) y_legend Number of Messages line_type line2 data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Mail_Queue +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_Mail_Queue } plot { title %g SMTP Messages in 5 minutes -source orca_services +source Orca_Services data smtp_from data smtp_sent legend Messages In (5m) @@ -118,12 +118,12 @@ y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Messages_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_Messages_in_5_minutes } plot { title %g SMTP Virus & Spam in 5 minutes -source orca_services +source Orca_Services data smtp_virus data smtp_spam legend Virus (5m) @@ -131,12 +131,12 @@ y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html +href http://o-s.kpnqwest.pt/Orca_Services.html } plot { title %g SMTP Failed -source orca_services +source Orca_Services data smtp_torf data smtp_c_ml data smtp_c_rt @@ -148,12 +148,12 @@ y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Failed +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_Failed } plot { title %g SMTP Size -source orca_services +source Orca_Services data smtp_sizes data smtp_tops line_type area @@ -163,12 +163,12 @@ y_legend Message size (bytes) data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Size +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_Size } plot { title %g SMTP Delay -source orca_services +source Orca_Services data smtp_delay data smtp_maxd line_type area @@ -178,12 +178,12 @@ y_legend Message Delay (seconds) data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Delay +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_Delay } plot { title %g SMTP Retries and Queueing -source orca_services +source Orca_Services data smtp_rtrs data smtp_queued legend Retries (5m) @@ -191,12 +191,12 @@ y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_Retries_and_Queueing +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_Retries_and_Queueing } plot { title %g SMTP DSN and Undefs -source orca_services +source Orca_Services data smtp_dsns data smtp_undf legend Number of DSNs (5m) @@ -204,18 +204,18 @@ y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#SMTP_DSN_and_Undefs +href http://o-s.kpnqwest.pt/Orca_Services.html#SMTP_DSN_and_Undefs } plot { title %g SMTP Over Quota in 5 minutes -source orca_services +source Orca_Services data smtp_overquota legend Over Quota (5m) y_legend Number of Messages data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html +href http://o-s.kpnqwest.pt/Orca_Services.html } @@ -223,7 +223,7 @@ plot { title %g MERIT RADIUS AUTH in 5 minutes -source orca_services +source Orca_Services data radius_auth data radius_auth_ok data radius_auth_nok @@ -233,12 +233,12 @@ y_legend Number of Auth Packets data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_AUTH_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#MERIT_RADIUS_AUTH_in_5_minutes } plot { title %g MERIT RADIUS ACCT in 5 minutes -source orca_services +source Orca_Services data radius_acct_start data radius_acct_stop legend Start records (5m) @@ -246,12 +246,12 @@ y_legend Number of Acct Packets data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_ACCT_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#MERIT_RADIUS_ACCT_in_5_minutes } plot { title %g MERIT RADIUS REMOTE AUTH in 5 minutes -source orca_services +source Orca_Services data radius_rem_auth data radius_rem_auth_ok data radius_rem_auth_nok @@ -261,25 +261,25 @@ y_legend Number of Remote Auth Packets data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_REMOTE_AUTH_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#MERIT_RADIUS_REMOTE_AUTH_in_5_minutes } plot { title %g MERIT RADIUS UNDEFS in 5 minutes -source orca_services +source Orca_Services data radius_undefs legend Undef lines (5m) y_legend Number of undef lines data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#MERIT_RADIUS_UNDEFS_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#MERIT_RADIUS_UNDEFS_in_5_minutes } plot { title %g POP SESSIONS in 5 minutes -source orca_services +source Orca_Services data pop_connect data pop_login data pop_logout @@ -289,12 +289,12 @@ y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_SESSIONS_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#POP_SESSIONS_in_5_minutes } plot { title %g POP DENIED in 5 minutes -source orca_services +source Orca_Services data pop_failure data pop_refused legend Failures (5m) @@ -302,12 +302,12 @@ y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_DENIED_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#POP_DENIED_in_5_minutes } plot { title %g POP FAILURES in 5 minutes -source orca_services +source Orca_Services data pop_net_error data pop_local_error legend Network errors (5m) @@ -315,73 +315,73 @@ y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_FAILURES_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#POP_FAILURES_in_5_minutes } plot { title %g POP UNDEFS in 5 minutes -source orca_services +source Orca_Services data pop_undefs legend Undefs (5m) y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#POP_UNDEFS_in_5_minutes +href http://o-s.kpnqwest.pt/Orca_Services.html#POP_UNDEFS_in_5_minutes } plot { title %g Radius time usage -source orca_services +source Orca_Services line_type line2 data rad_time / 60 legend Time consumption (5 min) y_legend Minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_time_usage +href http://o-s.kpnqwest.pt/Orca_Services.html#Radius_time_usage } plot { title %g Radius accumulated time usage -source orca_services +source Orca_Services line_type line2 data radius_inc_time / 60 legend Time consumption (5 min) y_legend Minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_time_usage +href http://o-s.kpnqwest.pt/Orca_Services.html#Radius_time_usage } plot { title %g Radius sessions -source orca_services +source Orca_Services line_type line2 data rad_sessions legend Number of Sessions (5 min) y_legend Terminated Sessions data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_sessions +href http://o-s.kpnqwest.pt/Orca_Services.html#Radius_sessions } plot { title %g Radius accumulated sessions -source orca_services +source Orca_Services line_type line2 data radius_inc_sessions legend Number of Sessions (5 min) y_legend Terminated Sessions data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#Radius_sessions +href http://o-s.kpnqwest.pt/Orca_Services.html#Radius_sessions } plot { title %g NAMED CPU Usage in 10 minutes -source orca_services +source Orca_Services data dns_cpu_u data dns_cpu_s data dns_ccpu_u @@ -397,12 +397,12 @@ y_legend Seconds in 10 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_CPU_Usage_in_1_hour +href http://o-s.kpnqwest.pt/Orca_Services.html#NAMED_CPU_Usage_in_1_hour } plot { title %g NAMED Major queries -source orca_services +source Orca_Services data dns_a data dns_ptr data dns_mx @@ -418,12 +418,12 @@ y_legend Units in 10 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Major_queries +href http://o-s.kpnqwest.pt/Orca_Services.html#NAMED_Major_queries } plot { title %g NAMED Minor queries -source orca_services +source Orca_Services data dns_ns data dns_soa data dns_axfr @@ -442,12 +442,12 @@ y_legend Units in 10 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Minor_queries +href http://o-s.kpnqwest.pt/Orca_Services.html#NAMED_Minor_queries } plot { title %g NAMED Received -source orca_services +source Orca_Services data dns_rr data dns_rq data dns_rother @@ -460,12 +460,12 @@ y_legend Units in 10 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Received +href http://o-s.kpnqwest.pt/Orca_Services.html#NAMED_Received } plot { title %g NAMED Sent -source orca_services +source Orca_Services data dns_sans data dns_snaans data dns_snxd @@ -481,24 +481,24 @@ y_legend Units in 10 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#NAMED_Sent +href http://o-s.kpnqwest.pt/Orca_Services.html#NAMED_Sent } plot { title %g HTTP Processes -source orca_services +source Orca_Services data http_procs line_type line2 legend HTTP Processes y_legend Number of processes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_Processes +href http://o-s.kpnqwest.pt/Orca_Services.html#HTTP_Processes } plot { title %g HTTP requests -source orca_services +source Orca_Services data http_hits data http_condgets data http_gets @@ -523,24 +523,24 @@ y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_requests +href http://o-s.kpnqwest.pt/Orca_Services.html#HTTP_requests } plot { title %g HTTP Bps -source orca_services +source Orca_Services data http_Bps line_type line2 legend HTTP bandwidth y_legend BYTES per Second data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_Bps +href http://o-s.kpnqwest.pt/Orca_Services.html#HTTP_Bps } plot { title %g HTTP request size -source orca_services +source Orca_Services data http_1k * 100 data http_10k * 100 data http_100k * 100 @@ -559,14 +559,14 @@ y_legend Percent data_min 0 data_max 120 -href http://o-s.kpnqwest.pt/orca_services.html#HTTP_request_size +href http://o-s.kpnqwest.pt/Orca_Services.html#HTTP_request_size } plot { title %g NNTP Statistics in 5 minutes -source orca_services +source Orca_Services data nntpcache_connects data nntpcache_groups data nntpcache_articles @@ -576,12 +576,12 @@ y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html +href http://o-s.kpnqwest.pt/Orca_Services.html } plot { title %g SLAPD Statistics in 5 minutes -source orca_services +source Orca_Services data slapd_binds data slapd_searchs legend BINDs (5m) @@ -589,6 +589,6 @@ y_legend Units in 5 minutes data_min 0 data_max U -href http://o-s.kpnqwest.pt/orca_services.html +href http://o-s.kpnqwest.pt/Orca_Services.html } Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99Orca_Services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99Orca_Services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99Orca_Services.sh.in 2003-03-09 13:02:24.000000000 -0800 @@ -6,19 +6,19 @@ case "$1" in 'start') - if [ -x $bindir/start_orca_services.sh ]; then + if [ -x $bindir/start_Orca_Services.sh ]; then umask 022 - $bindir/start_orca_services.sh + $bindir/start_Orca_Services.sh else - echo "$0: $bindir/start_orca_services.sh does not exist or is not executable." + echo "$0: $bindir/start_Orca_Services.sh does not exist or is not executable." fi ;; 'stop') - if [ -x $bindir/stop_orca_services.sh ]; then - $bindir/stop_orca_services.sh + if [ -x $bindir/stop_Orca_Services.sh ]; then + $bindir/stop_Orca_Services.sh else - echo "$0: $bindir/stop_orca_services.sh does not exist or is not executable." + echo "$0: $bindir/stop_Orca_Services.sh does not exist or is not executable." fi ;; Modified: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/README ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/README (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/README 2003-03-09 13:02:24.000000000 -0800 @@ -1,6 +1,6 @@ ## ## -## Orca_services: a log generating services usage monitor +## Orca_Services: a log generating services usage monitor ## ## @@ -22,29 +22,29 @@ ## PERL_SCRIPTS - orca_services_running - warn if orca_services files are not up to date. + Orca_Services_running + warn if Orca_Services files are not up to date. Not changed by canau. - orca_services + Orca_Services main data collector SHELL_SCRIPTS - restart_orca_services + restart_Orca_Services guess! - stop_orca_services + stop_Orca_Services I'll give you a hint... stopping - start_orca_services + start_Orca_Services need a hint, look above - S99orca_services - used for automatic start of orca_services + S99Orca_Services + used for automatic start of Orca_Services Other Files: - orca_services.cfg + Orca_Services.cfg Configuration of services to monitor graph details etc - $libdir/orca_services.$HOSTNAME + $libdir/Orca_Services.$HOSTNAME services can be disabled editing this file. $libdir defaults to /usr/local/lib @@ -52,7 +52,7 @@ the switch for input file and setting it to off: ex: --smtp_logfile=off - $libdir/orca_services.DB.$HOSTNAME + $libdir/Orca_Services.DB.$HOSTNAME $libdir defaults to /usr/local/lib auth info for accessing database SYNTAX: proto:drv:database:user:pass @@ -75,16 +75,16 @@ make make install - * if orca_services should run at boottime + * if Orca_Services should run at boottime - make orca_services_run_at_boot + make Orca_Services_run_at_boot - Most of the skeleton code of orca_services comes from orcallator. So + Most of the skeleton code of Orca_Services comes from orcallator. So everything is very similar. -4) You might need to edit orca_services to suit your needs. Look for +4) You might need to edit Orca_Services to suit your needs. Look for code need the ATTENTION string. You'll probably need to edit - orca_services.cfg.in. + Orca_Services.cfg.in. ########################################################################### @@ -121,13 +121,13 @@ RADIUS FROM DATABASE -------------------- -DEFAULT: $def_radius_auth = "/usr/local/lib/orca_services.DB.$nodename"; +DEFAULT: $def_radius_auth = "/usr/local/lib/Orca_Services.DB.$nodename"; DISABLE: --radius_db=off Reads Radius stop records from Database and do stats. You might need to change the SQL query in the code. You'll have - to create the orca_services.DB.$hostname file with the database + to create the Orca_Services.DB.$hostname file with the database options. MAILQ Deleted: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_orca_services.sh.in 2003-03-09 13:02:24.000000000 -0800 @@ -1,68 +0,0 @@ -#!/bin/sh - -# This script runs Orca_Services with the proper options for your site. - -# Define program locations that will be needed. -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libexecdir@ -AWK=@AWK@ -CUT=@CUT@ -UNAME=@UNAME@ -ORCA_SERVICES_DIR=@VAR_DIR@/Orca_Services - -# Get the hostname without the fully qualified part; that is, trim off -# anything past the first `.'. -uname=`$UNAME -n | $CUT -d. -f1` - -OPERSYS=`$UNAME -s` -if test "${OPERSYS}" = "Linux"; then - PSCMD="/bin/ps auxww" -else - PSCMD="/usr/bin/ps -ef" # Solaris -fi - -# The directory these files go into is $ORCA_SERVICES_DIR/HOSTNAME -OUTDIR=$ORCA_SERVICES_DIR/$uname - -# Export the environmental variables. -export OUTDIR - -# Check if Orca_Services is already running. -pids=`$PSCMD | $AWK '/Orca_Services/ && !/awk/ && !/start_Orca_Services/ && !/daemon/ && !/ \/etc\/init\.d/ && !/ \/etc\/rc/ {print $2}'` -if test "$pids" != ""; then - echo "Orca_Services already running. Exiting." - exit 1 -fi - -echo "Writing data into $OUTDIR/" - -# Cd to / so that any automounted filesystems can be unmounted. -cd / - -# Create the output directory if it doesn't exist yet. -if test ! -d $OUTDIR; then - echo "Creating $OUTDIR/" - mkdir -p $OUTDIR -fi - -if test ! -d $OUTDIR; then - echo "Unable to create $OUTDIR/" 1>&2 - exit 2 -fi - -# Now start the logging. -echo "Starting logging" -HOSTNAME=`hostname` -if test -f "$libdir/Orca_Services.$HOSTNAME"; then - $libdir/Orca_Services `cat $libdir/Orca_Services.$HOSTNAME` -else - $libdir/Orca_Services -fi - -### # Write the PID of Orca_Services to a file to make killing easier. -### pid=$! -### echo $pid > $OUTDIR/Orca_Services.pid - -# Sleep for a couple of seconds to allow any Orca_Services warnings to appear. -sleep 5 From sean at seanoneill.info Sun Mar 9 13:10:28 2003 From: sean at seanoneill.info (sean at seanoneill.info) Date: Sun, 9 Mar 2003 13:10:28 -0800 Subject: [Orca-checkins] rev 211 - in branches/orca/import_orca_services_2.0/data_gatherers: . Orca_Services Message-ID: <200303092110.h29LASnC008960@orcaware.com> Author: sean at seanoneill.info Date: 2003-03-09 13:10:09 -0800 (Sun, 09 Mar 2003) New Revision: 211 Added: branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/ branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/Orca_Services.cfg.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/Orca_Services.pl.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/Orca_Services_running.pl.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/S99Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/restart_Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/start_Orca_Services.sh.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/stop_Orca_Services.sh.in Removed: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/ Modified: branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/Makefile.in branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/README Log: In branches/orca/import_orca_services_2.0: Moved: data_gatherers/orca_services/ -> data_gatherers/Orca_Services/ Log: * Moved data_gathers/orca_services/ to data_gathers/Orca_Services/ Copied: Orca_Services (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services) Copied: start_Orca_Services.sh.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/start_Orca_Services.sh.in) Modified: branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/Makefile.in 2003-03-09 13:10:28.000000000 -0800 @@ -13,21 +13,21 @@ RRD_DIR = @RRD_DIR@ INIT_D_DIR = @INIT_D_DIR@ RCX_D_CONTAINING_DIR = @RCX_D_CONTAINING_DIR@ -RAW_ORCA_SERVICES_DIR = $(VAR_DIR)/orca_services -RRD_ORCA_SERVICES_DIR = $(RRD_DIR)/orca_services +RAW_ORCA_SERVICES_DIR = $(VAR_DIR)/Orca_Services +RRD_ORCA_SERVICES_DIR = $(RRD_DIR)/Orca_Services -BIN_PERL_SCRIPTS = orca_services_running -LIBEXEC_PERL_SCRIPTS = orca_services +BIN_PERL_SCRIPTS = Orca_Services_running +LIBEXEC_PERL_SCRIPTS = Orca_Services NOINST_PERL_SCRIPTS = PERL_SCRIPTS = $(BIN_PERL_SCRIPTS) \ $(LIBEXEC_PERL_SCRIPTS) \ $(NOINST_PERL_SCRIPTS) -BIN_SHELL_SCRIPTS = restart_orca_services \ - stop_orca_services \ - start_orca_services -LIBEXEC_SHELL_SCRIPTS = orca_services -NOINST_SHELL_SCRIPTS = S99orca_services +BIN_SHELL_SCRIPTS = restart_Orca_Services \ + stop_Orca_Services \ + start_Orca_Services +LIBEXEC_SHELL_SCRIPTS = Orca_Services +NOINST_SHELL_SCRIPTS = S99Orca_Services SHELL_SCRIPTS = $(BIN_SHELL_SCRIPTS) \ $(LIBEXEC_SHELL_SCRIPTS) \ $(NOINST_SHELL_SCRIPTS) @@ -39,7 +39,7 @@ LIBEXEC_TARGETS = $(LIBEXEC_PERL_SCRIPTS) \ $(LIBEXEC_SHELL_SCRIPTS) -all: Makefile $(TARGETS) orca_services.cfg +all: Makefile $(TARGETS) Orca_Services.cfg install: all $(MKDIR) $(bindir) @@ -55,28 +55,28 @@ echo $(INSTALL) $$file $(libexecdir); \ $(INSTALL) $$file $(libexecdir); \ done - if test -r $(sysconfdir)/orca_services.cfg; then \ - cp -p $(sysconfdir)/orca_services.cfg $(sysconfdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + if test -r $(sysconfdir)/Orca_Services.cfg; then \ + cp -p $(sysconfdir)/Orca_Services.cfg $(sysconfdir)/Orca_Services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ fi - $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir) + $(INSTALL) -m 0644 Orca_Services.cfg $(sysconfdir) -orca_services_run_at_boot: all +Orca_Services_run_at_boot: all test "$(INIT_D_DIR)" test "$(RCX_D_CONTAINING_DIR)" - -$(RM) $(INIT_D_DIR)/orca_services - -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01orca_services - -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01orca_services - -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99orca_services - $(INSTALL) -m 0744 S99orca_services $(INIT_D_DIR)/orca_services - ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc0.d/K01orca_services - ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc1.d/K01orca_services - ln $(INIT_D_DIR)/orca_services $(RCX_D_CONTAINING_DIR)/rc3.d/S99orca_services + -$(RM) $(INIT_D_DIR)/Orca_Services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc0.d/K01Orca_Services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc1.d/K01Orca_Services + -$(RM) $(RCX_D_CONTAINING_DIR)/rc3.d/S99Orca_Services + $(INSTALL) -m 0744 S99Orca_Services $(INIT_D_DIR)/Orca_Services + ln $(INIT_D_DIR)/Orca_Services $(RCX_D_CONTAINING_DIR)/rc0.d/K01Orca_Services + ln $(INIT_D_DIR)/Orca_Services $(RCX_D_CONTAINING_DIR)/rc1.d/K01Orca_Services + ln $(INIT_D_DIR)/Orca_Services $(RCX_D_CONTAINING_DIR)/rc3.d/S99Orca_Services clean: $(RM) $(TARGETS) distclean: clean - $(RM) *.sh orca_services.cfg orca_services_running.pl Makefile + $(RM) *.sh Orca_Services.cfg Orca_Services_running.pl Makefile .SUFFIXES: .pl .sh @@ -89,26 +89,26 @@ chmod 0755 $@ Makefile: Makefile.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/Makefile ./config.status + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Makefile ./config.status $(MAKE) -orca_services.cfg: orca_services.cfg.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.cfg ./config.status +Orca_Services.cfg: Orca_Services.cfg.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Orca_Services.cfg ./config.status -orca_services.pl: orca_services.pl.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services.pl ./config.status +Orca_Services.pl: Orca_Services.pl.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Orca_Services.pl ./config.status -orca_services_running.pl: orca_services_running.pl.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/orca_services_running.pl ./config.status +Orca_Services_running.pl: Orca_Services_running.pl.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/Orca_Services_running.pl ./config.status -restart_orca_services.sh: restart_orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/restart_orca_services.sh ./config.status +restart_Orca_Services.sh: restart_Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/restart_Orca_Services.sh ./config.status -start_orca_services.sh: start_orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/start_orca_services.sh ./config.status +start_Orca_Services.sh: start_Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/start_Orca_Services.sh ./config.status -stop_orca_services.sh: stop_orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/stop_orca_services.sh ./config.status +stop_Orca_Services.sh: stop_Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/stop_Orca_Services.sh ./config.status -S99orca_services.sh: S99orca_services.sh.in - cd ../.. && CONFIG_FILES=data_gatherers/orca_services/S99orca_services.sh ./config.status +S99Orca_Services.sh: S99Orca_Services.sh.in + cd ../.. && CONFIG_FILES=data_gatherers/Orca_Services/S99Orca_Services.sh ./config.status Copied: Orca_Services.cfg.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.cfg.in) Modified: branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/README ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/orca_services/README (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/README 2003-03-09 13:10:28.000000000 -0800 @@ -1,6 +1,6 @@ ## ## -## Orca_services: a log generating services usage monitor +## Orca_Services: a log generating services usage monitor ## ## @@ -22,29 +22,29 @@ ## PERL_SCRIPTS - orca_services_running - warn if orca_services files are not up to date. + Orca_Services_running + warn if Orca_Services files are not up to date. Not changed by canau. - orca_services + Orca_Services main data collector SHELL_SCRIPTS - restart_orca_services + restart_Orca_Services guess! - stop_orca_services + stop_Orca_Services I'll give you a hint... stopping - start_orca_services + start_Orca_Services need a hint, look above - S99orca_services - used for automatic start of orca_services + S99Orca_Services + used for automatic start of Orca_Services Other Files: - orca_services.cfg + Orca_Services.cfg Configuration of services to monitor graph details etc - $libdir/orca_services.$HOSTNAME + $libdir/Orca_Services.$HOSTNAME services can be disabled editing this file. $libdir defaults to /usr/local/lib @@ -52,7 +52,7 @@ the switch for input file and setting it to off: ex: --smtp_logfile=off - $libdir/orca_services.DB.$HOSTNAME + $libdir/Orca_Services.DB.$HOSTNAME $libdir defaults to /usr/local/lib auth info for accessing database SYNTAX: proto:drv:database:user:pass @@ -75,16 +75,16 @@ make make install - * if orca_services should run at boottime + * if Orca_Services should run at boottime - make orca_services_run_at_boot + make Orca_Services_run_at_boot - Most of the skeleton code of orca_services comes from orcallator. So + Most of the skeleton code of Orca_Services comes from orcallator. So everything is very similar. -4) You might need to edit orca_services to suit your needs. Look for +4) You might need to edit Orca_Services to suit your needs. Look for code need the ATTENTION string. You'll probably need to edit - orca_services.cfg.in. + Orca_Services.cfg.in. ########################################################################### @@ -121,13 +121,13 @@ RADIUS FROM DATABASE -------------------- -DEFAULT: $def_radius_auth = "/usr/local/lib/orca_services.DB.$nodename"; +DEFAULT: $def_radius_auth = "/usr/local/lib/Orca_Services.DB.$nodename"; DISABLE: --radius_db=off Reads Radius stop records from Database and do stats. You might need to change the SQL query in the code. You'll have - to create the orca_services.DB.$hostname file with the database + to create the Orca_Services.DB.$hostname file with the database options. MAILQ Copied: Orca_Services.pl.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services.pl.in) Copied: Orca_Services_running.pl.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/Orca_Services_running.pl.in) Copied: restart_Orca_Services.sh.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/restart_Orca_Services.sh.in) Copied: S99Orca_Services.sh.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/S99Orca_Services.sh.in) Copied: stop_Orca_Services.sh.in (from rev 210, branches/orca/import_orca_services_2.0/data_gatherers/orca_services/stop_Orca_Services.sh.in) From blair at orcaware.com Mon Mar 10 09:18:40 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Mon, 10 Mar 2003 09:18:40 -0800 Subject: [Orca-checkins] rev 212 - in trunk/orca: . packages packages/Digest-MD5-2.24 packages/Digest-MD5-2.24/t Message-ID: <200303101718.h2AHId4I008908@orcaware.com> Author: blair Date: 2003-03-10 09:17:57 -0800 (Mon, 10 Mar 2003) New Revision: 212 Added: trunk/orca/packages/Digest-MD5-2.24/ Removed: trunk/orca/packages/Digest-MD5-2.23/ Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Digest-MD5-2.24/Changes trunk/orca/packages/Digest-MD5-2.24/MD5.pm trunk/orca/packages/Digest-MD5-2.24/MD5.xs trunk/orca/packages/Digest-MD5-2.24/t/files.t Log: Upgrade Digest::MD5 from 2.23 to 2.24 and require the new version for Orca. * INSTALL: Update all references to Digest::MD5's version number from 2.23 to 2.24. * configure.in: Bump Digest::MD5's version number to 2.24. * packages/Digest-MD5-2.24: Renamed from packages/Digest-MD5-2.23. Directory contents updated from Digest-MD5-2.24.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-03-10 09:18:20.000000000 -0800 @@ -33,8 +33,8 @@ DATE_PARSE_VER=2.24 DEVEL_DPROF_DIR=DProf-19990108 DEVEL_DPROF_VER=19990108 -DIGEST_MD5_DIR=Digest-MD5-2.23 -DIGEST_MD5_VER=2.23 +DIGEST_MD5_DIR=Digest-MD5-2.24 +DIGEST_MD5_VER=2.24 MATH_INTERVALSEARCH_DIR=Math-Interpolate-1.05 MATH_INTERVALSEARCH_VER=1.05 RRDTOOL_DIR=rrdtool-1.0.41 Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-03-10 09:18:23.000000000 -0800 @@ -172,7 +172,7 @@ Data::Dumper >= 2.101 >= 2.101 2.101 Date::Parse Not required by Orca 2.24 Devel::DProf Not required by Orca 19990108 - Digest::MD5 >= 2.23 >= 2.23 2.23 + Digest::MD5 >= 2.24 >= 2.24 2.24 Math::IntervalSearch >= 1.05 >= 1.05 1.05 RRDs >= 1.000411 >= 1.0.41 1.0.41 Storable >= 2.06 >= 2.06 2.06 @@ -226,10 +226,10 @@ Digest::MD5 - http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.23.tar.gz + http://www.perl.com/CPAN/authors/id/G/GA/GAAS/Digest-MD5-2.24.tar.gz - % gunzip -c Digest-MD5-2.23.tar.gz | tar xvf - - % cd Digest-MD5-2.23 + % gunzip -c Digest-MD5-2.24.tar.gz | tar xvf - + % cd Digest-MD5-2.24 % perl Makefile.PL % make % make test Copied: Digest-MD5-2.24 (from rev 211, trunk/orca/packages/Digest-MD5-2.23) Modified: trunk/orca/packages/Digest-MD5-2.24/MD5.pm ============================================================================== --- trunk/orca/packages/Digest-MD5-2.23/MD5.pm (original) +++ trunk/orca/packages/Digest-MD5-2.24/MD5.pm 2003-03-10 09:18:23.000000000 -0800 @@ -3,7 +3,7 @@ use strict; use vars qw($VERSION @ISA @EXPORT_OK); -$VERSION = '2.23'; # $Date: 2003/01/19 04:42:15 $ +$VERSION = '2.24'; # $Date: 2003/03/09 15:23:10 $ require Exporter; *import = \&Exporter::import; Modified: trunk/orca/packages/Digest-MD5-2.24/t/files.t ============================================================================== --- trunk/orca/packages/Digest-MD5-2.23/t/files.t (original) +++ trunk/orca/packages/Digest-MD5-2.24/t/files.t 2003-03-10 09:18:24.000000000 -0800 @@ -20,27 +20,27 @@ my $EXPECT; if (ord "A" == 193) { # EBCDIC $EXPECT = < + + Release 2.24 + + Don't let the $^W test get confused by lexical warnings. + + Sync up with bleadperl; safer patchlevel include. + + + 2003-01-18 Gisle Aas Release 2.23 Modified: trunk/orca/packages/Digest-MD5-2.24/MD5.xs ============================================================================== --- trunk/orca/packages/Digest-MD5-2.23/MD5.xs (original) +++ trunk/orca/packages/Digest-MD5-2.24/MD5.xs 2003-03-10 09:18:24.000000000 -0800 @@ -1,4 +1,4 @@ -/* $Id: MD5.xs,v 1.35 2003/01/05 00:54:17 gisle Exp $ */ +/* $Id: MD5.xs,v 1.37 2003/03/09 15:20:43 gisle Exp $ */ /* * This library is free software; you can redistribute it and/or @@ -44,11 +44,23 @@ } #endif -#include "patchlevel.h" +#ifndef PATCHLEVEL +# include +# if !(defined(PERL_VERSION) || (SUBVERSION > 0 && defined(PATCHLEVEL))) +# include +# endif +#endif + #if PATCHLEVEL <= 4 && !defined(PL_dowarn) #define PL_dowarn dowarn #endif +#ifdef G_WARN_ON + #define DOWARN (PL_dowarn & G_WARN_ON) +#else + #define DOWARN PL_dowarn +#endif + #ifdef SvPVbyte #if PERL_REVISION == 5 && PERL_VERSION < 7 /* SvPVbyte does not work in perl-5.6.1, borrowed version for 5.7.3 */ @@ -658,7 +670,7 @@ PPCODE: MD5Init(&ctx); - if (PL_dowarn) { + if (DOWARN) { char *msg = 0; if (items == 1) { if (SvROK(ST(0))) { From blair at orcaware.com Tue Mar 11 09:54:00 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Tue, 11 Mar 2003 09:54:00 -0800 Subject: [Orca-checkins] rev 213 - in trunk/orca: . packages packages/Time-HiRes-1.43 Message-ID: <200303111754.h2BHrx9V022051@orcaware.com> Author: blair Date: 2003-03-11 09:53:22 -0800 (Tue, 11 Mar 2003) New Revision: 213 Added: trunk/orca/packages/Time-HiRes-1.43/ Removed: trunk/orca/packages/Time-HiRes-1.42/ Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Time-HiRes-1.43/Changes trunk/orca/packages/Time-HiRes-1.43/HiRes.pm trunk/orca/packages/Time-HiRes-1.43/Makefile.PL Log: Upgrade Time::HiRes from 1.42 to 1.43. * INSTALL (Determine which Perl modules need compiling and installing): Update all references to Time::HiRes's version number from 1.42 to 1.43. * configure.in: Bump Time::HiRes's version number to 1.43. * packages/Time-HiRes-1.43: Renamed from packages/Time-HiRes-1.42. Directory contents updated from Time-HiRes-1.43.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-03-11 09:53:39.000000000 -0800 @@ -41,8 +41,8 @@ RRDTOOL_VER=1.000411 STORABLE_DIR=Storable-2.06 STORABLE_VER=2.06 -TIME_HIRES_DIR=Time-HiRes-1.42 -TIME_HIRES_VER=1.42 +TIME_HIRES_DIR=Time-HiRes-1.43 +TIME_HIRES_VER=1.43 AC_SUBST(COMPRESS_ZLIB_DIR) AC_SUBST(DATA_DUMPER_DIR) Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-03-11 09:53:43.000000000 -0800 @@ -176,7 +176,7 @@ Math::IntervalSearch >= 1.05 >= 1.05 1.05 RRDs >= 1.000411 >= 1.0.41 1.0.41 Storable >= 2.06 >= 2.06 2.06 - Time::HiRes Not required by Orca 1.42 + Time::HiRes Not required by Orca 1.43 All seven of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), @@ -277,10 +277,10 @@ Time::HiRes - http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.42.tar.gz + http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.43.tar.gz - % gunzip -c Time-HiRes-1.42.tar.gz | tar xvf - - % cd Time-HiRes-1.42 + % gunzip -c Time-HiRes-1.43.tar.gz | tar xvf - + % cd Time-HiRes-1.43 % perl Makefile.PL % make % make test Copied: Time-HiRes-1.43 (from rev 212, trunk/orca/packages/Time-HiRes-1.42) Modified: trunk/orca/packages/Time-HiRes-1.43/HiRes.pm ============================================================================== --- trunk/orca/packages/Time-HiRes-1.42/HiRes.pm (original) +++ trunk/orca/packages/Time-HiRes-1.43/HiRes.pm 2003-03-11 09:53:43.000000000 -0800 @@ -15,7 +15,7 @@ d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer d_nanosleep); -$VERSION = '1.42'; +$VERSION = '1.43'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; Modified: trunk/orca/packages/Time-HiRes-1.43/Makefile.PL ============================================================================== --- trunk/orca/packages/Time-HiRes-1.42/Makefile.PL (original) +++ trunk/orca/packages/Time-HiRes-1.43/Makefile.PL 2003-03-11 09:53:43.000000000 -0800 @@ -71,7 +71,7 @@ my $TMPDIR = (grep(defined $_ && -d $_ && -w _, ((defined $ENV{'TMPDIR'} ? $ENV{'TMPDIR'} : undef), - qw(/var/tmp /usr/tmp /tmp))))[0]; + qw(/var/tmp /usr/tmp /tmp c:/temp))))[0]; $TMPDIR || die "Cannot find writable temporary directory.\n"; } Modified: trunk/orca/packages/Time-HiRes-1.43/Changes ============================================================================== --- trunk/orca/packages/Time-HiRes-1.42/Changes (original) +++ trunk/orca/packages/Time-HiRes-1.43/Changes 2003-03-11 09:53:43.000000000 -0800 @@ -1,5 +1,10 @@ Revision history for Perl extension Time::HiRes. +1.43 + - add c:/temp to the list of temp directories to probe + so that cygwin (and win*?) builds are happy. This was + needed at least in my cygwin 1.3.20/w2k setup. + 1.42 - modernize the constants code (from Nicholas Clark) @@ -8,10 +13,10 @@ for EXTERN.h (either a core perl build, or an installed perl) had broken (which lead into all test compiles failing with a core perl build, but thanks to the robustness of Makefile.PL - nothing of was visible). The brokenness seemed to be caused - by $ENV{PERL_CORE} not being on for core builds? Now stole - a trick from the Encode that sets $ENV{PERL_CORE} right, and - both styles of build should work again. + nothing of this was visible). The brokenness seemed to be + caused by $ENV{PERL_CORE} not being on for core builds? + Now stole a trick from the Encode that sets $ENV{PERL_CORE} + right, and both styles of build should work again. 1.40 - Nicholas Clark noticed that the my_catdir() emulation function From blair at orcaware.com Tue Mar 18 21:42:58 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Tue, 18 Mar 2003 21:42:58 -0800 Subject: [Orca-checkins] propchange - rev 207 svn:log Message-ID: <200303190542.h2J5gwFC006270@orcaware.com> Author: blair Revision: 207 Property Name: svn:log New Property Value: Modifications being made for new orca_services 2.0 release. orca_service 2.0 is a complete rewrite of orca_services. * data_gatherers/orca_services/S99orca_services.sh.in, data_gatherers/orca_services/orca_services.cfg.in, data_gatherers/orca_services/orca_services.pl.in, data_gatherers/orca_services/start_orca_services.sh.in, data_gatherers/orca_services/stop_orca_services.sh.in: Updated to orca_services 2.0. * lib/Makefile.in: Updated to orca_services 2.0. New section of code added to create new lib/Orca_services directory and copy contents during installation. * lib/Orca_services, lib/Orca_services/Dns.pm, lib/Orca_services/Http.pm, lib/Orca_services/Mailq.pm, lib/Orca_services/MeritRad.pm, lib/Orca_services/Nntp.pm, lib/Orca_services/Output.pm, lib/Orca_services/Pop.pm, lib/Orca_services/Radius.pm, lib/Orca_services/Sendmail.pm, lib/Orca_services/Slapd.pm, lib/Orca_services/Utils.pm, lib/Orca_services/Vars.pm: New directory lib/Orca_services and files added for orca_services 2.0. From blair at orcaware.com Tue Mar 18 21:46:51 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Tue, 18 Mar 2003 21:46:51 -0800 Subject: [Orca-checkins] rev 214 - trunk/orca/data_gatherers/orcallator Message-ID: <200303190546.h2J5kniX006364@orcaware.com> Author: blair Date: 2003-03-18 21:46:32 -0800 (Tue, 18 Mar 2003) New Revision: 214 Modified: trunk/orca/data_gatherers/orcallator/Makefile.in Log: * data_gatherers/orcallator/Makefile.in (install): It's rude to install a configuration file over an already existing configuration file. So instead of backing up the already installed configuration file into a filename that contains the current time, install the new configuration file into a filename that contains the current time. Modified: trunk/orca/data_gatherers/orcallator/Makefile.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/Makefile.in (original) +++ trunk/orca/data_gatherers/orcallator/Makefile.in 2003-03-18 21:46:45.000000000 -0800 @@ -53,10 +53,14 @@ $(INSTALL) $$file $(bindir); \ done $(INSTALL) -m 0644 orcallator.se $(libdir) - if test -r $(sysconfdir)/orcallator.cfg; then \ - cp -p $(sysconfdir)/orcallator.cfg $(sysconfdir)/orcallator.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + @if test -r $(sysconfdir)/orcallator.cfg; then \ + date="`date +%Y-%m-%d-%H:%M:%S`"; \ + echo $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir)/orcallator.cfg.$$date; \ + $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir)/orcallator.cfg.$$date; \ + else \ + echo $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir); \ + $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir); \ fi - $(INSTALL) -m 0644 orcallator.cfg $(sysconfdir) orcallator_run_at_boot: all test "$(INIT_D_DIR)" From blair at orcaware.com Wed Mar 19 10:43:36 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 19 Mar 2003 10:43:36 -0800 Subject: [Orca-checkins] rev 215 - trunk/orca Message-ID: <200303191843.h2JIhaOS024120@orcaware.com> Author: blair Date: 2003-03-19 10:43:28 -0800 (Wed, 19 Mar 2003) New Revision: 215 Modified: trunk/orca/configure.in Log: * configure.in: After configure completes configuring itself, it prints a rather tacky thank you message and a request to contribute to Orca. Make the ending message a friendlier to read and remove the "now ordering CD" joke. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-03-19 10:43:34.000000000 -0800 @@ -440,17 +440,6 @@ AC_SUBST(DISTCLEAN_TIME_HIRES) AC_SUBST(PERL_USE_TIME_HIRES) -# Build the RRDtool library if it is needed. -if test "$orca_cv_perl_rrds" = no; then - command="(cd packages/$RRDTOOL_DIR; ./configure $RRD_CONFIGURE_COMMAND_LINE)" - echo "" - echo "Running configure in packages/$RRDTOOL_DIR to create RRDtool and RRDs.pm." - echo "" - echo $command - echo "" - eval $command -fi - # Define the INSTALL and MKDIR variables to point to the scripts in # the config directory. INSTALL="$config_dir/install-sh -c" @@ -488,6 +477,18 @@ fi AC_SUBST(RCX_D_CONTAINING_DIR) +# Build the RRDtool library if it is needed. +if test "$orca_cv_perl_rrds" = no; then + command="(cd packages/$RRDTOOL_DIR; ./configure $RRD_CONFIGURE_COMMAND_LINE)" + echo "" + echo "Running configure in packages/$RRDTOOL_DIR to create RRDtool and RRDs.pm." + echo "" + echo $command + echo "" + eval $command + echo "" +fi + #-------------------------------------------------------------------- # Generate the Makefiles and shell scripts with the # variable substitutions. @@ -525,32 +526,26 @@ orca/orca.pl ) -echo +echo "" echo "----------------------------------------------------------------" echo "You have now successfully configured Orca." -echo +echo "" +echo "If you find Orca useful, please make a contribution to Orca's" +echo "author. Go to" +echo "" +echo " http://www.orcaware.com/orca/#happy_blair" +echo "" +echo "and choose your preferred method of sending happiness :)" +echo "Choices include making a donation or picking an item from" +echo "my family's Amazon.com wish list." +echo "" echo "Type 'make' to compile the software and use 'make install' to " -echo "install everything to: $prefix." -echo -echo "If you find Orca useful, make my wife and me happy. Go to" -echo "http://www.orcaware.com/wish_list.html and pick an item from our" -echo "Amazon.com wish list." -echo +echo "install everything into $prefix." +echo "" +echo "Thank you and enjoy Orca," echo "Blair Zajac " echo "----------------------------------------------------------------" -echo $ECHO_N "ordering CD from http://www.orcaware.com/wish_list.html $ECHO_C" 1>&6 -sleep 1 -echo $ECHO_N ".$ECHO_C" 1>&6 -sleep 1 -echo $ECHO_N ".$ECHO_C" 1>&6 -sleep 1 -echo $ECHO_N ".$ECHO_C" 1>&6 -sleep 1 -echo $ECHO_N ".$ECHO_C" 1>&6 -sleep 1 -AC_MSG_RESULT([ just kidding ;-)]) - case "$target" in *-solaris*) if test -z "$WEB_LOG"; then From blair at orcaware.com Wed Mar 19 11:14:10 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 19 Mar 2003 11:14:10 -0800 Subject: [Orca-checkins] rev 216 - trunk/orca/data_gatherers/orca_services Message-ID: <200303191914.h2JJEAJu012416@orcaware.com> Author: blair Date: 2003-03-19 11:14:01 -0800 (Wed, 19 Mar 2003) New Revision: 216 Modified: trunk/orca/data_gatherers/orca_services/Makefile.in Log: * data_gatherers/orca_services/Makefile.in It's rude to install a configuration file over an already existing configuration file. So instead of backing up the already installed configuration file into a filename that contains the current time, install the new configuration file into a filename that contains the current time. Modified: trunk/orca/data_gatherers/orca_services/Makefile.in ============================================================================== --- trunk/orca/data_gatherers/orca_services/Makefile.in (original) +++ trunk/orca/data_gatherers/orca_services/Makefile.in 2003-03-19 11:14:05.000000000 -0800 @@ -55,10 +55,14 @@ echo $(INSTALL) $$file $(libexecdir); \ $(INSTALL) $$file $(libexecdir); \ done - if test -r $(sysconfdir)/orca_services.cfg; then \ - cp -p $(sysconfdir)/orca_services.cfg $(sysconfdir)/orca_services.cfg.`date +%Y-%m-%d-%H:%M:%S`; \ + @if test -r $(sysconfdir)/orca_services.cfg; then \ + date="`date +%Y-%m-%d-%H:%M:%S`"; \ + echo $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir)/orca_services.cfg.$$date; \ + $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir)/orca_services.cfg.$$date; \ + else \ + echo $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir); \ + $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir); \ fi - $(INSTALL) -m 0644 orca_services.cfg $(sysconfdir) orca_services_run_at_boot: all test "$(INIT_D_DIR)" From blair at orcaware.com Wed Mar 19 11:54:18 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 19 Mar 2003 11:54:18 -0800 Subject: [Orca-checkins] rev 217 - trunk/orca/data_gatherers/orcallator Message-ID: <200303191954.h2JJsI95016382@orcaware.com> Author: blair Date: 2003-03-19 11:54:11 -0800 (Wed, 19 Mar 2003) New Revision: 217 Modified: trunk/orca/data_gatherers/orcallator/S99orcallator.sh.in Log: * data_gatherers/orcallator/S99orcallator.sh.in: Factor out the paths to start_orcallator and stop_orcallator. Convert tabs to 4 spaces. Modified: trunk/orca/data_gatherers/orcallator/S99orcallator.sh.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/S99orcallator.sh.in (original) +++ trunk/orca/data_gatherers/orcallator/S99orcallator.sh.in 2003-03-19 11:54:17.000000000 -0800 @@ -4,26 +4,29 @@ exec_prefix=@exec_prefix@ bindir=@bindir@ +start_orcallator="$bindir/start_orcallator" +stop_orcallator="$bindir/stop_orcallator" + case "$1" in 'start') - if [ -x $bindir/start_orcallator ]; then - umask 022 - $bindir/start_orcallator - else - echo "$0: $bindir/start_orcallator does not exist or is not executable." - fi - ;; + if [ -x $start_orcallator ]; then + umask 022 + $start_orcallator + else + echo "$0: $start_orcallator does not exist or is not executable." + fi + ;; 'stop') - if [ -x $bindir/stop_orcallator ]; then - $bindir/stop_orcallator - fi - ;; + if [ -x $stop_orcallator ]; then + $stop_orcallator + fi + ;; *) - echo "Usage: $0 { start | stop }" - exit 1 - ;; + echo "Usage: $0 { start | stop }" + exit 1 + ;; esac exit 0 From blair at orcaware.com Wed Mar 19 15:17:26 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 19 Mar 2003 15:17:26 -0800 Subject: [Orca-checkins] rev 218 - trunk/orca/data_gatherers/procallator Message-ID: <200303192317.h2JNHQFU030589@orcaware.com> Author: blair Date: 2003-03-19 15:17:18 -0800 (Wed, 19 Mar 2003) New Revision: 218 Modified: trunk/orca/data_gatherers/procallator/procallator.cfg Log: * data_gatherers/procallator/procallator.cfg: Whitespace only changes. In all plot {}'s, use tabs to separate the configuration parameters from the parameter values, not spaces. Modified: trunk/orca/data_gatherers/procallator/procallator.cfg ============================================================================== --- trunk/orca/data_gatherers/procallator/procallator.cfg (original) +++ trunk/orca/data_gatherers/procallator/procallator.cfg 2003-03-19 15:17:24.000000000 -0800 @@ -230,61 +230,60 @@ } plot { -title %g Page ins & outs rate -source orcallator -data pages_in +title %g Page ins & outs rate +source orcallator +data pages_in data pages_out -legend pages in/s +legend pages in/s legend pages out/s -y_legend Pages/s -data_min 0 +y_legend Pages/s +data_min 0 } plot { -title %g Swap ins & outs rate -source orcallator -data swap_in -data swap_out -legend Swap in/s -legend Swap out/s -y_legend Pages/s -data_min 0 +title %g Swap ins & outs rate +source orcallator +data swap_in +data swap_out +legend Swap in/s +legend Swap out/s +y_legend Pages/s +data_min 0 } plot { -title %g Context switches & Interrupts rate -source orcallator -data ctxt/s -data intr/s -legend Context switches -legend Interrupts -y_legend rate/s -data_min 0 +title %g Context switches & Interrupts rate +source orcallator +data ctxt/s +data intr/s +legend Context switches +legend Interrupts +y_legend rate/s +data_min 0 } - plot { -title %g Interface Input Bits Per Second -source orcallator -data 8 * if_in_b_(.*) -line_type line1 -legend $1 -y_legend Bits/s -data_min 0 -data_max 100000000 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_bits_per_second +title %g Interface Input Bits Per Second +source orcallator +data 8 * if_in_b_(.*) +line_type line1 +legend $1 +y_legend Bits/s +data_min 0 +data_max 100000000 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_bits_per_second } plot { -title %g Interface Ouput Bits Per Second -source orcallator -data 8 * if_out_b_(.*) -line_type line1 -legend $1 -y_legend Bits/s -data_min 0 -data_max 100000000 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_bits_per_second +title %g Interface Ouput Bits Per Second +source orcallator +data 8 * if_out_b_(.*) +line_type line1 +legend $1 +y_legend Bits/s +data_min 0 +data_max 100000000 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_bits_per_second } plot { @@ -301,16 +300,16 @@ } plot { -title %g Interface Output Packets Per Second -source orcallator -data if_out_p_(.*) -line_type line1 -legend $1 -y_legend Packets/s -data_min 0 -data_max 100000 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_packets_per_second +title %g Interface Output Packets Per Second +source orcallator +data if_out_p_(.*) +line_type line1 +legend $1 +y_legend Packets/s +data_min 0 +data_max 100000 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_packets_per_second } plot { @@ -326,65 +325,65 @@ } plot { -title %g Interface Output Errors Per Second -source orcallator -data if_out_e_(.*) -line_type line1 -legend $1 -y_legend Errors/s -data_min 0 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_errors_per_second +title %g Interface Output Errors Per Second +source orcallator +data if_out_e_(.*) +line_type line1 +legend $1 +y_legend Errors/s +data_min 0 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_errors_per_second } plot { -title %g Interface Input Dropped Per Second -source orcallator -data if_in_d_(.*) -line_type line1 -legend $1 -y_legend Errors/s -data_min 0 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_deferred_packet_rate +title %g Interface Input Dropped Per Second +source orcallator +data if_in_d_(.*) +line_type line1 +legend $1 +y_legend Errors/s +data_min 0 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_deferred_packet_rate } plot { -title %g Interface Output Dropped Per Second -source orcallator -data if_out_d_(.*) -line_type line1 -legend $1 -y_legend Errors/s -data_min 0 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_deferred_packet_rate +title %g Interface Output Dropped Per Second +source orcallator +data if_out_d_(.*) +line_type line1 +legend $1 +y_legend Errors/s +data_min 0 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_deferred_packet_rate } plot { -title %g Interface Output Collisions -source orcallator -data if_out_cl_(.*) -line_type area -legend $1 -y_legend Percent -data_min 0 -data_max 200 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_collisions +title %g Interface Output Collisions +source orcallator +data if_out_cl_(.*) +line_type area +legend $1 +y_legend Percent +data_min 0 +data_max 200 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_collisions } plot { -title %g Interface Output Carrier Losses -source orcallator -data if_out_ca_(.*) -line_type area -legend $1 -y_legend Percent -data_min 0 -data_max 200 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#interface_collisions +title %g Interface Output Carrier Losses +source orcallator +data if_out_ca_(.*) +line_type area +legend $1 +y_legend Percent +data_min 0 +data_max 200 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#interface_collisions } plot { @@ -404,37 +403,37 @@ legend $1 rate y_legend rate data_min 0 -flush_regexps 1 +flush_regexps 1 } plot { -title %g TCP statistics -source orcallator -data Tcp_(.*) -legend $1 rate -y_legend rate -data_min 0 -flush_regexps 1 +title %g TCP statistics +source orcallator +data Tcp_(.*) +legend $1 rate +y_legend rate +data_min 0 +flush_regexps 1 } plot { -title %g ICMP statistics -source orcallator -data Icmp_(.*) -legend $1 rate -y_legend rate -data_min 0 -flush_regexps 1 +title %g ICMP statistics +source orcallator +data Icmp_(.*) +legend $1 rate +y_legend rate +data_min 0 +flush_regexps 1 } plot { -title %g UDP statistics -source orcallator -data Udp_(.*) -legend $1 rate -y_legend rate -data_min 0 -flush_regexps 1 +title %g UDP statistics +source orcallator +data Udp_(.*) +legend $1 rate +y_legend rate +data_min 0 +flush_regexps 1 } plot { @@ -451,14 +450,14 @@ plot { title %g NFS Client Statistics -source orcallator -data nfs_c_(.*) -line_type line1 -legend $1/s -y_legend rate -data_min 0 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#NFS_server_call_rate +source orcallator +data nfs_c_(.*) +line_type line1 +legend $1/s +y_legend rate +data_min 0 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#NFS_server_call_rate } plot { @@ -472,7 +471,7 @@ legend Writes/s y_legend Ops/s data_min 0 -flush_regexps 1 +flush_regexps 1 href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_reads_writes_per_second } @@ -487,42 +486,40 @@ legend Write transfer rate y_legend Block/s data_min 0 -flush_regexps 1 +flush_regexps 1 href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_transfer_rate } plot { -title %g Disk Reads/Writes Per Second -source orcallator -data disk_rd_(.*)/s -data disk_wr_(.*)/s -line_type area -line_type line1 -legend $1 Reads/s -legend $1 Writes/s -y_legend Ops/s -data_min 0 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_reads_writes_per_second +title %g Disk Reads/Writes Per Second +source orcallator +data disk_rd_(.*)/s +data disk_wr_(.*)/s +line_type area +line_type line1 +legend $1 Reads/s +legend $1 Writes/s +y_legend Ops/s +data_min 0 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_reads_writes_per_second } plot { -title %g Disk Transfer Rate -source orcallator -data disk_rB_(.*)/s -data disk_wB_(.*)/s -line_type area -line_type line1 -legend $1 Read transfer rate -legend $1 Write transfer rate -y_legend Block/s -data_min 0 -flush_regexps 1 -href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_transfer_rate +title %g Disk Transfer Rate +source orcallator +data disk_rB_(.*)/s +data disk_wB_(.*)/s +line_type area +line_type line1 +legend $1 Read transfer rate +legend $1 Write transfer rate +y_legend Block/s +data_min 0 +flush_regexps 1 +href http://www.orcaware.com/orca/docs/orcallator.html#disk_system_wide_transfer_rate } - - plot { title %g Disk Space Percent Usage source orcallator @@ -548,13 +545,13 @@ line_type area line_type stack line_type line1 -line_type stack -line_type stack +line_type stack +line_type stack legend Used memory legend Free memory -legend shared memory -legend buffer memory -legend cached memory +legend shared memory +legend buffer memory +legend cached memory y_legend percent data_min 0 data_max 100 @@ -562,21 +559,20 @@ } plot { -title %g Swap usage percent -source orcallator -data swp_used% -data swp_free% -line_type area -line_type stack -legend Used swap -legend Free swap -y_legend percent -data_min 0 -data_max 100 -href http://www.orcaware.com/orca/docs/orcallator.html#memory_free +title %g Swap usage percent +source orcallator +data swp_used% +data swp_free% +line_type area +line_type stack +legend Used swap +legend Free swap +y_legend percent +data_min 0 +data_max 100 +href http://www.orcaware.com/orca/docs/orcallator.html#memory_free } - plot { title %g Memory Page Scan Rate source orcallator From blair at orcaware.com Wed Mar 19 18:47:36 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 19 Mar 2003 18:47:36 -0800 Subject: [Orca-checkins] rev 219 - in trunk/orca: orca lib/Orca Message-ID: <200303200247.h2K2lZex020516@orcaware.com> Author: blair Date: 2003-03-19 18:47:24 -0800 (Wed, 19 Mar 2003) New Revision: 219 Modified: trunk/orca/lib/Orca/HTMLFile.pm trunk/orca/orca/orca.pl.in Log: Long
's that go all the way across the page to the right edge of the browser's window don't look good. Use Orca::HTMLFile's
anywhere an
is needed, whose width is designed to match the Orca banner at the bottom of the HTML page. * lib/Orca/HTMLFile.pm: Make the module a subclass of the Exporter class so it can export $html_hr, which is set to the
string the module currently uses. * orca/orca.pl.in: (main): Use $html_hr from Orca::HTMLFile. (create_html_files): Any place a
was used, use $html_hr. One HTML plot had a missing
at the bottom of the page so that when html_page_footer was appended, this appended HTML markup started at the left side of the page. Modified: trunk/orca/orca/orca.pl.in ============================================================================== --- trunk/orca/orca/orca.pl.in (original) +++ trunk/orca/orca/orca.pl.in 2003-03-19 18:47:32.000000000 -0800 @@ -61,7 +61,7 @@ use Orca::Utils qw(name_to_fsname perl_glob unique); use Orca::SourceFile; use Orca::SourceFileIDs qw(@sfile_fids); -use Orca::HTMLFile; +use Orca::HTMLFile qw($html_hr); # Note the starting time of the script. my $start_time = time; @@ -711,7 +711,7 @@ my @images = sort {$a->plot_ref->{index} <=> $b->plot_ref->{index}} grep {$subgroup_name eq $_->subgroup_name} @{$image_files_ref->{list}}; if (@images > 1) { - my $href_html = "
"; + my $href_html = "$html_hr\n"; for (my $i=0; $i<@images; ++$i) { $href_html .= "[" . replace_subgroup_name($images[$i]->plot_ref->{title}, @@ -733,7 +733,7 @@ my $image_size = $image->image_src_size; foreach my $html_file (@html_files) { - $html_file->{fd}->print("
\n

$html_file->{Plot_Type} " . + $html_file->{fd}->print("$html_hr\n

$html_file->{Plot_Type} " . "$title

\n"); } @@ -754,7 +754,7 @@ } foreach my $html_file (@html_files) { - $html_file->{fd}->print("
\n"); + $html_file->{fd}->print("$html_hr\n"); } } @@ -769,8 +769,7 @@ $index_html->print("\n\n"); } - $index_html->print("
\n
\n" . - "

Available Data Sets

\n\n"); + $index_html->print("
\n$html_hr\n

Available Data Sets

\n\n"); # Here the different available plots are listed and the HTML files # created that contain the HREFs to the proper images. The HTML files @@ -854,7 +853,7 @@ my $fd = Orca::HTMLFile->new($filename, "${Plot_Type}${html_title_name} $legend_no_subgroup", $config_global{html_page_header}, - "
\n$config_global{html_page_footer}"); + "$html_hr\n$config_global{html_page_footer}"); unless ($fd) { warn "$0: warning: cannot create Orca::HTMLFile object: $@.\n"; next; @@ -881,7 +880,7 @@ # page easier. Do this if there are two or more subgroups in # this HTML page. if (@{$same_legends_image_list{$legend_no_subgroup}} > 1) { - $href_html .= "
\n"; + $href_html .= "$html_hr\n"; foreach my $legend_image (@{$same_legends_image_list{$legend_no_subgroup}}) { my $subgroup = $legend_image->subgroup_name; $href_html .= "[$subgroup]\n"; @@ -938,11 +937,12 @@ my $image_size = $image->image_src_size; foreach my $plot_type (@IMAGE_PLOT_TYPES) { my $Plot_Type = capatialize($plot_type); - $summarize_html->print("
\n

$Plot_Type $legend_with_subgroup

\n", + $summarize_html->print("$html_hr\n

$Plot_Type $legend_with_subgroup

\n", "\n"); } + $summarize_html->print("$html_hr\n"); # Now add the images into each HTML file. my $name = $image->name; @@ -951,7 +951,7 @@ my @legend_html_files = @{$legend_html_files{$legend_no_subgroup}}; if ($make_html_all_page) { - $legend_html_files[-1]{fd}->print("
\n

$subgroup_name $legend_no_subgroup

\n"); + $legend_html_files[-1]{fd}->print("$html_hr\n

$subgroup_name $legend_no_subgroup

\n"); } for (my $i=0; $i<@legend_html_files-$make_html_all_page; ++$i) { my $Plot_Type = $legend_html_files[$i]{Plot_Type}; @@ -959,7 +959,7 @@ $image_filename .= "$name-$legend_html_files[$i]{plot_type}.$IMAGE_SUFFIX"; my $html = "

\n"; - $legend_html_files[$i]{fd}->print("
\n

$Plot_Type $subgroup_name $legend_no_subgroup

\n"); + $legend_html_files[$i]{fd}->print("$html_hr\n

$Plot_Type $subgroup_name $legend_no_subgroup

\n"); $legend_html_files[$i]{fd}->print($html); if ($make_html_all_page) { $legend_html_files[-1]{fd}->print($html); @@ -971,7 +971,7 @@ if (@table_columns) { $index_html->print("" . join('', @table_columns) . "\n"); } - $index_html->print("\n\n
\n"); + $index_html->print("\n\n$html_hr\n"); } # Replace any %g with the subgroup and any %G's with a capitalized Modified: trunk/orca/lib/Orca/HTMLFile.pm ============================================================================== --- trunk/orca/lib/Orca/HTMLFile.pm (original) +++ trunk/orca/lib/Orca/HTMLFile.pm 2003-03-19 18:47:32.000000000 -0800 @@ -8,10 +8,15 @@ use strict; use Carp; use Orca::Constants qw($ORCA_VERSION); -use vars qw($VERSION); - +use vars qw(@EXPORT_OK @ISA $VERSION); + at ISA = qw(Exporter); $VERSION = substr q$Revision: 0.02 $, 10; +# $html_hr is the HTML
tag with the correct width attribute. +use vars qw($html_hr); +push(@EXPORT_OK, qw($html_hr)); +$html_hr = '
'; + # Use a blessed reference to an array as the storage for this class. # Define these constant subroutines as indexes into the array. If # the order of these indexes change, make sure to rearrange the @@ -70,7 +75,7 @@ $self->[$i_bottom]
-
+ $html_hr
From blair at orcaware.com Wed Mar 19 21:15:57 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Wed, 19 Mar 2003 21:15:57 -0800 Subject: [Orca-checkins] rev 220 - trunk/orca/data_gatherers/orcallator Message-ID: <200303200515.h2K5FvoD022818@orcaware.com> Author: blair Date: 2003-03-19 21:15:47 -0800 (Wed, 19 Mar 2003) New Revision: 220 Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in Log: * data_gatherers/orcallator/orcallator.cfg.in: Explicitly set the colors in the CPU Usage plot to match the colors in procallator. The main change is to change the idle CPU color from red to a pale yellow, thereby making it stand out less. Modified: trunk/orca/data_gatherers/orcallator/orcallator.cfg.in ============================================================================== --- trunk/orca/data_gatherers/orcallator/orcallator.cfg.in (original) +++ trunk/orca/data_gatherers/orcallator/orcallator.cfg.in 2003-03-19 21:15:54.000000000 -0800 @@ -178,6 +178,10 @@ plot_min 0 plot_max 100 rigid_min_max 1 +color 00ff00 +color ff0000 +color 0000ff +color ffffd0 href http://www.orcaware.com/orca/docs/orcallator.html#cpu_usage } From blair at orcaware.com Mon Mar 24 22:14:50 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Mon, 24 Mar 2003 22:14:50 -0800 Subject: [Orca-checkins] rev 221 - in branches/orca/import_orca_services_2.0: . lib data_gatherers Message-ID: <200303250614.h2P6Elc2023380@orcaware.com> Author: blair Date: 2003-03-24 22:14:25 -0800 (Mon, 24 Mar 2003) New Revision: 221 Added: branches/orca/import_orca_services_2.0/data_gatherers/orca_services/ branches/orca/import_orca_services_2.0/lib/Orca_services/ Removed: branches/orca/import_orca_services_2.0/data_gatherers/Orca_Services/ branches/orca/import_orca_services_2.0/lib/Orca_Services/ Modified: branches/orca/import_orca_services_2.0/Makefile.in branches/orca/import_orca_services_2.0/configure.in branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in branches/orca/import_orca_services_2.0/lib/Makefile.in Log: In the import_orca_services_2.0 branch, more files and directories were renamed from orca_services to Orca_Services than originally intended. Back out all of these renames to bring the branch back to the point where orca_services 2.0 was checked in, revision 207, using svn merge -r 211:207. At this commit, revision 211 is the last revision that modified this branch. Modified: branches/orca/import_orca_services_2.0/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/Makefile.in 2003-03-24 22:14:44.000000000 -0800 @@ -50,8 +50,8 @@ orcallator_run_at_boot: cd data_gatherers/orcallator && $(MAKE) orcallator_run_at_boot -Orca_Services_run_at_boot: - cd data_gatherers/Orca_Services && $(MAKE) Orca_Services_run_at_boot +orca_services_run_at_boot: + cd data_gatherers/orca_services && $(MAKE) orca_services_run_at_boot test_modules: cd packages && $(MAKE) CFLAGS="$(CFLAGS)" test_modules Modified: branches/orca/import_orca_services_2.0/configure.in ============================================================================== --- branches/orca/import_orca_services_2.0/configure.in (original) +++ branches/orca/import_orca_services_2.0/configure.in 2003-03-24 22:14:45.000000000 -0800 @@ -510,14 +510,14 @@ contrib/rotate_orca_graphs/rotate_orca_graphs.sh data_gatherers/Makefile $ORCALLATOR_OUTPUT - data_gatherers/Orca_Services/Makefile - data_gatherers/Orca_Services/Orca_Services.cfg - data_gatherers/Orca_Services/Orca_Services.pl - data_gatherers/Orca_Services/Orca_Services_running.pl - data_gatherers/Orca_Services/restart_Orca_Services.sh - data_gatherers/Orca_Services/start_Orca_Services.sh - data_gatherers/Orca_Services/stop_Orca_Services.sh - data_gatherers/Orca_Services/S99Orca_Services.sh + data_gatherers/orca_services/Makefile + data_gatherers/orca_services/orca_services.cfg + data_gatherers/orca_services/orca_services.pl + data_gatherers/orca_services/orca_services_running.pl + data_gatherers/orca_services/restart_orca_services.sh + data_gatherers/orca_services/start_orca_services.sh + data_gatherers/orca_services/stop_orca_services.sh + data_gatherers/orca_services/S99orca_services.sh docs/Makefile lib/Makefile packages/Makefile Modified: branches/orca/import_orca_services_2.0/lib/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/lib/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/lib/Makefile.in 2003-03-24 22:14:45.000000000 -0800 @@ -30,7 +30,7 @@ $(MKDIR) $(libdir)/Orca $(MKDIR) $(libdir)/SE/3.2.1 $(MKDIR) $(libdir)/SE/3.3 - $(MKDIR) $(libdir)/Orca_Services + $(MKDIR) $(libdir)/Orca_services @for f in Orca/*.pm; do \ echo $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ $(INSTALL) -m 0644 $$f $(libdir)/Orca; \ @@ -50,9 +50,9 @@ echo $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ $(INSTALL) -m 0644 $$f $(libdir)/SE/3.3; \ done - @for f in Orca_Services/*; do \ - echo $(INSTALL) -m 0644 $$f $(libdir)/Orca_Services; \ - $(INSTALL) -m 0644 $$f $(libdir)/Orca_Services; \ + @for f in Orca_services/*; do \ + echo $(INSTALL) -m 0644 $$f $(libdir)/Orca_services; \ + $(INSTALL) -m 0644 $$f $(libdir)/Orca_services; \ done clean: Copied: Orca_services (from rev 207, branches/orca/import_orca_services_2.0/lib/Orca_services) Modified: branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in ============================================================================== --- branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in (original) +++ branches/orca/import_orca_services_2.0/data_gatherers/Makefile.in 2003-03-24 22:14:45.000000000 -0800 @@ -1,7 +1,7 @@ @SET_MAKE@ SUBDIRS = orcallator \ - Orca_Services + orca_services all: Makefile $(TARGETS) @for dir in $(SUBDIRS); do \ @@ -12,8 +12,8 @@ orcallator_run_at_boot: cd orcallator && $(MAKE) orcallator_run_at_boot -Orca_Services_run_at_boot: - cd Orca_Services && $(MAKE) Orca_Services_run_at_boot +orca_services_run_at_boot: + cd orca_services && $(MAKE) orca_services_run_at_boot install: @for dir in $(SUBDIRS); do \ Copied: orca_services (from rev 207, branches/orca/import_orca_services_2.0/data_gatherers/orca_services) From blair at orcaware.com Tue Mar 25 21:04:32 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Tue, 25 Mar 2003 21:04:32 -0800 Subject: [Orca-checkins] rev 222 - trunk/orca Message-ID: <200303260504.h2Q54WGN021729@orcaware.com> Author: blair Date: 2003-03-25 21:04:13 -0800 (Tue, 25 Mar 2003) New Revision: 222 Modified: trunk/orca/HACKING Log: * HACKING (Writing log messages): Improve an example. Thanks to Matt Kraai on the Subversion mailing for the suggestion. Modified: trunk/orca/HACKING ============================================================================== --- trunk/orca/HACKING (original) +++ trunk/orca/HACKING 2003-03-25 21:04:28.000000000 -0800 @@ -270,10 +270,10 @@ example, if a patch resolves issue 1729, then the log message might be: - Fix issue #1729: + Fix issue #1729: Don't crash because of a missing file. * get_editor.c - (frobnicate_file): Check that file exists first. + (frobnicate_file): Check that file exists before frobnicating. For large changes or change groups, group the log entry into paragraphs separated by blank lines. Each paragraph should be a set From blair at orcaware.com Sun Mar 30 11:32:53 2003 From: blair at orcaware.com (blair at orcaware.com) Date: Sun, 30 Mar 2003 11:32:53 -0800 Subject: [Orca-checkins] rev 223 - in trunk/orca: . packages packages/Time-HiRes-1.44 packages/Time-HiRes-1.44/hints Message-ID: <200303301932.h2UJWrKD028454@orcaware.com> Author: blair Date: 2003-03-30 11:32:25 -0800 (Sun, 30 Mar 2003) New Revision: 223 Added: trunk/orca/packages/Time-HiRes-1.44/ trunk/orca/packages/Time-HiRes-1.44/hints/irix.pl Removed: trunk/orca/packages/Time-HiRes-1.43/ Modified: trunk/orca/INSTALL trunk/orca/configure.in trunk/orca/packages/Time-HiRes-1.44/Changes trunk/orca/packages/Time-HiRes-1.44/HiRes.pm trunk/orca/packages/Time-HiRes-1.44/MANIFEST Log: Upgrade Time::HiRes from 1.43 to 1.44. * INSTALL (Determine which Perl modules need compiling and installing): Update all references to Time::HiRes's version number from 1.43 to 1.44. * configure.in: Bump Time::HiRes's version number to 1.44. * packages/Time-HiRes-1.44: Renamed from packages/Time-HiRes-1.43. Directory contents updated from Time-HiRes-1.44.tar.gz. Modified: trunk/orca/configure.in ============================================================================== --- trunk/orca/configure.in (original) +++ trunk/orca/configure.in 2003-03-30 11:32:44.000000000 -0800 @@ -41,8 +41,8 @@ RRDTOOL_VER=1.000411 STORABLE_DIR=Storable-2.06 STORABLE_VER=2.06 -TIME_HIRES_DIR=Time-HiRes-1.43 -TIME_HIRES_VER=1.43 +TIME_HIRES_DIR=Time-HiRes-1.44 +TIME_HIRES_VER=1.44 AC_SUBST(COMPRESS_ZLIB_DIR) AC_SUBST(DATA_DUMPER_DIR) Modified: trunk/orca/INSTALL ============================================================================== --- trunk/orca/INSTALL (original) +++ trunk/orca/INSTALL 2003-03-30 11:32:45.000000000 -0800 @@ -176,7 +176,7 @@ Math::IntervalSearch >= 1.05 >= 1.05 1.05 RRDs >= 1.000411 >= 1.0.41 1.0.41 Storable >= 2.06 >= 2.06 2.06 - Time::HiRes Not required by Orca 1.43 + Time::HiRes Not required by Orca 1.44 All seven of these modules are included with the Orca distribution in the packages directory. When you configure Orca in step 3), @@ -277,10 +277,10 @@ Time::HiRes - http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.43.tar.gz + http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.44.tar.gz - % gunzip -c Time-HiRes-1.43.tar.gz | tar xvf - - % cd Time-HiRes-1.43 + % gunzip -c Time-HiRes-1.44.tar.gz | tar xvf - + % cd Time-HiRes-1.44 % perl Makefile.PL % make % make test Copied: Time-HiRes-1.44 (from rev 222, trunk/orca/packages/Time-HiRes-1.43) Modified: trunk/orca/packages/Time-HiRes-1.44/HiRes.pm ============================================================================== --- trunk/orca/packages/Time-HiRes-1.43/HiRes.pm (original) +++ trunk/orca/packages/Time-HiRes-1.44/HiRes.pm 2003-03-30 11:32:45.000000000 -0800 @@ -15,7 +15,7 @@ d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer d_nanosleep); -$VERSION = '1.43'; +$VERSION = '1.44'; $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -83,31 +83,35 @@ =head1 DESCRIPTION -The C module implements a Perl interface to the usleep, -ualarm, gettimeofday, and setitimer/getitimer system calls. See the -EXAMPLES section below and the test scripts for usage; see your system -documentation for the description of the underlying nanosleep or usleep, -ualarm, gettimeofday, and setitimer/getitimer calls. +The Time::HiRes module implements a Perl interface to the usleep, +ualarm, gettimeofday, and setitimer/getitimer system calls, in other +words, high resolution time and timers. See the EXAMPLES section below +and the test scripts for usage; see your system documentation for the +description of the underlying nanosleep or usleep, ualarm, +gettimeofday, and setitimer/getitimer calls. -If your system lacks gettimeofday(2) or an emulation of it you don't +If your system lacks gettimeofday() or an emulation of it you don't get gettimeofday() or the one-arg form of tv_interval(). If you don't -have nanosleep() or usleep(3) or select(2) you don't get Time::HiRes::usleep() -or sleep(). If your system don't have ualarm(3) or setitimer(2) you -don't get Time::HiRes::ualarm() or alarm(). +have any of the nanosleep() or usleep() or select() you don't get +Time::HiRes::usleep() or Time::HiRes::sleep(). If your system don't +have either ualarm() or setitimer() you don't get +Time::HiRes::ualarm() or Time::HiRes::alarm(). If you try to import an unimplemented function in the C statement it will fail at compile time. If your subsecond sleeping is implemented with nanosleep() instead of usleep(), you can mix subsecond sleeping with signals since -nanosleep() does not use signals. This, however, is unportable -behavior, and you should first check for the truth value of -C<&Time::HiRes::d_nanosleep> to see whether you have nanosleep, -and then read carefully your nanosleep() C API documentation for -any peculiarities. (There is no separate interface to call nanosleep(); -just use Time::HiRes::sleep() or usleep() with small enough values. Also, -think twice whether using nanosecond accuracies in a Perl program is what -you should be doing.) +nanosleep() does not use signals. This however is unportable, and you +should first check for the truth value of &Time::HiRes::d_nanosleep to +see whether you have nanosleep, and then read carefully your +nanosleep() C API documentation for any peculiarities. (There is no +separate interface to call nanosleep(); just use Time::HiRes::sleep() +or Time::HiRes::usleep() with small enough values.) + +Unless using nanosleep for mixing sleeping with signals, also give +some thought to whether Perl is the tool you should be using for work +requiring nanosecond accuracies. The following functions can be imported from this module. No functions are exported by default. @@ -116,7 +120,7 @@ =item gettimeofday () -In array context returns a 2 element array with the seconds and +In array context returns a two-element array with the seconds and microseconds since the epoch. In scalar context returns floating seconds like Time::HiRes::time() (see below). @@ -128,12 +132,12 @@ =item ualarm ( $useconds [, $interval_useconds ] ) -Issues a ualarm call; interval_useconds is optional and will be 0 if -unspecified, resulting in alarm-like behaviour. +Issues a ualarm call; the $interval_useconds is optional and +will be zero if unspecified, resulting in alarm-like behaviour. =item tv_interval -C +tv_interval ( $ref_to_gettimeofday [, $ref_to_later_gettimeofday] ) Returns the floating seconds between the two times, which should have been returned by gettimeofday(). If the second argument is omitted, @@ -142,62 +146,63 @@ =item time () Returns a floating seconds since the epoch. This function can be -imported, resulting in a nice drop-in replacement for the C