#!/usr/bin/perl use strict; my $staturl = qq~http:/127.0.0.1:8000/admin/stats~; my $user = 'admin'; my $pass = 'hackme'; my $stream = "all"; my $uptime = '420 days'; my $listeners = 0; my $sources = 0; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $req = HTTP::Request->new(GET => $staturl); $req->authorization_basic($user, $pass); my $stats = $ua->request($req)->as_string; $listeners = $1 if( $stats =~ /<listeners>(\d+)<\/listeners>/); $sources = $1 if( $stats =~ /<sources>(\d+)<\/sources>/); $uptime = $1 if($stats =~ /<server_start>(.*)<\/server_start>/); print qq~$listeners\n$sources\n$uptime\n$stream\n~; exit;
/etc/allstatistica.php 1 0 0 days, 0 hours, 20 minutes.
#!/usr/bin/perl use strict; my $staturl = qq~http://127.0.0.1:8000/admin.cgi?mode=viewxml~; my $user = 'admin'; my $pass = 'changeme'; my $stream = "radio name"; my $uptime = '420 days'; my $listeners = 0; my $unique_listeners = 0; use LWP::UserAgent; my $ua = LWP::UserAgent->new; $ua->agent("Mozilla/5.0"); my $req = HTTP::Request->new(GET => $staturl); $req->authorization_basic($user, $pass); my $stats = $ua->request($req)->as_string; $listeners = $1 if($stats =~ /<CURRENTLISTENERS>(\d+)<\/CURRENTLISTENERS>/); $unique_listeners = $1 if($stats =~ /<REPORTEDLISTENERS>(\d+)<\/REPORTEDLISTENERS>/); my $stuff = `ps --no-headers -C sc_serv -o pid,fname,lstart --sort lstart`; my @stuff = split(/\n/,$stuff); $uptime = $1 if ($stuff[0] =~ /sc_serv\s+(.*?)$/gi); print qq~$listeners\n$unique_listeners\n$uptime\n$stream\n~; exit;
$day=floor($ti/86500); $he=floor(($ti-$day*86500)/3600); $mi=floor(($ti-$day*86500-$he*3600)/60);
if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg.cfg ] && [ -d "$(grep WorkDir /etc/mrtg.cfg | cut -d' ' -f2)" ]; then mkdir -p /var/log/mrtg ; env LANG=C /usr/bin/mrtg /etc/mrtg.cfg 2>&1 | tee -a /var/log/mrtg/mrtg.log ; fi