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 my ($self, $line) = @_;
9 return (1) unless -e '/usr/bin/mrtg' || -e '/usr/local/bin/mrtg';
11 my $dir = "$main::root/mrtg";
12 my $html = "$main::root/html/mrtg";
13 my $cfg = "$dir/mrtg.cfg";
16 return (1, "$dir is missing") unless -d $dir;
17 return (1, "$html is missing") unless -d $html;
18 return (1, "$cfg is missing") unless -e "$cfg";
19 open MC, ">$cfg" or return(1, "cannot open $cfg for mrtg writing");
21 # print out the header
25 # to get bits instead of bytes and graphs growing to the right
26 # Options[_]: growright, bits
40 for ( split /\s+/, $line) {
46 # do the users and nodes
47 my $users = DXChannel::get_all_users();
48 my $nodes = DXChannel::get_all_nodes();
49 my $uptime = main::uptime();
50 #dbg "$users $nodes $uptime\n";
51 if (open M, ">$dir/users") {
52 print M "$users\n$nodes\n$uptime\nUsers and Nodes\n";
57 # local users and nodes
59 Target[users]: `cat /spider/mrtg/users`
62 Title[users]: Users and Nodes for $main::mycall
63 Options[users]: withzeroes, gauge, growright, nopercent, integer
64 YLegend[users]: Users \& Nodes
66 ShortLegend[users]: \
67 Legend1[users]:Maximum No of Users
68 Legend2[users]:Maximum No of Nodes
71 PageTop[users]: <H1>Users and Nodes on GB7DJK</H1>
73 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
74 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
75 <TR><TD>Description:</TD><TD>Users \& Nodes </TD></TR>
79 # do the total users and nodes
80 if ($want{totalusers} || $want{all}) {
81 $nodes = Route::Node::count();
82 $users = Route::User::count();
83 #dbg "$users $nodes $uptime\n";
84 if (open M, ">$dir/totalusers") {
85 print M "$users\n$nodes\n$uptime\nTotal Users and Nodes\n";
90 # total users and nodes
92 Target[totalusers]: `cat /spider/mrtg/totalusers`
93 MaxBytes1[totalusers]: 5000
94 MaxBytes2[totalusers]: 5000
95 Title[totalusers]: Total Users and Nodes for the Visible Cluster Network
96 Options[totalusers]: withzeroes, gauge, growright, nopercent, integer
97 YLegend[totalusers]: Users \& Nodes
98 YTicsFactor[totalusers]: 1
99 ShortLegend[totalusers]: \
100 Legend1[totalusers]:Maximum No of Users
101 Legend2[totalusers]:Maximum No of Nodes
102 LegendI[totalusers]:Users
103 LegendO[totalusers]:Nodes
104 PageTop[totalusers]: <H1>Total Users and Nodes in the Visible Network</H1>
106 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
107 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
108 <TR><TD>Description:</TD><TD>Total Users \& Nodes for the Visible Cluster Network </TD></TR>
114 if ($want{totalspots} || $want{all}) {
115 if (open M, ">$dir/totalspots") {
116 print M "$Spot::totalspots\n$Spot::totalspots\n$uptime\nTotal Spots\n";
119 $Spot::totalspots = 0;
124 Target[totalspots]: `cat /spider/mrtg/totalspots`
125 MaxBytes[totalspots]: 20000
126 Title[totalspots]: Total Spots
127 Options[totalspots]: unknaszero, gauge, withzeroes, growright, nopercent, integer, noi
128 YLegend[totalspots]: Spots
129 YTicsFactor[totalspots]: 1
130 ShortLegend[totalspots]: \
131 Legend2[totalspots]:Maximum No of Spots
132 LegendO[totalspots]:Spots
133 PageTop[totalspots]: <H1>Total Spots</H1>
135 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
136 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
137 <TR><TD>Description:</TD><TD>Total Spots</TD></TR>
142 # do the HF and VHF spots
143 if ($want{hfvhf} || $want{all}) {
144 if (open M, ">$dir/hfspots") {
145 print M "$Spot::hfspots\n$Spot::vhfspots\n$uptime\nHF and VHF+ Spots\n";
148 $Spot::hfspots = $Spot::vhfspots = 0;
153 Target[hfspots]: `cat /spider/mrtg/hfspots`
154 MaxBytes[hfspots]: 20000
155 Title[hfspots]: HF and VHF+ Spots
156 Options[hfspots]: unknaszero, gauge, withzeroes, growright, nopercent, integer
157 YLegend[hfspots]: Spots
158 WithPeak[hfspots]: ymwd
159 YTicsFactor[hfspots]: 1
160 ShortLegend[hfspots]: \
161 Legend1[hfspots]:Max no of HF Spots
162 Legend2[hfspots]:Max no of VHF Spots
164 LegendO[hfspots]:VHF+
165 PageTop[hfspots]: <H1>Total HF and VHF+ Spots</H1>
167 <TR><TD>System:</TD> <TD>$main::mycall</TD></TR>
168 <TR><TD>Maintainer:</TD> <TD>$main::myemail</TD></TR>
169 <TR><TD>Description:</TD><TD>Total HF and VHF+ Spots</TD></TR>
177 @args = ("mrtg", $cfg);