For those of you wanting to know more about creating property filters, waiting on updates, and multi-threading with the VI SDK and VI Perl, I just posted .NET and VI Perl versions of a new utility I have dubbed Monét. You can download it, explore its SVN repo, and read more about it at . From my site:
"Monét (as in “Count de…”) stands for “Monitors Events and Tasks” and monitors an ESX or VirtualCenter server, recording tasks to standard out, a syslog server, or a Windows event log server. This application teaches several important VI3 SDK concepts: creating property filters, waiting on updates, and creating multi-threaded VI3 SDK utilities. Monét comes in a variety of flavors; it is currently implemented using Microsoft .NET with C# 2.0 as well as the VI Perl Toolkit and Java."
Hi,
I tried this on our virtualcenter machine however, after about 30 secs the program throws up an exception and dies (see below). Can you please advise? Also, are there any plans for this to run as a service instead?
Thanks,
Josh
C:\monet>monet -s virtualcenter.fqdn -u administrator -p XXXXXXX
-o syslog.fqdn
Monitoring server. Press any key to quit...
Unhandled Exception: System.Net.WebException: The request failed with an empty r
esponse.
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClie
ntMessage message, WebResponse response, Stream responseStream, Boolean asyncCal
l)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodN
ame, Object[] parameters)
at VimApi.VimService.RetrieveServiceContent(ManagedObjectReference _this)
at monet.Program.StayLoggedIn(Object state)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state
)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
Your server is not setup to support non-SSL connections. Use the -l switch.
with -l i get the following:
C:\monet>monet -s virtualcenter.fqdn -l -u administrator -p XXXXXXX -o syslog.fqdn
Monitoring server. Press any key to quit...
Unhandled Exception: System.Net.WebException: The underlying connection was clos
ed: Could not establish trust relationship for the SSL/TLS secure channel. --->
System.Security.Authentication.AuthenticationException: The remote certificate i
s invalid according to the validation procedure.
at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken messag
e, AsyncProtocolRequest asyncRequest, Exception exception)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 coun
t, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes
, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 coun
t, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes
, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 coun
t, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes
, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 coun
t, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes
, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 coun
t, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes
, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocol
Request asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToke
n message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, A
syncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byt
e[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyRes
ult)
at System.Net.TlsStream.CallProcessAuthentication(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest
request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequ
est request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodN
ame, Object[] parameters)
at VimApi.VimService.RetrieveServiceContent(ManagedObjectReference _this)
at monet.Program.StayLoggedIn(Object state)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state
)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
You need to import your VC or ESX server's SSL certificate into your trusted key-store. If you have not replaced said certificate on the server then it will be called "VMware". Create a hosts entry that points "vmware" to your server's IP address to get the SSL name-matching to work.
Ok, that sorted that problem.. But now I get:
C:\monet>monet -s vmware -l -u administrator -p XXXXXX -o syslog.fqdn
Monitoring server. Press any key to quit...
Connecting
Connected
Connection timed out
Connecting
Connected
Connection timed out
Connecting
Connected
Connection timed out
Connecting
Connected
Flood detected
Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at monet.Program.LogMessage(String msg)
at monet.Program.LogMessage(Event evt)
at monet.Program.<WaitForUpdates>b__0(PropertyFilterUpdate pfu)
at System.Array.ForEach[T](T[] array, Action`1 action)
at monet.Program.WaitForUpdates(Object state)
at System.Threading._ThreadPoolWaitCallback.WaitCallback_Context(Object state
)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, C
ontextCallback callback, Object state)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
Finally got it running by not including the "-o syslog.fqdn" argument and writing to the eventlog instead. There are still some issues though... monet.exe seems to peg the CPU at 100% continuously and its memory usage hovers around 56MB before eventually settling to around 35M. A little excessive isn't it?
Hmmm, I recommend you use the Perl version -- it is much faster.
did you ever get syslog to work or try the perl version?
Hi, I am really interested in the perl version of Monet but cannot find it anywhere ?
Any chance you could send me a working link or email to me ?
Cheers,
Ian O
Does anybody know where Monét is????:D