Sigx for BSD anyone?

BODBOD
edited March 2007 in Software
Meh, I got bored and adapted the linux version slightly.
#!/usr/bin/perl 

# Credits     : This script was created by and is currently maintained 
#               by Victor Igumnov [lamer0@lamer0.com]. 
# 
# Legal Info  : Copyright (C) 2003, Victor Igumnov [lamer0@lamer0.com] 
# 
#               This program is free software. You may redistribute it 
#               and/or modify it under the terms of the GNU General 
#               Public License as published by the Free Software 
#               Foundation; either version 2 of the License, or 
#               (at your option) any later version. 
# 
#               This program is distributed in the hope that it will be 
#               useful, but WITHOUT ANY WARRANTY; without even the 
#               implied warranty of MERCHANTABILITY or FITNESS FOR A 
#               PARTICULAR PURPOSE.  See the GNU General Public License 
#               for more details. 
# 
$|=1; 

use CGI; 
use URI::URL; 
use LWP::UserAgent; 

#Set These 
#my $CPU='temp3'; 
#my $MOBO='temp2'; 
#my $FAN='fan2'; 

#Edit this to your distro's name. 
$DISTRO="FreeBSD"; 
#edit this for your default X11 address 
#(usually just :0) 
#$DISPLAY=":0"; 
########## 

$CPUNAME="Intel Pentium III "; 
$CPUSPEED="533MHz"; 
#$BOGOMIPS=`cat /proc/cpuinfo  | grep 'bogomips' |  head -1 | sed -e 's/^.*: //'`; 
$UNAME = `uname -sr`; 

#--PERCENTAGE OF MEMORY FREE--# 
#$MEMPERCENT = `free | grep Mem | awk '{print (( \$3 -(\$6 + \$7) )/\$2)*100}'`; 
#chop ($MEMPERCENT); 
#$MEMPERCENT = sprintf('%.2f', $MEMPERCENT); 

#--UPTIME--# 
$UPTIMEDAYS = `uptime | awk '{printf (\$3)}'`; 
$UPTIMEHOURS = `uptime | awk '{printf(\$5)}' | awk -F ':' '{printf(\$1)}'`; 
$UPTIMEMINS = `uptime | awk '{printf(\$5)}' | awk -F ':' '{printf(\$2)}' | head -c 2`; 

$UPTIME = "$UPTIMEDAYS Days $UPTIMEHOURS Hours $UPTIMEMINS Mins"; 

#--MEMORY FREE--# 
#$MEMFREE = `free | grep Mem | awk '{printf (\"%.0f\", ( \$3 -(\$6 + \$7) )/1000)}'`; 
#chop ($MEMFREE); 

#--TOTAL MEMORY--# 
#$MEMTOTAL = `free | grep Mem | awk '{printf (\"%d\", \$2/1000 )}'`; 
#chop ($MEMTOTAL); 

#--SCREEN RESOLUTION--# 
#$RES = `/usr/X11R6/bin/xdpyinfo -display $DISPLAY | grep dimensions | awk '{print \$2}'`; 
#chop ($RES); 

#--DISKSPACE--# 
$HDD = `df | awk '{ sum+=\$2/1024^2 }; END { printf (\"%dGb\", sum )}'`; 
chop ($HDD); 

#--DISKSPACE FREE--# 
$HDDFREE = `df | awk '{ sum+=\$4/1024^2 }; END { printf (\"%dGb\", sum )}'`; 
chop ($HDDFREE); 

#--SCREEN RESOLUTION--# 
#$RES = `xdpyinfo | grep dimensions | awk '{print \$2}'`; 
#chop ($RES); 

#$XMMS = `cat /tmp/xmms-info | grep "Title: " | sed "s/Title: //"`; 
#chop ($XMMS); 

chop($UNAME); 
chop($CPUNAME); 
chop($CPUSPEED); 
chop($BOGOMIPS); 
#$RAMLEFT=$MEMTOTAL-$MEMFREE; 

$query = new CGI; 
$query->import_names('webform'); 

my $username = "username-goes-here"; 
my $password = "password-goes-here"; 
$DATA_2_SEND="OS: $UNAME *<*System Uptime: $UPTIME *<*CPU: $CPUNAME @ $CPUSPEED MHz *<*HDD: $HDD with $HDDFREE Free."; 
#printf $MEMTOTAL; 
print $DATA_2_SEND; 





my %form = (); 

%form =('username' => $username, 
   'password' => $password, 
   'data'      => $DATA_2_SEND, 
   'Submit'   => ''); 

my $ua = new LWP::UserAgent; 
my $curl = url("http:"); 
my $req = new HTTP::Request 'POST','http://sigx.yuriy.net/update.php'; 
$req->content_type('application/x-www-form-urlencoded'); 
$req->content($curl->equery); 
$curl->query_form(%form); 
$req->content($curl->equery); 
my $response= $ua->request($req)->as_string;

I hard wrote some of it since I can't remember how to get the info from sysctl :|.

I'll figure that out one day

Comments

Sign In or Register to comment.