/usr/sbin/octo_scheduler is in octopussy 1.0.6-0ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #!/usr/bin/perl -w
=head1 NAME
octo_scheduler - Octopussy Scheduler program
=head1 SYNOPSIS
octo_scheduler
=head1 DESCRIPTION
octo_scheduler is the program used by the Octopussy Project
to launch Report that have been scheduled
and generate Syslog Activity RRD Graphs
=cut
use strict;
use warnings;
use Readonly;
use Date::Manip;
use POSIX qw( strftime );
use AAT::Utils;
use Octopussy;
use Octopussy::Report;
use Octopussy::RRDTool;
use Octopussy::Schedule;
Readonly my $PROG_NAME => 'octo_scheduler';
=head1 FUNCTIONS
=head2 Launch_Report($sched)
Launches Report
=cut
sub Launch_Report
{
my $sched = shift;
my $start_day = $sched->{start_day};
my $start_hour = $sched->{start_hour};
my $finish_day = $sched->{finish_day};
my $finish_hour = $sched->{finish_hour};
$start_day =~ s/Day-(\d+)/$1 days/i;
$start_hour =~ s/Hour-(\d+)/$1 hours/i;
$finish_day =~ s/Day-(\d+)/$1 days/i;
$finish_hour =~ s/Hour-(\d+)/$1 hours/i;
my $start =
Date::Manip::UnixDate(
Date::Manip::DateCalc('now', "- $start_day $start_hour"), '%Y%m%d%H%M');
my $finish =
Date::Manip::UnixDate(
Date::Manip::DateCalc('now', "- $finish_day $finish_hour"),
'%Y%m%d%H%M');
print "$start - $finish\n";
my $report = Octopussy::Report::Configuration($sched->{report});
print "Launch Report: $sched->{device} $sched->{service}\n";
print " $start $finish\n";
Octopussy::Report::CmdLine(
$sched->{device}, $sched->{service},
($report->{loglevel} || '-ANY-'), ($report->{taxonomy} || '-ANY-'),
$report, $start,
$finish, 'sched_' . $report->{name} . "_$$",
$sched->{mail}[0], $sched->{ftp}[0],
$sched->{scp}[0], 'EN'
);
return (1);
}
#
# MAIN
#
my $counter = 0;
exit if (!Octopussy::Valid_User($PROG_NAME));
while (1)
{
my ($year, $mon, $mday, $hour, $min) = AAT::Utils::Now();
my $wday = strftime("%w", 0, 0, 0, $mday, $mon - 1, $year - 1900);
$wday = ($wday == 0 ? $wday = 7 : $wday); # on sunday we want 7 instead of 0
my %dt = (
year => $year,
month => $mon,
day => $mday,
wday => $wday,
hour => $hour,
min => $min
);
my @schedules = Octopussy::Schedule::Configurations('title');
foreach my $sched (@schedules)
{
Launch_Report($sched) if (Octopussy::Schedule::Match($sched, \%dt));
}
Octopussy::RRDTool::Syslog_By_DeviceType_Hourly_Graph();
if ($counter % 10 == 0)
{
Octopussy::RRDTool::Syslog_By_DeviceType_Daily_Graph();
}
if ($counter % 30 == 0)
{
Octopussy::RRDTool::Syslog_By_DeviceType_Weekly_Graph();
}
if ($counter % 60 == 0)
{
Octopussy::RRDTool::Syslog_By_DeviceType_Monthly_Graph();
}
if ($counter % 720 == 0)
{
Octopussy::RRDTool::Syslog_By_DeviceType_Yearly_Graph();
$counter = 1;
}
$counter++;
sleep 60;
}
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=head1 SEE ALSO
octo_dispatcher, octo_extractor, octo_parser, octo_uparser, octo_reporter
=cut
|