2 # This is a local command to generate the various statistics that
3 # can then be displayed on an MRTG plot
5 # Your mrtg binary must live in one of the standard places
7 # you will need perl 5.6 (probably) to be able to run this command
10 my ($self, $line) = @_;
14 for (split /\s+/, $line) { $want{lc $_} = 1};
16 return (1, "MRTG not installed") unless $want{test} || -e '/usr/bin/mrtg' || -e '/usr/local/bin/mrtg';
18 my $mc = new Mrtg or return (1, "cannot initialise Mrtg $!");
20 # do the users and nodes
21 my $users = DXChannel::get_all_users();
22 my $nodes = DXChannel::get_all_nodes();
24 $mc->cfgprint('users', $users, $nodes, [qw(gauge)], 500,
25 "Users and Nodes on $main::mycall",
26 'Users / Nodes', 'Users', 'Nodes');
28 # do the total users and nodes
29 if ($want{totalusers} || $want{all}) {
30 $nodes = Route::Node::count();
31 $users = Route::User::count();
32 $mc->cfgprint('totalusers', $users, $nodes, [qw(gauge)], 10000,
33 'Total Users and Nodes in the Visible Cluster Network',
34 'Users / Nodes', 'Users', 'Nodes');
38 if ($want{totalspots} || $want{all}) {
39 $mc->cfgprint('totalspots', $Spot::totalspots, $Spot::totalspots, [qw(unknaszero gauge noi)], 1000, 'Total Spots',
40 'Spots', 'Spots', 'Spots');
41 $Spot::totalspots = 0;
44 # do the HF and VHF spots
45 if ($want{hfvhf} || $want{all}) {
46 $mc->cfgprint('hfspots', $Spot::hfspots, $Spot::vhfspots, [qw(unknaszero gauge)], 1000, 'HF and VHF+ Spots',
47 'Spots', 'HF', 'VHF');
48 $Spot::hfspots = $Spot::vhfspots = 0;
52 if ($want{wwv} || $want{all}) {
53 $mc->cfgprint('wwvsfi', ($Geomag::r || $WCY::r), ($Geomag::sfi || $WCY::sfi), [qw(gauge)], 1000, 'WWV SFI and R',
54 'SFI / R', 'SFI', 'R');
55 $mc->cfgprint('wwvka', $Geomag::a, $Geomag::k, [qw(gauge)], 1000, 'WWV A and K',
60 if ($want{wcy} || $want{all}) {
61 $mc->cfgprint('wcyka', $WCY::a, $WCY::k, [qw(gauge)], 1000, 'WCY A and K',
68 my @out = $mc->run unless $want{test};