/usr/sbin/octo_rrd 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 | #!/usr/bin/perl -w
=head1 NAME
octo_rrd - Octopussy RRD Graphing program
=head1 SYNOPSIS
octo_rrd
=head1 DESCRIPTION
octo_rrd is the program used by the Octopussy Project
to generate RRD Graphs from dispatcher stats
=cut
use strict;
use warnings;
use Readonly;
use AAT::Utils qw( NOT_NULL );
use Octopussy;
use Octopussy::Cache;
use Octopussy::Device;
use Octopussy::FS;
use Octopussy::RRDTool;
Readonly my $PROG_NAME => 'octo_rrd';
exit if (!Octopussy::Valid_User($PROG_NAME));
my @dtypes = Octopussy::Device::Types();
my $dir_pid = Octopussy::FS::Directory('running');
my $cache_dispatcher = Octopussy::Cache::Init('octo_dispatcher');
my $cache_parser = Octopussy::Cache::Init('octo_parser');
my $msgid_history_max = Octopussy::Parameter('msgid_history_max');
my $old_time = '';
while (1)
{
my $time = $cache_dispatcher->get('dispatcher_stats_datetime');
if (NOT_NULL($time))
{
if ($time ne $old_time)
{ # Update RRDGraph for Octopussy Main page
my $dtype_stats =
$cache_dispatcher->get('dispatcher_stats_devicetypes');
my @dt_stats = ();
foreach my $dt (@dtypes)
{
$dt =~ s/ /_/;
my $nb = (
NOT_NULL($dtype_stats->{$dt})
? $dtype_stats->{$dt}
: 0
);
push @dt_stats, $nb;
}
Octopussy::RRDTool::Syslog_By_DeviceType_Update(\@dt_stats);
$old_time = $time;
}
foreach my $k (sort $cache_parser->get_keys())
{ # Update RRDGraph for Octopussy Device Dashboard pages
if ($k =~ /^parser_taxo_stats_(\S+?),(.+)$/)
{
my $taxo = $cache_parser->get($k);
Octopussy::RRDTool::Syslog_By_Device_Service_Taxonomy_Update(
$taxo->{datetime}, $1, $2, $taxo->{stats});
$cache_parser->remove($k);
}
if ($k =~ /^parser_msgid_stats_(\d+?)_.+$/)
{ # Clean older msgid stats older than 120 minutes
my $minutes = $1;
if ($time =~ /^(\d{8})(\d\d)(\d\d)$/)
{
my $time_minutes = ($1 * 10_000) + ($2 * 60) + $3;
$minutes = ($1 * 10_000) + ($2 * 60) + $3
if ($minutes =~ /^(\d{8})(\d\d)(\d\d)$/);
$cache_parser->remove($k)
if (($time_minutes - $msgid_history_max) > $minutes);
}
}
}
}
sleep 5;
}
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=head1 SEE ALSO
octo_dispatcher, octo_extractor, octo_parser, octo_uparser, octo_reporter,
octo_scheduler
=cut
|