logo       

RE: Uptime script - windows: msg#00296

sysutils.tivoli.tme10

Subject: RE: Uptime script - windows

There is an OpenESM_SysUpTime resource model in OpenESM_Monitoring_Tools_V12 bundle at:

 

www.sourceforge.net/projects/gulfsoft

 

It uses the WMI Win32_OperatingSystem class.  It doesn’t do all of the bells-and-whistles of uptime however you could use the TEC or TDW as a backend to do availability.

 

On a side note I am currently working on a WMI tool kit to replace the NTReskit and this would be a good addition to the toolkit.  It would sort of use a combination of Win32_NTLogEvent and Win32_OperatingSystem classes.

 

John Willis

Gulf Breeze Software

www.gulfsoft.com

OpenESM Project

www.sourceforge.net/projects/gulfsoft

 

-----Original Message-----
From: owner-tme10@xxxxxxxxxxxxxxxx [mailto:owner-tme10@xxxxxxxxxxxxxxxx] On Behalf Of David Weir
Sent: Thursday, March 10, 2005 9:31 PM
To: tme10@xxxxxxxxxxxxxxxx
Subject: [tme10] Uptime script - windows

 

Hi I put together this script to retrieve uptime stats at the beginning of the month off windows boxes.

@ECHO OFF
::***********************************************************
:: UPTIME REPORTING TASK RAN FROM TIVOLI
:: DEPENDENCIES REG.EXE (NT 4 RESkit version), UPTIME.EXE,
::              AND ROBOCOPY.EXE
::***********************************************************

::***********************************************************
:: CHANGE DATE TO US DATE FORMAT (Rob van der Woude)
::***********************************************************
FOR /F "TOKENS=1* DELIMS= " %%A IN ('DATE/T') DO SET DATE=%%B
:: Delims is a TAB followed by a space
FOR /F "TOKENS=2* DELIMS=        " %%A IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\iDate"') DO SET iDate=%%B

FOR /F "TOKENS=2* DELIMS=        " %%A IN ('REG QUERY "HKEY_CURRENT_USER\Control Panel\International\sDate"') DO SET sDate=%%B

IF %iDate%==0 FOR /F "TOKENS=1-4* DELIMS=%sDate% " %%A IN ('DATE/T') DO SET SortDate=%%B/%%C/%%D
IF %iDate%==1 FOR /F "TOKENS=1-4* DELIMS=%sDate% " %%A IN ('DATE/T') DO SET SortDate=%%C/%%B/%%D
IF %iDate%==2 FOR /F "TOKENS=1-4* DELIMS=%sDate% " %%A IN ('DATE/T') DO SET SortDate=%%C/%%D/%%B
ECHO It's %DATE% today
ECHO For sorting purposes: %SortDate%

::***********************************************************
::CHANGE DATE TO BEGINNING OF LAST MONTH
::***********************************************************

FOR /F "tokens=1-3 delims=/ " %%i in ("%SortDate%") do (set month=%%i) & (set day=%%j) & (set year=%%k)
ECHO MONTH %MONTH%

If %month% EQU 01 (set /a LASTMONTH=12 & set /a year=%year%-1)
If %month% EQU 02 (set /a LASTMONTH=1)
If %month% EQU 03 (set /a LASTMONTH=2)
If %month% EQU 04 (set /a LASTMONTH=3)
If %month% EQU 05 (set /a LASTMONTH=4)
If %month% EQU 06 (set /a LASTMONTH=5)
If %month% EQU 07 (set /a LASTMONTH=6)
If %month% EQU 08 (set /a LASTMONTH=7)
If %month% EQU 09 (set /a LASTMONTH=8)
If %month% EQU 10 (set /a LASTMONTH=9)
If %month% EQU 11 (set /a LASTMONTH=10)
If %month% EQU 12 (set /a LASTMONTH=11)

set REPORTINGDATE=%LASTMONTH%/1/%year%
Echo REPORTING DATE %REPORTINGDATE%

::************************************************************
::UPTIME
::************************************************************
set FILE=%LASTMONTH%%year%
c:\Progra~1\Tivoli\lcf\uptime.exe \\%server% /s /d:%REPORTINGDATE% > c:\Progra~1\Tivoli\lcf\%computername%.txt
net use \\machine\uptime /user:machine\user password
c:\Progra~1\Tivoli\lcf\robocopy c:\Progra~1\Tivoli\lcf \\machine\uptime\last_month %computername%.txt

If anyone has any suggestions and improvements, or nicer code would appreciate any feedback. I would particularly be interested in any solutions to authenicating to the folder where the uptime output is copied to.

When I have time I will post a script to take the relevant information from the text files and a nice html page.  In the past I used, qgrep.exe and csv2htm.exe

 

David Weir
Tivoli Specialist
KAZ Technology Services




IMPORTANT NOTICE
This communication including any file attachments is intended solely for the use of the individual or entity to whom it is addressed. If you are not the intended recipient, or the person responsible for delivering this communication to the intended recipient, please immediately notify the sender by e-mail and delete the original transmission and its contents. Any unauthorised use, dissemination, forwarding, printing, or copying of this communication including any file attachments is prohibited.

It is your responsibility to scan this communication including any file attachment for viruses and other defects. To the extent permitted by law, ING and its associates will not be liable for any loss or damage arising in any way from this communication including file attachments.

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise