/usr/sbin/octo_world_stats 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 | #!/usr/bin/perl -w
=head1 NAME
octo_world_stats - Octopussy World Statistics program
=head1 DESCRIPTION
octo_world_stats sends statistics data to octopussy.pm to see Octopussy usage in the world
=cut
use strict;
use warnings;
use Readonly;
use Getopt::Long;
use POSIX qw(strftime);
use URI::Escape;
use AAT::Download;
use AAT::Syslog;
use Octopussy;
use Octopussy::Cache;
use Octopussy::Device;
use Octopussy::FS;
use Octopussy::Stats;
use Octopussy::World_Stats;
Readonly my $APPLI => 'Octopussy';
Readonly my $PROG_NAME => 'octo_world_stats';
Readonly my $UPDATE_URL => Octopussy::Parameter('url_world_stats_update');
my $quiet;
#
# MAIN
#
exit if (!Octopussy::Valid_User($PROG_NAME));
my $status = GetOptions(
'q|quiet' => \$quiet,
);
my $conf = Octopussy::World_Stats::Configuration();
if ((defined $conf) && ($conf->{status} eq 'enabled'))
{
my ($id, $country) = ($conf->{id}, $conf->{country});
my $dir_pid = Octopussy::FS::Directory('running');
my $cache = Octopussy::Cache::Init('octo_dispatcher');
my $version = Octopussy::Version();
my $cpu = Octopussy::Stats::CPU_Info();
$cpu =~ s/\s+/ /g;
$cpu = uri_escape($cpu);
my $mem = Octopussy::Stats::Mem_Total();
my @devices = Octopussy::Device::List();
my @services = Octopussy::Device::Services(@devices);
my $nb_devices = scalar @devices;
my $nb_services = scalar @services;
my @keys = $cache->get_keys();
my $timestamp = strftime("%Y%m%d%H", localtime);
foreach my $k (sort @keys)
{
if ( ($k =~ /^dispatcher_stats_hourly_(\d{10})$/)
&& ($1 !~ /^$timestamp$/))
{
my $hour = $1;
my $url =
"$UPDATE_URL?id=$id&country=$country&version=$version"
. "&cpu=$cpu&memory=$mem&hour=$hour&nb_devices=$nb_devices"
. "&nb_services=$nb_services&nb_logs="
. ($cache->get($k) || '0');
AAT::Download::File($APPLI, $url, '/dev/null');
}
}
AAT::Syslog::Message('octo_world_stats', 'WORLD_STATS_SENT');
}
else
{
print "World Statistics are disabled !\n" if (! $quiet);
}
=head1 AUTHOR
Sebastien Thebert <octo.devel@gmail.com>
=head1 SEE ALSO
octo_dispatcher, octo_extractor, octo_parser, octo_uparser, octo_scheduler
=cut
|