Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Exchange
2000.active.directory
2000.admin
2000.announcements
2000.app.conversion
2000.applications
2000.clients
2000.clustering
2000.connectivity
2000.development
2000.documentation
2000.general
2000.information.store
2000.interop
2000.kms
2000.misc
2000.protocols
2000.realtime.collabo.
2000.setup
2000.transport
2000.win2000
admin
application.conversion
applications
clients
clustering
connectivity
design
development
misc
mobility
setup
tools
  
 
date: 8 Dec 2005 05:14:06 -0800,    group: microsoft.public.exchange2000.setup.installation        back       


How can I count the number of emails sent externally a month   
My boss wants me to  find out what our average number of external
emails sent per month is. How can I extract this information out of
Exchange.

Thanks
date: 8 Dec 2005 05:14:06 -0800   author:   unknown

Re: How can I count the number of emails sent externally a month   
You could enable message tracking, and then you could use Log Parser to get 
a nice little csv file that you can import in a SQL or Access database 
file...
More info on Log Parse here:
http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx

HTH
Ilse
 wrote in message 
news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
> My boss wants me to  find out what our average number of external
> emails sent per month is. How can I extract this information out of
> Exchange.
>
> Thanks
>
date: Thu, 8 Dec 2005 15:31:10 +0100   author:   Ilse Van Criekinge

Re: How can I count the number of emails sent externally a month   
.... or you can use 3rd party Exchange reporting tools like Prodomag and 
Quest MessageStats.
-- 
Bharat Suneja
MCSE, MCT
www.zenprise.com
blog: www.suneja.com/blog
-----------------------------------------


"Ilse Van Criekinge"  wrote in message 
news:%23Un1MQA$FHA.1172@TK2MSFTNGP10.phx.gbl...
> You could enable message tracking, and then you could use Log Parser to 
> get a nice little csv file that you can import in a SQL or Access database 
> file...
> More info on Log Parse here:
> http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
>
> HTH
> Ilse
>  wrote in message 
> news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
>> My boss wants me to  find out what our average number of external
>> emails sent per month is. How can I extract this information out of
>> Exchange.
>>
>> Thanks
>>
>
>
date: Thu, 8 Dec 2005 08:01:52 -0800   author:   Bharat Suneja

Re: How can I count the number of emails sent externally a month   
So what is the easiest method of performing this?

Thanks.

Bharat Suneja wrote:
> ... or you can use 3rd party Exchange reporting tools like Prodomag and
> Quest MessageStats.
> --
> Bharat Suneja
> MCSE, MCT
> www.zenprise.com
> blog: www.suneja.com/blog
> -----------------------------------------
>
>
> "Ilse Van Criekinge"  wrote in message
> news:%23Un1MQA$FHA.1172@TK2MSFTNGP10.phx.gbl...
> > You could enable message tracking, and then you could use Log Parser to
> > get a nice little csv file that you can import in a SQL or Access database
> > file...
> > More info on Log Parse here:
> > http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
> >
> > HTH
> > Ilse
> >  wrote in message
> > news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
> >> My boss wants me to  find out what our average number of external
> >> emails sent per month is. How can I extract this information out of
> >> Exchange.
> >>
> >> Thanks
> >>
> >
> >
date: 8 Dec 2005 09:00:37 -0800   author:   unknown

Re: How can I count the number of emails sent externally a month   
The 3rd party tools I mentioned are quite easy-to-use... you can try 
downloading the trial versions and see if they meet your reporting and 
ease-of-use requirements.
-- 
Bharat Suneja
MCSE, MCT
www.zenprise.com
blog: www.suneja.com/blog
-----------------------------------------


 wrote in message 
news:1134061236.937586.323820@g43g2000cwa.googlegroups.com...
>
> So what is the easiest method of performing this?
>
> Thanks.
>
> Bharat Suneja wrote:
>> ... or you can use 3rd party Exchange reporting tools like Prodomag and
>> Quest MessageStats.
>> --
>> Bharat Suneja
>> MCSE, MCT
>> www.zenprise.com
>> blog: www.suneja.com/blog
>> -----------------------------------------
>>
>>
>> "Ilse Van Criekinge"  wrote in message
>> news:%23Un1MQA$FHA.1172@TK2MSFTNGP10.phx.gbl...
>> > You could enable message tracking, and then you could use Log Parser to
>> > get a nice little csv file that you can import in a SQL or Access 
>> > database
>> > file...
>> > More info on Log Parse here:
>> > http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
>> >
>> > HTH
>> > Ilse
>> >  wrote in message
>> > news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
>> >> My boss wants me to  find out what our average number of external
>> >> emails sent per month is. How can I extract this information out of
>> >> Exchange.
>> >>
>> >> Thanks
>> >>
>> >
>> >
>
date: Thu, 8 Dec 2005 09:06:10 -0800   author:   Bharat Suneja

Re: How can I count the number of emails sent externally a month   
GFi Mail Essentials has a great reporting tool in it. 30 day trial it and 
see if that does what you want.

Nick

"Bharat Suneja"  wrote in message 
news:OY1HymB$FHA.2264@tk2msftngp13.phx.gbl...
> The 3rd party tools I mentioned are quite easy-to-use... you can try 
> downloading the trial versions and see if they meet your reporting and 
> ease-of-use requirements.
> -- 
> Bharat Suneja
> MCSE, MCT
> www.zenprise.com
> blog: www.suneja.com/blog
> -----------------------------------------
>
>
>  wrote in message 
> news:1134061236.937586.323820@g43g2000cwa.googlegroups.com...
>>
>> So what is the easiest method of performing this?
>>
>> Thanks.
>>
>> Bharat Suneja wrote:
>>> ... or you can use 3rd party Exchange reporting tools like Prodomag and
>>> Quest MessageStats.
>>> --
>>> Bharat Suneja
>>> MCSE, MCT
>>> www.zenprise.com
>>> blog: www.suneja.com/blog
>>> -----------------------------------------
>>>
>>>
>>> "Ilse Van Criekinge"  wrote in message
>>> news:%23Un1MQA$FHA.1172@TK2MSFTNGP10.phx.gbl...
>>> > You could enable message tracking, and then you could use Log Parser 
>>> > to
>>> > get a nice little csv file that you can import in a SQL or Access 
>>> > database
>>> > file...
>>> > More info on Log Parse here:
>>> > http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
>>> >
>>> > HTH
>>> > Ilse
>>> >  wrote in message
>>> > news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
>>> >> My boss wants me to  find out what our average number of external
>>> >> emails sent per month is. How can I extract this information out of
>>> >> Exchange.
>>> >>
>>> >> Thanks
>>> >>
>>> >
>>> >
>>
>
>
date: Thu, 8 Dec 2005 23:40:58 -0000   author:   Nick Gillott [MVP]

Re: How can I count the number of emails sent externally a month   
Thanks a lot guys. Will try the Quest MessageStats.

Cheers!


Nick Gillott [MVP] wrote:
> GFi Mail Essentials has a great reporting tool in it. 30 day trial it and
> see if that does what you want.
>
> Nick
>
> "Bharat Suneja"  wrote in message
> news:OY1HymB$FHA.2264@tk2msftngp13.phx.gbl...
> > The 3rd party tools I mentioned are quite easy-to-use... you can try
> > downloading the trial versions and see if they meet your reporting and
> > ease-of-use requirements.
> > --
> > Bharat Suneja
> > MCSE, MCT
> > www.zenprise.com
> > blog: www.suneja.com/blog
> > -----------------------------------------
> >
> >
> >  wrote in message
> > news:1134061236.937586.323820@g43g2000cwa.googlegroups.com...
> >>
> >> So what is the easiest method of performing this?
> >>
> >> Thanks.
> >>
> >> Bharat Suneja wrote:
> >>> ... or you can use 3rd party Exchange reporting tools like Prodomag and
> >>> Quest MessageStats.
> >>> --
> >>> Bharat Suneja
> >>> MCSE, MCT
> >>> www.zenprise.com
> >>> blog: www.suneja.com/blog
> >>> -----------------------------------------
> >>>
> >>>
> >>> "Ilse Van Criekinge"  wrote in message
> >>> news:%23Un1MQA$FHA.1172@TK2MSFTNGP10.phx.gbl...
> >>> > You could enable message tracking, and then you could use Log Parser
> >>> > to
> >>> > get a nice little csv file that you can import in a SQL or Access
> >>> > database
> >>> > file...
> >>> > More info on Log Parse here:
> >>> > http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
> >>> >
> >>> > HTH
> >>> > Ilse
> >>> >  wrote in message
> >>> > news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
> >>> >> My boss wants me to  find out what our average number of external
> >>> >> emails sent per month is. How can I extract this information out of
> >>> >> Exchange.
> >>> >>
> >>> >> Thanks
> >>> >>
> >>> >
> >>> >
> >>
> >
> >
date: 9 Dec 2005 04:23:10 -0800   author:   unknown

Re: How can I count the number of emails sent externally a month   
test2005@bgop.org.uk wrote:
> Thanks a lot guys. Will try the Quest MessageStats.
>
> Cheers!
>
>
> Nick Gillott [MVP] wrote:
> > GFi Mail Essentials has a great reporting tool in it. 30 day trial it and
> > see if that does what you want.
> >
> > Nick
> >
> > "Bharat Suneja"  wrote in message
> > news:OY1HymB$FHA.2264@tk2msftngp13.phx.gbl...
> > > The 3rd party tools I mentioned are quite easy-to-use... you can try
> > > downloading the trial versions and see if they meet your reporting and
> > > ease-of-use requirements.
> > > --
> > > Bharat Suneja
> > > MCSE, MCT
> > > www.zenprise.com
> > > blog: www.suneja.com/blog
> > > -----------------------------------------
> > >
> > >
> > >  wrote in message
> > > news:1134061236.937586.323820@g43g2000cwa.googlegroups.com...
> > >>
> > >> So what is the easiest method of performing this?
> > >>
> > >> Thanks.
> > >>
> > >> Bharat Suneja wrote:
> > >>> ... or you can use 3rd party Exchange reporting tools like Prodomag and
> > >>> Quest MessageStats.
> > >>> --
> > >>> Bharat Suneja
> > >>> MCSE, MCT
> > >>> www.zenprise.com
> > >>> blog: www.suneja.com/blog
> > >>> -----------------------------------------
> > >>>
> > >>>
> > >>> "Ilse Van Criekinge"  wrote in message
> > >>> news:%23Un1MQA$FHA.1172@TK2MSFTNGP10.phx.gbl...
> > >>> > You could enable message tracking, and then you could use Log Parser
> > >>> > to
> > >>> > get a nice little csv file that you can import in a SQL or Access
> > >>> > database
> > >>> > file...
> > >>> > More info on Log Parse here:
> > >>> > http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx
> > >>> >
> > >>> > HTH
> > >>> > Ilse
> > >>> >  wrote in message
> > >>> > news:1134047646.645570.287390@g49g2000cwa.googlegroups.com...
> > >>> >> My boss wants me to  find out what our average number of external
> > >>> >> emails sent per month is. How can I extract this information out of
> > >>> >> Exchange.
> > >>> >>
> > >>> >> Thanks
> > >>> >>

My colleagues and I at the University of Missouri have a number of
real-time monitors for traffic throughput, queue sizes, etc... We
monitor 24 exchange servers and over 1M messages a day.

They are useful in noting 'bubbles' in delivery from spam or other
notable incidents.

The following code using wmi calls to monitor smtp traffic and creates
an html file showing minute, ten minute and daily traffic within all
the exchange servers...

syntax is:

cscript messages.vbs /f output-file-name /ldap ldap-server-name /site
exchang-site name /org exchange-org-name /root exchange-roo-dn

we use:

cscript messages.vbs /f "c:\umsystem.html" /ldap um.umsystem.edu /site
UM System /org University of Missouri /root dc=umad,dc=umsystem,dc=edu

we run the script as a service

here's the code...save as messages.vbs..the formatting probably will
not hold ;)

dim messages_sent_today(30)
dim messages_received_today(30)
dim messages_delivered_today(30)

sub refresh_totals(n, i, f)
	if n = "" then
		exit sub
	end if

'	wscript.echo n, i, f

on error resume next
	set sr = fs.OpenTextFile (f, 1, True)
	if err.number = 0 then
		in_string = sr.readline
'		wscript.echo in_string
		while err.number = 0
'			wscript.echo in_string
			values = split(in_string, ",")
			if values(0) = n then
				messages_sent_today(i) = values(1)
				messages_received_today(i) = values(2)
				messages_delivered_today(i) = values(3)
				wscript.echo messages_sent_today(i), messages_received_today(i),
messages_delivered_today(i)
		        	sr.Close()
				exit sub
			end if
			in_string = sr.readline
		wend
        	sr.Close()
	end if 'err.number = 0 then
end sub

 Sub http_start(f , s)

        'Dim fs As New FileStream(f, FileMode.Create, FileAccess.Write,
FileShare.ReadWrite)
        'Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	set sr = fs.OpenTextFile (f, 2, True)


        sr.WriteLine("<html>")
        sr.WriteLine("<head>")
        sr.WriteLine("<TITLE>" & s & "</TITLE")
        sr.WriteLine("</head>")
        sr.WriteLine("<body>")

        sr.Close()
'        fs.Close()

    End Sub


    Sub http_end( f )

'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)


        sr.WriteLine("</body>")
        sr.WriteLine("</html>")

        sr.Close()
        'fs.Close()

    End Sub

    Sub http_start_table(f )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("<TABLE>")
        sr.Close()
        'fs.Close()

    End Sub

    Sub http_end_table( f )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("</TABLE>")
        sr.Close()
        'fs.Close()

    End Sub

    Sub http_caption(f, s )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("<CAPTION>")
        sr.WriteLine(s)
        sr.WriteLine("</CAPTION>")
        sr.Close()
        'fs.Close()

    End Sub

    Sub http_start_table_row( f )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("<TR>")
        sr.Close()
        'fs.Close()

    End Sub
    Sub http_end_table_row( f )

'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("</TR>")
        sr.Close()
        'fs.Close()

    End Sub

    Sub http_table_row_cell( f , s )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        'sr.WriteLine("<TD ALIGN (RIGHT)>" & s & "</TD>")
        sr.WriteLine("<TD><Right>" & s & "</TD>")

        sr.Close()
        'fs.Close()

    End Sub

    Sub http_table_row_header(f , s )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("<TH>" & s & "</TH>")

        sr.Close()
        'fs.Close()

    End Sub


    Sub http_paragraph(f , s )
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine("<P>" & s & "</P>")

        sr.Close()
        'fs.Close()

    End Sub

    Sub http_string(f, s)
'        Dim fs As New FileStream(f, FileMode.Append, FileAccess.Write,
FileShare.ReadWrite)
'        Dim sr As New StreamWriter(fs)

	Set fs = CreateObject("Scripting.FileSystemObject")

	Set sr = fs.OpenTextFile (f, 8, True)

        sr.WriteLine(s)

        sr.Close()
        'fs.Close()
    End Sub

    Function kform( l )' As String
        kform = Formatnumber(l / 1024, 0, -1, -1, -1) & "K"
    End Function

    Function mform( l ) 'As String
        mform = Formatnumber(l / 1024 / 1024, 0, -1, -1, -1) & "M"
    End Function

    Function gform( l ) 'As String
        gform = Formatnumber(l / 1024 / 1024 / 1024, 0, -1, -1, -1) &
"G"
    End Function

    Function numForm( l )' As String
'        numForm = Format(l, "#,###.#")
        numForm = Formatnumber(l, 0, -1, -1, -1)
    End Function

function get_token(token)
	get_token = ""
	Set objArgs = WScript.Arguments
	for i = 0 to objargs.count-1
'wscript.echo i, objargs.count, token, objargs(i)
		if (instr(objargs(i), "/") = 1) then
			do_it = 0
		end if

		if (do_it = 1) then
			get_token = get_token + " "+ objargs(i)
		end if

		if (objargs(i) = token) then
			do_it = 1
		end if
	next

get_token = ltrim(rtrim(get_token))

	wscript.echo token+"="+get_token

end function


On Error Resume Next
dim computer

since_string = "(since " & format(now,"HH:MM") & ")"

dim messages_sent(30)
dim messages_delivered(30)
dim messages_received(30)

dim messages_sent_minute(30,60)
dim messages_delivered_minute(30,60)
dim messages_received_minute(30,60)

dim bytes_sent_minute(30,60)
dim bytes_delivered_minute(30,60)
dim bytes_received_minute(30,60)

dim messages_sent_hour(30,24)
dim messages_delivered_hour(30,24)
dim messages_received_hour(30,24)

dim bytes_sent_hour(30,24)
dim bytes_delivered_hour(30,24)
dim bytes_received_hour(30,24)

'dim messages_sent_today(30)
'dim messages_received_today(30)
'dim messages_delivered_today(30)

dim total_messages(30)

dim bytes_sent(30)
dim bytes_delivered(30)
dim bytes_received(30)

dim computer_names(30)

if wscript.arguments.count > 0 then
	f = wscript.arguments(0)
else
	f = "c:\messages.html"
end if

if get_token("/f") = "" then
	f = "c:\messages.html"
else
	f = get_token("/f")
end if

if get_token("/ldap") = "" then
	ldap = "um.umsystem.edu"
else
	ldap = get_token("/ldap")
end if


if get_token("/root") = "" then
	root = "DC=umad,DC=umsystem,DC=edu"
else
	root = get_token("/root")
end if


if get_token("/org") = "" then
	org = "University of Missouri"
else
	org = get_token("/org")
end if


if get_token("/site") = "" then
	site = "UM System"
else
	site = get_token("/site")
end if

html = f
f = "temphtml.txt"

bytes_minute_sent_total = 0
bytes_minute_received_total = 0
bytes_minute_delivered_total = 0

' get old computer wmi data
first_time = 1
	Set fs = CreateObject("Scripting.FileSystemObject")

if 1=1 then
err.clear

end if

	now_time = time

	current_hour = hour(now_time)
	current_minute = minute(now_time)
	wscript.echo current_hour, current_minute

today_string = "(since " & current_hour & ":" & current_minute & ")"
today_string = "(since " & formatdatetime(time, 4) & ")"
counter = 0

file_time = now

while true
	set sr = fs.OpenTextFile ("servers.x", 1, True)
	if err.number = 0 then
		except_string = sr.readline
		wscript.echo except_string
        	sr.Close()
	end if 'err.number = 0 then

'	file_time = now

	counter = counter+1
	wscript.echo cstr(time)
	now_time = time

	current_hour = hour(now_time)
	current_minute = minute(now_time)
	wscript.echo current_hour, current_minute


	call http_start(f, "Exchange server message throughput")
        call http_string(f, "<META HTTP-EQUIV=""REFRESH""
CONTENT=""30"">")

        call http_start_table(f)
        call http_string(f, "<TABLE BORDER=1 WIDTH=900>")

        call http_start_table_row(f)
        call http_string(f, "<TH ROWSPAN=3 COLSPAN=1> Server </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=5> SMTP Messages in
1 minute </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=3> Last 10 minutes
</TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=3> Today " &
today_string &" </TH>")
	call http_end_table_row(f)

	call http_start_table_row(f)
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=2> Sent </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=2> Received </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> Delivered </TH>")

        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> S </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> R </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> D </TH>")

        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> S </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> R </TH>")
        call http_string(f, "<TH ROWSPAN=1 COLSPAN=1> D </TH>")

        call http_end_table_row(f)

        call http_start_table_row(f)

        call http_table_row_header(f, "Messages")
        call http_table_row_header(f, "Bytes")
        call http_table_row_header(f, "Messages")
        call http_table_row_header(f, "Bytes")
        call http_table_row_header(f, "Messages")
'        call http_table_row_header(f, "Bytes")

        call http_table_row_header(f, "Msgs")
        call http_table_row_header(f, "Msgs")
        call http_table_row_header(f, "Msgs")
        call http_table_row_header(f, "Msgs")
        call http_table_row_header(f, "Msgs")
        call http_table_row_header(f, "Msgs")

        call http_end_table_row(f)


	i = 0
'start
    Set oConnection = CreateObject("ADODB.Connection")
    Set oRecordset = CreateObject("ADODB.Recordset")
    Set comm = CreateObject("ADODB.Command")

    Set ado_adsi_con = CreateObject("ADODB.Connection")
    Set do_adsi_rs1 = CreateObject("ADODB.Recordset")

    ado_adsi_con.Provider = "ADSDSOObject"
    ado_adsi_con.Open
    If ado_adsi_con.State <> 1 Then
        Debug.Print "Connection to AD Failed"
        quit
    End If

    Set comm.ActiveConnection = ado_adsi_con
    comm.Properties("Sort On") = "name"

    comm.CommandText = "<LDAP://" & ldap & "/CN=Servers,CN=" & site &
",CN=Administrative Groups,CN=" & org & ",CN=Microsoft
Exchange,CN=Services,CN=Configuration," & root &
">;(&(objectClass=msExchExchangeServer));name;subtree"

wscript.echo  comm.CommandText

    comm.Properties("Page Size") = 999
    Set ado_adsi_rs1 = comm.Execute
done = 0

    While Not ado_adsi_rs1.EOF


        strComputer = ado_adsi_rs1.Fields(0)

'end
'	for each strComputer in Computer
	computer_names(i) = strComputer


        Wscript.Echo "************"
	WSCRIPT.echo strComputer
	if instr(lcase(except_string), lcase(strComputer)) = 0 then
on error resume next
'		Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\cimv2")
		Set objWMIService = GetObject("winmgmts:\\" & strComputer )
		Set colItems = objWMIService.ExecQuery("Select * from
Win32_PerfRawData_SMTPSVC_SMTPServer",,48)
		smtp_Found = 0


on error resume next
		For Each objItem in colItems
wscript.echo strcomputer, objitem.name

			if objitem.name = "_Total" then

				if objItem.MessagesSentTotal >= messages_sent(i) then
					messages_sent_minute(i, current_minute) =
objItem.MessagesSentTotal - messages_sent(i)
					messages_sent(i) = messages_sent(i) + messages_sent_minute(i,
current_minute)
				else
					messages_sent_minute(i, current_minute) =
objItem.MessagesSentTotal
					messages_sent(i) = messages_sent_minute(i, current_minute)
				end if

				if objItem.MessagesReceivedTotal >= messages_received(i) then
					messages_received_minute(i, current_minute) =
objItem.MessagesReceivedTotal - messages_received(i)
					messages_received(i) = messages_received(i) +
messages_received_minute(i, current_minute)
				else
					messages_received_minute(i, current_minute) =
objItem.MessagesReceivedTotal
					messages_received(i) = messages_received_minute(i, current_minute)
				end if

				if objItem.MessagesDeliveredTotal >= messages_delivered(i) then
					messages_delivered_minute(i, current_minute) =
objItem.MessagesdeliveredTotal - messages_delivered(i)
					messages_delivered(i) = messages_delivered(i) +
messages_delivered_minute(i, current_minute)
				else
					messages_delivered_minute(i, current_minute) =
objItem.MessagesdeliveredTotal
					messages_delivered(i) = messages_delivered_minute(i,
current_minute)
				end if

				if objItem.bytesSentTotal/1024 >= bytes_sent(i) then
					bytes_sent_minute(i, current_minute) = objItem.bytesSentTotal/1024
- bytes_sent(i)
					bytes_sent(i) = bytes_sent(i) + bytes_sent_minute(i,
current_minute)
				else
					bytes_sent_minute(i, current_minute) = objItem.bytesSentTotal/1024
					bytes_sent(i) = bytes_sent_minute(i, current_minute)
				end if
				if objItem.bytesReceivedTotal/1024 >= bytes_received(i) then
					bytes_received_minute(i, current_minute) =
objItem.bytesReceivedTotal/1024 - bytes_received(i)
					bytes_received(i) = bytes_received(i) + bytes_received_minute(i,
current_minute)
				else
					bytes_received_minute(i, current_minute) =
objItem.bytesReceivedTotal/1024
					bytes_received(i) = bytes_received_minute(i, current_minute)
				end if
if 0 = 1 then
				if objItem.bytesdeliveredTotal/1024 >= bytes_delivered(i) then
					bytes_delivered_minute(i, current_minute) =
objItem.bytesdeliveredTotal/1024 - bytes_delivered(i)
					bytes_delivered(i) = bytes_delivered(i) +
bytes_delivered_minute(i, current_minute)
				else
					bytes_delivered_minute(i, current_minute) =
objItem.bytesdeliveredTotal/1024
					bytes_delivered(i) = bytes_delivered_minute(i, current_minute)
				end if
end if
			end if

		Next
on error goto 0
		end if 'instr(lcase(exception_list), lcase(strComputer)) = 0 then

		messages_sent_hour(i, current_hour) = messages_sent_hour(i,
current_hour) + messages_sent_minute(i, current_minute)
		messages_received_hour(i, current_hour) = messages_received_hour(i,
current_hour) + messages_received_minute(i, current_minute)
		messages_delivered_hour(i, current_hour) = messages_delivered_hour(i,
current_hour) + messages_delivered_minute(i, current_minute)


		bytes_sent_hour(i, current_hour) = bytes_sent_hour(i, current_hour) +
bytes_sent_minute(i, current_minute)
		bytes_received_hour(i, current_hour) = bytes_received_hour(i,
current_hour) + bytes_received_minute(i, current_minute)
		bytes_delivered_hour(i, current_hour) = bytes_delivered_hour(i,
current_hour) + bytes_delivered_minute(i, current_minute)

	 http_start_table_row(f)


        call http_table_row_cell(f, strcomputer)

        call http_table_row_cell(f, numForm(messages_sent_minute(i,
current_minute)))
        call http_table_row_cell(f, numForm(bytes_sent_minute(i,
current_minute)) & "K")
        call http_table_row_cell(f, numForm(messages_received_minute(i,
current_minute)))
        call http_table_row_cell(f, numForm(bytes_received_minute(i,
current_minute)) & "K")
        call http_table_row_cell(f,
numForm(messages_delivered_minute(i, current_minute)))
'        call http_table_row_cell(f, numForm(bytes_delivered_minute(i,
current_minute)) & "K")


	messages_sent_today(i) = messages_sent_today(i) +
messages_sent_minute(i, current_minute)
	messages_received_today(i) = messages_received_today(i) +
messages_received_minute(i, current_minute)
	messages_delivered_today(i) = messages_delivered_today(i) +
messages_delivered_minute(i, current_minute)


'        call http_end_table_row(f)

	temp_sum_r = 0
	temp_sum_d = 0
	temp_sum_s = 0

	for i10 = 0 to 9
		temp_index = current_minute-i10
		if temp_index < 0 then
			temp_index = temp_index + 60
		end if
		temp_sum_r = temp_sum_r + messages_received_minute(i, temp_index)
		temp_sum_d = temp_sum_d + messages_delivered_minute(i, temp_index)
		temp_sum_s = temp_sum_s + messages_sent_minute(i, temp_index)
	next

        call http_table_row_cell(f, numForm(temp_sum_s))
        call http_table_row_cell(f, numForm(temp_sum_r))
        call http_table_row_cell(f, numForm(temp_sum_d))


	last10_total_d = last10_total_d + temp_sum_d
	last10_total_s = last10_total_s + temp_sum_s
	last10_total_r = last10_total_r + temp_sum_r

	temp_sum_r = 0
	temp_sum_d = 0
	temp_sum_s = 0

	call http_table_row_cell(f, numForm(messages_sent_today(i)))
        call http_table_row_cell(f,
numForm(messages_received_today(i)))
        call http_table_row_cell(f,
numForm(messages_delivered_today(i)))

        call http_end_table_row(f)



		i = i + 1


'	next 'strComputer

	ado_adsi_rs1.MoveNext

    Wend
	wscript.echo "Totals = ", minute_total, mta_minute_total

        call http_table_row_cell(f, "Totals")


messages_minute_sent_total = 0
bytes_minute_sent_total = 0
messages_minute_received_total = 0
bytes_minute_received_total = 0
messages_minute_delivered_total = 0
bytes_minute_delivered_total = 0

	today_s = 0
	today_r = 0
	today_d = 0


for i30 = 0 to ubound(messages_sent_today)
	messages_minute_sent_total = messages_minute_sent_total +
messages_sent_minute(i30, current_minute)
	messages_minute_received_total = messages_minute_received_total +
messages_received_minute(i30, current_minute)
	messages_minute_delivered_total = messages_minute_delivered_total +
messages_delivered_minute(i30, current_minute)

	bytes_minute_sent_total = bytes_minute_sent_total +
bytes_sent_minute(i30, current_minute)
	bytes_minute_received_total = bytes_minute_received_total +
bytes_received_minute(i30, current_minute)
	bytes_minute_delivered_total = bytes_minute_delivered_total +
bytes_delivered_minute(i30, current_minute)

	today_s = today_s + messages_sent_today(i30)
	today_r = today_r + messages_received_today(i30)
	today_d = today_d + messages_delivered_today(i30)

next 'i30


        call http_table_row_cell(f,
numForm(messages_minute_sent_total))
        call http_table_row_cell(f, numForm(bytes_minute_sent_total) &
"K")
        call http_table_row_cell(f,
numForm(messages_minute_received_total))
        call http_table_row_cell(f,
numForm(bytes_minute_received_total) & "K")
        call http_table_row_cell(f,
numForm(messages_minute_delivered_total))
'        call http_table_row_cell(f,
numForm(bytes_minute_delivered_total) & "K")

        call http_table_row_cell(f, numForm(last10_total_s))
        call http_table_row_cell(f, numForm(last10_total_r))
        call http_table_row_cell(f, numForm(last10_total_d))

	last10_total_d = 0
	last10_total_s = 0
	last10_total_r = 0

        call http_table_row_cell(f, numForm(today_s))
        call http_table_row_cell(f, numForm(today_r))
        call http_table_row_cell(f, numForm(today_d))

        call http_end_table_row(f)
        call http_string(f, " Updated " & cstr(date) & " " &
cstr(time))

'	copy to production file
	fs.copyfile f, html

test_hour = test_hour+1

' keep computer wmi data
	thisdate = year(file_time) & right("0" & month(file_time),2) &
right("0" & day(file_time),2) & right("0" & hour(file_time),2) &
right("0" & minute(file_time),2)
	thisdate = year(file_time) & right("0" & month(file_time),2) &
right("0" & day(file_time),2)
	csv_file = "smtp" & thisdate & ".csv"

if first_time <> 1 then

	Set fs = CreateObject("Scripting.FileSystemObject")

	set sr = fs.OpenTextFile (csv_file, 2, True)

for i = 0 to ubound(computer_names)

if computer_names(i) <> "" then
	output_string = computer_names(i) & ", "

	output_string = output_string & messages_sent_today(i) & ", "

	output_string = output_string & messages_received_today(i) & ", "

	output_string = output_string & messages_delivered_today(i)
	sr.WriteLine(output_string)
	wscript.echo output_string
end if

next

        sr.Close()
end if


if first_time = 1 then
	first_time = 0
	for i30 = 0 to ubound(messages_sent_today)
		messages_sent_today(i30) = 0
		messages_received_today(i30) = 0
		messages_delivered_today(i30) = 0
		wscript.echo i30, "Before ", computer_names(i30),
messages_sent_today(i30), messages_received_today(i30),
messages_delivered_today(i30)
		call refresh_totals(computer_names(i30), i30, csv_file)
		wscript.echo i30, "After ", computer_names(i30),
messages_sent_today(i30), messages_received_today(i30),
messages_delivered_today(i30)

	next
	old_minute = current_minute
	old_hour = current_hour
else

	current_time = now
	wscript.echo cstr(current_time)

	if old_hour > current_hour then
		file_time = now
		today_string = ""
		for i30 = 0 to ubound(messages_sent_today)
 			messages_sent_today(i30) = 0
			messages_received_today(i30) = 0
			messages_delivered_today(i30) = 0
			for i24 = 0 to 23
				messages_sent_hour(i30,i24) = 0
				messages_delivered_hour(i30,i24) = 0
				messages_received_hour(i30,i24) = 0

				bytes_sent_hour(i30,i24) = 0
				bytes_delivered_hour(i30,i24) = 0
				bytes_received_hour(i30,i24) = 0
			next
		next
	end if

old_minute = current_minute
old_hour = current_hour

	while old_minute = current_minute
		wscript.echo current_minute, old_minute, current_hour, old_hour,
counter
		wscript.sleep 30000
		wscript.echo time

		current_time = now
		wscript.echo cstr(current_time)
		current_minute = minute(current_time)
	wend

end if

wend
date: 9 Dec 2005 07:42:33 -0800   author:   HankC

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us