Category Archives: ServerMonitoring

Remotely Monitor Websites using Browser

Dear all

Following is the script which opens website in Internet explorer and collects the output from IE and if any error occurs in IE window it will send SMS and Email containing error caputered in IE window

it takes name of website from a text file and then opens in IE.

Requirement create Folder on c: with name c:\checkme1 keep the contains of zip file in it and schedule the script in task schedular

Click to Download

Thanks

Prashant Deshpande

Advertisements

Leave a comment

Filed under General, IT Support, Server Infrastructure, ServerMonitoring

Monitor CPU and Physical Memory (RAM)

Dear All

Please find here with the Script which can be scheduled after every 2 mins on server which will monitor the CPU and Memory Usage on server and if CPU usage goes above the limit specified by us and free memory below the limit given by us (default i have kept Memory Limit 512 mb and CPU usage limit 90 %)

If free memory goes below 512mb or CPU usage above 90% then it will send email so that we can take appropriate action

you will need to change the email ids and verify that SMTP server is installed and working on server.

 Click to download Script

 Thanks

 Prashant Deshpande

 

 

Leave a comment

Filed under ServerMonitoring

Memory_Monitor

Dear All

 

Following script can be scheduled on server to run after every 5 minutes which will monitor the free RAM on server and if RAM free RAM goes below 256mb then it wll send email.

 

dim str,mess
str="."
Check_Available_Virtual_Memory str,256

Function Check_Available_Virtual_Memory(strComputer,strThresholdMB)
dim wbemServices,wbemObjectSet,wbemObject,AvailableVMB,strStatus
Check_Available_Virtual_Memory=false
EXPLANATION = "Failed, error getting values."

Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("CIM_OperatingSystem")

For Each wbemObject In wbemObjectSet
AvailableVMB=int(wbemObject.FreePhysicalMemory/1024)
strStatus="Available Physical Memory=" & AvailableVMB & "mb, Threshold=" & strThresholdMB & "mb"

if AvailableVMB > strThresholdMB then
Check_Available_Virtual_Memory=true
EXPLANATION = "Success, " & strStatus
else
Check_Available_Virtual_Memory=false

EXPLANATION = "Failure, " & strStatus

dim j, NIC1, Nic, StrNic, lngCount, StrIP, i ,objNet,objHost
‘If something fails, move on
On Error Resume Next
‘Get the Computer’s network name
Set objNet=CreateObject("wscript.Network")
objHost=objNet.ComputerName
‘Wscript.Echo "Analysis of " & objHost & "."

‘Get a connection to the WMI NetAdapteConfig object
Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

‘For Each of the NICs in the connection
dim ip
ip=""
For Each Nic in NIC1
   ‘Get the Adapter Description
   StrNIC = Nic.Description
     ‘If IP is enabled on the NIC then let’s find out about the NIC
     IF Nic.IPEnabled THEN
        lngCount=UBound(Nic.IPAddress)
        For i=0 to lngCount
           If i >= 0 Then
           StrIP = vbTab & Nic.IPAddress(i)
           If StrIP <> "" Then

if ip<>"" then
ip=ip+" | "+  StrIP
else
    ip=   StrIP
end if
                  End If
              End If
            Next
          END IF
      Next
mess="Hi , Please check that the server ip :-"+ ip + " | The availabe RAM is less than 256 mb only , Current Memory Status is : – "+ StrStatus
SendMail "prashantd@mkcl.org", "prashantd@mkcl.org " , "Physical Memory Alert (RAM)"  , Mess

end if
Next
end function
wscript.quit

Sub SendMail(Sender, Recipient, Subject, Message)

Const MailServer = "127.0.0.1" ‘ Mail Server to use (SMTP)
Const MailServerPort = "25" ‘ SMTP Port used at Mail server (25 is default)

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Subject
objMessage.From = Sender
objMessage.To = Recipient
objMessage.TextBody = Message

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

‘Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailServer

‘Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = MailServerPort

objMessage.Configuration.Fields.Update

objMessage.Send
End Sub

 

Thanks

 

Prashant Deshpande

 

Leave a comment

Filed under ServerMonitoring

EVentlog_Notify

 

http://itinfrablog.mkcl.org/wp-content/uploads/serverinfra/resource/Scripts.zip

Dear All

Please find here with the Server Event Logs Senderscripts

When any server goes down , after restart we use to take remote of that server and then read the event logs for getting shutdown causes

here is the attached rar file which contains following Files

1)BackupEvt.vbs :- which will take backup of all Event logs

2) Create_rar.bat :- which will make zip of the backup of event log taken by BackupEvt.vbs

3) SendevtLog.vbs :- which will send the Zip of event log backup

4)Writeeventlogs.vbs :-write event logs in Text file

Detailed procedure of configuring

  Folder structure to be available

   c:\Scripts :-> wil contains all Scripts

  c:\evtlogs :- will be used for writing logs

  d:\zip :- will be used to store backup of event logs in RAR format

  1) In task schedular configure a task for writeeventlogs.vbs whcih will be getting called after every 24 hrs

  2)See to it that server/ System has installed 7-Zip and path includes it

  3) Strat -> Run –> gpedit.msc

    In computer Configuration –> Windows Settings –> Scripts –> Startup

specify the two scripts 1) Writeeventlogs.vbs

                                   2) SendevtLog.vbs

after this configuartion whenever that system / Server will get restarted it will send email notification along with the backup of event logs in RAR format to the email ids present in sendevtlogs.vbs ( change email ids as per requirement )

 

Thanks

 Prashant Deshpande

Leave a comment

Filed under ServerMonitoring