You must be a MyPeek member to download our extensibility solutions. Click here to learn more about the benefits of membership and find out how to sign up for free.

If you are not a LiveAction Maintenance Customer but would like to purchase a Maintenance contract for your LiveAction product please click here for sales information.
Category : Scripts
Submitted By : spacepacket
Downloaded : 121 Times
Rating : Not Yet Rated
View Comments (0)
This is a command line utility for the OmniEngine that displays all of the nodes and their stats for a named capture.The OmniEngine can be local or remote. If the named capture does not exist, it is created with the specified adapter.
This program depends on OmniScript 5.2.11 or later.
The Visual Studio Solution and the executable can be downloaded by maintenance members.
Run the program with no arguments to get the usage
Sample Usage: nodestats capture1 "Local Area Connection" 10.4.2.59 root root
#include "stdafx.h" #import "EPRCmdAPI.tlb" rename("value", "val") using namespace EPRCmdAPI; int _tmain(int argc, _TCHAR* argv[]) { _bstr_t bstrCaptureName = L"Capture"; if (argc > 1) { bstrCaptureName = argv[1]; } HRESULT hr; hr = CoInitializeEx(NULL, 0); if ( FAILED( hr ) ) { wprintf( L"Failed to initialize COM.rn" ); return 1; } // create a block inside the coinitialize { CComPtrspCmdMgr; hr = spCmdMgr.CoCreateInstance( _T( "EPRCmdAPI.WPRemoteCmdMgr" ) ); if (FAILED(hr)) { wprintf( L"Failed to initialize OmniScriptrn" ); return -1; } hr = spCmdMgr->Connect( L"localhost", 6367, 30000 ); if (FAILED(hr)) { wprintf( L"Failed to connect to OmniEnginern" ); return -1; } //IPeekRemoteAdapterListPtr spRemoteAdapterList; //spRemoteAdapterList = spCmdMgr->GetRemoteAdapterList(); IPeekRemoteCaptureListPtr spCaptureListPtr; spCaptureListPtr = spCmdMgr->GetCaptureList( ); BOOL bExists = FALSE; LONG lCount = spCaptureListPtr->GetCount(); IPeekRemoteCaptureInfoPtr spCaptureInfo; _bstr_t bstrCapture; for (long i=0; i < lCount; i++ ) { spCaptureInfo = spCaptureListPtr->GetItem( i ); _bstr_t bstrCaptureName2 = spCaptureInfo->GetName(); if (bstrCaptureName == bstrCaptureName2) { bstrCapture = spCaptureInfo->GetID(); bExists = TRUE; break; } } if (bExists == FALSE) { bstrCapture = spCmdMgr->CreateNewCapture( bstrCaptureName, TRUE, FALSE, 0, 0, 0, 0, 0, FALSE, 0, 512, L"Local Area Connection" ); hr = spCmdMgr->StartCapture( bstrCapture ); if (FAILED(hr)) { wprintf( L"Failed to start capturern" ); return -1; } } IPeekRemoteNodeListPtr spRemoteNodeListPtr; spRemoteNodeListPtr = spCmdMgr->GetNodeListAll( bstrCapture ); long nCount = spRemoteNodeListPtr->GetCount(); _tprintf( _T("IP Packets In Packets Out Bytes In Bytes Outrn") ); for (int i=0; i < nCount; i++) { IPeekSimpleNodeStatPtr spNode = spRemoteNodeListPtr->GetItem( i ); _bstr_t bstrIP = spNode->GetIPAddr(); unsigned long nPacketsReceived = spNode->GetPacketsReceived(); unsigned long nPacketsSent = spNode->GetPacketsSent(); double nBytesReceived = spNode->GetBytesReceived(); double nBytesSent = spNode->GetBytesSent(); _tprintf( _T("%-15s %15u %15u %15.0f %15.0frn"), (LPCTSTR)bstrIP, nPacketsReceived, nPacketsSent, nBytesReceived, nBytesSent); } } CoUninitialize(); return 0; }