[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

FW: help



Also I forgot to mention that this is 5 minutes down time for every time no ping fails.

ping of DEMOMYLAN failed at Mon Mar 9 11:01:13 2004 à each message ping failed means 5 minutes down time by default.

 

 

 


From: Martie Lam
Sent: Tuesday, March 30, 2004 8:31 AM
To: 'debian-isp@lists.debian.org'
Subject: help

 

Hi all,

I'd like to calculate % server up time per monthly base using the log files it was collecting. Calculation should include % up time based on logs file it were collected in monthly basis.

I've been searching for a ready made solution and haven't come accross something, so I started working on a solution.


My current ideas:

Using the simple formula of 30day X 24hours X 60 minutes, how do I calcuate using above log files of %server uptime for the month??
- calculate % server uptime for month using the logfile 30day X 24hours X 60 minutes per each host or server name

I've built a perl script to track logs when no ping was issued by other application console log and I have included below.


My knowledge of Perl is very limited and I'm looking for help to accomplish the goal of doing this calculation for % server uptime.  Can anybody help me?



Yours kindly,

 



# next module start here
 
#!C:/perl/bin/perl.exe 
#
# pinghost.pl -- you must add "&Nodeid" on the message action 
# ex: "c:\perl\bin\perl.exe d:\alm\send\pinghost.pl &Nodeid"
# in order for node name or host name to show up on log file
#
my($HOSTNAME);
my($TSTAMP);
my($DAILYFILE);
my($ptest);
 
my($MDAY);
my($MONTH);
my($YEAR);
my($JULIANDATE);
my($TODAY);
 
use Net::Ping;
 
$TSTAMP = localtime;
$HOSTNAME = $ARGV[0];
 
($sec, $min, $hour, $mday, $mon, $year, $wkday, $yday, $isdst) = localtime(time);
#
$MDAY = $mday + 1;
$MONTH = $mon + 1;
$YEAR = $year + 1900;
$JULIANDATE = $yday + 1;
$TODAY = "J$JULIANDATE" . "Y$YEAR";
 
#$DAILYFILE = "D:/alm/noping_report/" . "$TODAY" .  ".host-no-ping";
$DAILYFILE = "D:/alm/noping_report/" . "$MONTH" .  ".host-no-ping";
 
 
#print " Todays julian date is : $TODAY \n";
#print " The output file is called $DAILYFILE \n";
#print " Variables are timestamp $TSTAMP and hostname $HOSTNAME \n";
 
$ptest = Net::Ping->new("icmp", 10);
 
if ( ! ($ptest->ping($HOSTNAME)))  {
    open ( SVRNP, ">> $DAILYFILE" ) || die "Cant open $DAILYFILE : $! \n";
    print SVRNP "ping of $HOSTNAME failed at $TSTAMP \n";
}
 
$ptest->close();
close (SVRNP);
#
The above script produced the following log file called: ‘3.host-no-ping’  3- is month of march
ping of DEMOMYLAN failed at Mon Mar 29 10:41:25 2004 
ping of UNINTSERVDEMO failed at Mon Mar 29 10:49:09 2004 
ping of DEMOMYLAN failed at Mon Mar 29 11:01:13 2004 
ping of DEMOMYLAN failed at Mon Mar 29 11:08:43 2004 
ping of UNINTSERVDEMO failed at Mon Mar 29 11:11:49 2004 
ping of 172.16.1.2 failed at Mon Mar 29 11:40:47 2004 
ping of DEMOMYLAN failed at Mon Mar 29 11:50:19 2004 
ping of UNINTSERVDEMO failed at Mon Mar 29 11:53:21 2004 
ping of Vill/NB2 failed at Mon Mar 29 14:02:22 2004 
ping of INA_NT_NETWORK failed at Mon Mar 29 14:08:17 2004 
ping of designÕs_Computer failed at Mon Mar 29 16:51:21 2004 
ping of DEMOMYLAN failed at Tue Mar 30 06:20:45 2004 
ping of DEMOMYLAN failed at Tue Mar 30 06:41:25 2004 
ping of UNINTSERVDEMO failed at Tue Mar 30 06:49:09 2004
 
To describe further ping of (hostname or IP address) failed with time stamp on it.
 
Using these logs gathered with date and time stamp, how could I calculate % server or (host) uptime per month

 

 

 

 

 

Martie Lam
Technical Consultant
ITresources, an SEI CMM Level 5 Company
mylam@itrweb.com
714-736-4519
www.itrweb.com

  

 


Reply to: