Re: Cumulative Bandwidth limits under Windows 2000 WMS

From: Ravi Raman (ravira_at_online.microsoft.com)
Date: 05/10/04


Date: Mon, 10 May 2004 11:02:46 -0700

Simple script which will deny new connections if the
number of bytes exceeded certain limit since last reset.
Please copy this as "limit.vbs" and run from command
prompt as "cscript limit.vbs" after modifying the script
with parameters to suit your needs:

---
pubptname = "Yourpubname"	' The pubpt. being tracked
CheckingFrequency = 60 		' How often you would 
check in seconds - currently every minute
NumIterationsCheck = 60*24*31 	' How many iteration of 
checking will be done 
MaxBytesAllowed = 10000000 	' Maximum bytes allowed 
after which we will stop permitting connections
set obj = createobject("WMSServer.server")
set pubpt = obj.PublishingPoints(pubptname)
set totcnt = pubpt.TotalCounters
do
bytessent = CLng(totcnt.PlayerBytesSent)
if BytesSent > MaxBytesAllowed then
   WScript.echo "Pubpt. "+pubptname+" reports "+CStr
(bytessent)+" bytes sent."
   WScript.echo "Limits exceeded. We will deny any new 
connections, existing connections will still run though .."
   pubpt.AllowClientsToConnect = false
   exit do
else 
   WScript.echo "Pubpt. "+pubptname+" reports "+CStr
(totcnt.PlayerBytesSent)+" bytes streamed."
end if
wscript.sleep checkingfrequency*1000
loop while i < NumIterationsCheck
WScript.echo "Script ended."
---
To reset counters, copy the following 
as "resetcounter.vbs" and run on cmd line as "cscript 
resetcounter.vbs":
pubptname = "YourPubName"	' The pubpt. being tracked
set obj = createobject("WMSServer.server")
set pubpt = obj.PublishingPoints(pubptname)
set totcnt = pubpt.TotalCounters
totcnt.Reset
WScript.echo "Pubpt. "+pubptname+" has been reset. Total 
player bytes: "+CStr(totcnt.PlayerBytesSent)
--
Hope this helps. Unfortunately, this has been tested yet - 
please try this and modify this to suit your need. The 
above is provided just as a sample. 
--
This posting is provided "AS IS" with no warranties, and 
confers no rights. Use of included script samples are 
subject to the terms specified at 
http://www.microsoft.com/info/cpyright.htm"
>-----Original Message-----
>Ravi - yes, I would be interested in a little more info 
on this property.
>meantime I'll have a scoot round in MSDN and see if I can 
find it.
>"Ravi Raman" <ravira@Online.microsoft.com> wrote in 
message
>news:a64b01c43644$88a7c970$a401280a@phx.gbl...
>> There is a TotalCounters.PlayerBytesSent counter that is
>> available on object model that you can check to find out
>> the total number of bytes sent "since the last reset". I
>> am not sure if this counter would get reset if I stop 
and
>> restart the server, i will need to check - in which 
case,
>> it will not work if you restarted your server (unless 
you
>> code around it again).
>>
>> You can write an application (or I can try to provide a
>> sample VBScript on how to retrieve the counter if you 
are
>> interested), that will run in a loop checking every
>> minute whether the total bytes sent on that publishing
>> point exceeded a specific amount or not. Please let me
>> know if you will be interested in knowing how.
>>
>> Thx,
>> Ravi
>> --
>> This posting is provided "AS IS" with no warranties, and
>> confers no rights.
>>
>> >-----Original Message-----
>> >We have a requirement right now to set a maximum
>> bandwidth limit on a
>> >windows media server (on a per-publishing point basis).
>> so a point could
>> >deliver a maximum of, say, 3GB per month.
>> >
>> >I've been in and out of the docs till I'm blue in the
>> face and have come to
>> >the conclusion there's nothing built in for this.
>> >
>> >My current harebrained scheme is to write some sort of
>> log parser which
>> >would monitor each PP's consumption at regular 
intervals
>> and shut down the
>> >point when the limit is exceeded. This is, of course, a
>> non-trivial task and
>> >I'd rather not do it if there's another way.
>> >
>> >so the question is, is there another way?
>> >
>> >thanks folks.
>> >
>> >Jason
>> >
>> >
>> >.
>> >
>
>
>.
>


Relevant Pages

  • Deny new connections with script
    ... I am i need of a script that will set a publishing point to "Deny new ... I have a script that will start and stop and even change the source. ... cannot figure out how to do it to deny connections.. ...
    (microsoft.public.windowsmedia.server)
  • Re: PIC code self-start execution
    ... I've ensured that MCLR is high through a power on reset connected as ... with poor programmer connections. ...
    (sci.electronics.design)
  • Re: Error handling problem.
    ... The script appears to be working fine, ... >a problem with the error handling. ... The Err object is implemented in scope-specific manner. ... will implicitly clear (reset) any error settings. ...
    (microsoft.public.windows.server.scripting)
  • Re: Error handling problem.
    ... >>administrator password for the local machine account of all of the ... The script appears to be working fine, ... > The Err object is implemented in scope-specific manner. ... > will implicitly clear (reset) any error settings. ...
    (microsoft.public.windows.server.scripting)
  • Re: Check POP3 E-mail
    ... serves a purpose. ... memory unless it is reset when you run under mod_perl. ... >> start of the script emptying any data left over from the previous ... It ISN'T incorrect at all. ...
    (comp.lang.perl.misc)