blob: 1a0df421fd10d4883c8e9e611b10fd502678d6a1 (
about) (
plain)
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
|
#!/usr/bin/perl
use POSIX;
use IO::File;
print( "Content-Type: text/html; charset=utf-8\r\n\r\n" );
my $full_output = "<!DOCTYPE html>\n<html lang=\"en\" style=\"background-color: #000000;\">\n<body style=\"font-family: Arial; background-color: #000000;\">\n<title>Stats</title><div style=\"margin: auto; position: relative; width: 100%;\">\n<table border=\"2px\" style=\"width: 100%\"><tr><th><center><h1 style=\"color: #FFFFFF;\"><u>Stats</u></h1></center></th></tr>\n<tr><td><center><span style=\"color: #FFFFFF; font-size: 18px;\">";
my $ver = IO::File->new( "/proc/version", "r" ) or die "Failed to open /proc/version";
$full_output .= <$ver>."<br/>";
undef $ver;
my $utime = IO::File->new( "/proc/uptime", "r" ) or die "Failed to open /proc/uptime";
my @tdata = split( m/ /, <$utime> );
my $thours = int($tdata[0]) / 60 / 60;
my $tmins = int($tdata[1]) / 60 / 60;
undef $utime;
undef $tdata;
$full_output .= "Uptime: ".int($thours)." hours ".int($tmins)." minutes<br/>";
undef $thours;
undef $tmins;
my $cpu = IO::File->new( "/proc/cpuinfo", "r" ) or die "Failed to open /proc/cpuinfo";
my $fline = "";
my @spl_speed = "";
my $ccount = 1;
while ( $fline = <$cpu> ){
if ( $fline =~ m/cpu mhz/i ){
@spl_speed = split( m/: /, $fline );
$full_output .= "Core ".$ccount. " speed: ".$spl_speed[1]."<br/>";
$ccount++;
}
}
undef $cpu;
undef $fline;
undef $ccount;
undef @spl_speed;
my $minfo = IO::File->new( "/proc/meminfo", "r" ) or die "Failed to open /proc/meminfo";
my $minfoline = "";
while ( $minfoline = <$minfo> ){
$full_output .= $minfoline."<br/>";
}
undef $minfoline;
undef $minfo;
$full_output .= "</span></center></td></tr>\n</table>\n</div>\n</body>\n</html>";
print( $full_output );
undef $full_output;
exit( 0 );
|