Pages

4/25/2007

Windows::Remote Assistance


Offer remote assistance shortcut:
%windir%\explorer.exe "hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Unsolicited/Unsolicitedrcui.htm

Windows::VMWare


There are known problems with performing certain Active Directory tasks with DCs running on VMWare, such as DC promotion and trust establishment. This article provides instructions on how to remove the shared folder feature, which is part of VMWare Tools.
ActiveDir.Org

Windows::Tip


I saw someone today do Start > Run > %temp% to get to their temp directory to clean it out. Very quick and convenient.

4/16/2007

Performance::MSSQL



Quote from: Buck WoodyThese objects and counters serve as a demonstration of the types of things I monitor for a SQL Server application I use:

Object

Counter

Meaning

Notes

Cache

Data Maps Hits %

NTFS Processing Efficiency

Should be better than 90% or may need to defrag Hard Drive

Cache

MDL Read Hits %

Cache Hits for IIS

Should be better than 90%

Memory

% Committed Bytes

Shows memory use

Should be under 70

Memory

Available MBytes

How much unallocated RAM is left on the server

Should be greater than 50MB

Memory

Cache Faults/Sec

Physical Disk Read I/O Operation

The fewer the better

Network Interface

Bytes Total/sec

Shows network activity

Network Monitor Driver must be installed for accurate measurement of networkitems - Measure against network bandwidth availability

Network Segment

% Network Utilization

Total Network segment use - not from this server alone

Depends on many networking variables, but can be useful to a Networkspecialist

PhysicalDisk

Current Disk Queue Length:_Total

Shows physical drive activity

Less than 3 per physical disk is acceptable

PhysicalDisk

% Disk Read Time

How much time spent doing reads

Combine with Writes to see if Index usage is correct - may need to adjustfillfactor

PhysicalDisk

% Disk Time -- _Total

Shows drive activity

diskperf -yv is required for proper logical disk counters to operate. Shouldbe less than 55% - watch for increase

PhysicalDisk

% Disk Write Time

How much time spent doing writes

Combine with Reads to see if Index usage is correct - may need to adjustfillfactor

Process

% Processor Time

Pick Specific Object

Will explain how much that object is taking on the processor

Processor

% Total Processor Time

Shows the CPU activity being taken by all processes

Should not exceed 80% for continuous periods with high Proc Queue Length.NOTE: W2K measures non-busy time and subtracts it from 100%

Server

Bytes Received/Sec

Data received by the server NIC

 

Server

Bytes Transmitted/Sec

Data sent by the server NIC

 

SQL Server:Access Methods

Full Scans/Sec

Table scans

For the entire server - not just one database

SQL Server:Access Methods

Page Splits/Sec

Splits happen when data or indexes span a page (8k)

Fillfactors may not be correct if this is high

SQL Server:Buffer Manager

Cache Size (pages)

 

Multiply x 8192 for RAM amount, should be close to the RAM in yoursystem.

SQL Server:Locks

Average Wait Time (ms)

Time processes spend waiting on a lock release

Should not be high

SQL Server:Locks

Number of Deadlocks

Number of processes deadlocking each other

Measurement is by the second

SQL Server:Memory Manager

Target Server Memory

How much RAM SQL wants

 

SQL Server:Memory Manager

Total Server Memory

How much RAM SQL is using

 

SQL Server:SQL Statistics

Batch Requests/Sec

Bow many batches sent to SQL Server

Over 1000 indicates a busy SQL Server - May indicate CPU bottleneck. A 100Mbnetwork card can handle 3000 per second.

SQL Server:SQl Statistics

SQL Compilations/Sec

How many compiles SQL has to do

Over 100 may indicate a SQL problem

SQLServer:Buffer Manager

Buffer Cache Hit Ratio

Shows how much data is found in the Buffer

Should be 99% or greater

SQLServer:General Statistics

User Connections

Shows the number of connections taken on the SQL Server

Varies

System

% Total Privileged Time

Kernel mode operations

Should be less than 20% or may be IO bound. Pair with %Disk time counter tosee if greater than 50%. Can also indicate driver or NIC.

System

Context Switches/Sec

Server thread switches

Should not exceed 8000 per second, per processor

System

Processor Queue Length

Shows the amount of processes waiting for CPU time

Pairs with % Processor Time counter - Should not be greater than 2 perproc.

Web Service

GET Requests/Sec

Number of GET requests

Each GET connection attempt

Web Service

POST Requests/Sec

Number of POST requests

Each POST connection attempt

Web Service

Total Method Requests/Sec

Hits on the Web Server

Service Request rate

4/10/2007

Perl::Screen Scraping


Required: MRTG Graphing for "source records remaining" of replica on Data Domain DDR appliance.

Problem: The replication statistics are not exposed via SNMP.

Workaround: Create external monitoring script to http to the device and grab this stat out of the html table that we are manually checking it from now.

I used PAR to package this into an EXE so I don't even need to screw with Perl modules on the MRTG/Web server.

Perl code:
####################################################
# checkrep.pl
#
# MRTG External Monitoring Script
# to return Records Remaining to be replicated
# for specific host & replication destination
####################################################

use Socket; # include Socket module
require 'tcp.pl'; # file with Open_TCP routine
use HTML::TableExtract; # Module to parse HTML

##########################################
#
# Parameters for customization below:
#
##########################################

##########################################
# Host to query

my $host="DDR05";

##########################################
# Replication Destination

$Query="dir://ddr02.usa.mydomain.com/backup/rep1";

##########################################
#
# Don't mess with stuff below here
#
##########################################


my $time = localtime;
open (LOG, '>checkrep.log');

#open (OUT, '>replication.html');


print LOG "\n----------\n$time\n";

##########################################
#Authenticate

open_TCP('F', $host, 80);
print LOG "\n----------\nLOGON-\n";
print F "POST /cgi-bin/auth.pl HTTP/1.0\n";
print F "User-Agent: Mozilla/1.1N (X11; I; SunOS 5.3 sun4m)\n";
print F "Accept: */*\n";
print F "Accept: image/gif\n";
print F "Accept: image/x-xbitmap\n";
print F "Accept: image/jpeg\n";
print F "Accept: text/javascript\n";
print F "Content-type: application/x-www-form-urlencoded\n";
print F "Content-length: 31\n";
print F "\n";
print F "user=TESTLOGON&password=********\n";

# get the HTTP response line
my $the_response=;
print LOG $the_response;

# get the header data
my %header;
while(=~ m/^(\S+):\s+(.+)/) {
$header{$1} = $2;
print LOG "$1: $2\n";
}

# get the entity body
print LOG while ();

# close (F);


##########################################
#Open Main (create cookie)

open_TCP('F', $host, 80);
print LOG "\n----------\nOPEN MAIN-\n";
# request the path of the document to get
print F "GET $header{'Location'} HTTP/1.0\n";
print F "Accept: */*\n";
print F "User-Agent: Mozilla/1.1N (X11; I; SunOS 5.3 sun4m)\n";
print F "Connection: Keep-Alive\n";
print F "\n";

# get the HTTP response line
$the_response=;
print LOG $the_response;

# get the header data
while(=~ m/^(\S+):\s+(.+)/) {
$header{$1} = $2;
print LOG "$1: $2\n";
}

my $Cookie = $header{'Set-Cookie'};


# get the entity body
print LOG while ();


# close the network connection
close(F);

##########################################
#Open Page
open_TCP('F', $host, 80);
print LOG "\n----------\nOPEN REPLICATION PAGE-\n";
print F "GET /view.cgi?ref=replication.gui HTTP/1.0\n";
print F "Accept: */*\n";
print F "User-Agent: Mozilla/1.1N (X11; I; SunOS 5.3 sun4m)\n";
print F "Connection: Keep-Alive\n";
print F "Cookie: $Cookie\n\n";

# get the HTTP response line
$the_response=;
print LOG $the_response;

# get the header data
while(=~ m/^(\S+):\s+(.+)/) {
print LOG "$1: $2\n";
}

# get the entity body
# print OUT while ();
@line = ;

# close the network connection
close(F);

##########################################
#Logout

# Test to see if session is still logged on
# e.g. http://atlddr05/view.cgi?ref=main.gui&session=14

open_TCP('F', $host, 80);
print LOG "\n----------\nLOGOUT-\n";
print F "POST /logout.cgi HTTP/1.0\n";
print F "User-Agent: Mozilla/1.1N (X11; I; SunOS 5.3 sun4m)\n";
print F "Accept: */*\n";
print F "Accept: image/gif\n";
print F "Accept: image/x-xbitmap\n";
print F "Accept: image/jpeg\n";
print F "Accept: text/javascript\n";
print F "Content-type: application/x-www-form-urlencoded\n";
print F "Content-length: 0\n";
print F "Pragma: no-cache\n";
print F "Cookie: $Cookie\n\n";

# get the HTTP response line
$the_response=;
print LOG $the_response;

# get the header data
while(=~ m/^(\S+):\s+(.+)/) {
$header{$1} = $2;
print LOG "$1: $2\n";
}
# get the entity body
print LOG while ();

print LOG "\n----------\nEND\n----------\n";
close (F);
close (LOG);
close (OUT);

##########################################
# Parse HTML


#use Data::Dumper;

foreach $line (@line) {
$line =~ s/\x0d{0,1}\x0a{0,1}\Z/ /s;
}

$html_string = join ('',@line);

$te = HTML::TableExtract->new( headers => ['Destination', 'Source Records Remaining'] );
$te->parse($html_string);

#print Dumper $te;
#print "\n";

foreach $ts ($te->tables) {
foreach $row (@$ts) {
# print join(',', @$row), "\n";
($Null,$Destination,$Null,$Null,$Null,$Null,$Null,$SourceRecordsRemaining,$Null,$Null) = @$row;
$Result{$Destination} = $SourceRecordsRemaining;
}
}

$RecordsRemaining = $Result{$Query};

$RecordsRemaining =~ s/,//;


##########################################
# Return Results

$Results = "$RecordsRemaining\n$RecordsRemaining\nNA\n$host\\$Query\n";

print $Results;



#The external command must return 4 lines of output:

#Line 1 - current state of the first variable, normally 'incoming bytes count'
#Line 2 - current state of the second variable, normally 'outgoing bytes count'
#Line 3 - string (in any human readable format), telling the uptime of the target.
#Line 4 - string, telling the name of the target



##########################################
# END
##########################################

MRTG - External Monitoring Scripts


Having a bit of fun lately working with MRTG to graph "non-standard" stats from external monitoring scripts.
MRTG.CFG
RunAsDaemon: yes
#RunAsDaemon: no
Interval: 60
EnableIPv6: no
WorkDir: c:\inetpub\wwwroot\mrtg

Target[DDR05]: `c:\monitor\checkrep.exe`
MaxBytes[DDR05]: 500000
Options[DDR05]: gauge,growright,nopercent,noo
XSize[DDR05]: 600
YSize[DDR05]: 175
PNGTitle[DDR05]: DDR05->DDR02 Replication Status
LegendI[DDR05]: Records:
Ylegend[DDR05]: Records
ShortLegend[DDR05]: records  
Title[DDR05]: Data Domain Replication Status
PageTop[DDR05]: <*h1>Source Records Remaining - DDR05->DDR02