Performance data collector... 
Author Message
 Performance data collector...

Good evening!

Wondering if someone could help out with a little project? I have been
attempting to get some code right. I'm new to VBScript, so this project has
been giving me some trouble. Currently I have a performance counter dll
installed on a windows NT box for collecting remote performace data from
servers. I have been trying to complete the code below to work with a DSN
called webimpact (Access 97 datasource). The vbscript goes to a table called
"Server", in which is has a field called "Code". The code field contains IP
addresses and server names... It uses this info to "hit" the server and
collect performance data. The only one problem is now, is that it refuses to
complete the AddNew record(bottom of the page...) It seems to step through
and collect the data from the first server, but when it gets to AddNew, it
seems to say that insert of a new record can't take place...

Any help would be really appreciated!


Option Explicit

Dim dbsPerf
Dim strODBC
Dim rstRecord
Dim rstServer
Dim strRecset
Dim strServerName
Dim o
Dim i
Dim Myitem
Dim strSQL
Dim strSQL2
Dim Counter(2)
Dim results(2)

    Set dbsPerf = CreateObject("ADODB.Connection") 'Create ADO Connection
        dbsPerf.Open "webimpact" 'Execute Open connection To webimpact DSN


    Set strRecset = CreateObject("ADODB.Recordset") 'Create And Open
Recordset Object
        strRecset.ActiveConnection = dbsPerf
        strRecset.Source = "System"

    Set strODBC = CreateObject("ADODB.Command")

        strODBC.ActiveConnection = dbsPerf

        strSQL2 = "Select * from Server"

        strODBC.CommandText = strSQL2

    Set rstRecord = strODBC.Execute

        rstRecord.MoveFirst         'Move to the First Record in the Table

    Set o = CreateObject("PerfCount.Counters")

    Counter(0) = "LogicalDisk(_Total)\% Free Space"
    Counter(1) = "Memory\% Committed Bytes In Use"
    Counter(2) = "Processor(_Total)\% Processor Time"

    Do Until rstRecord.EOF      'Loop through all  records in the table
Until the End of the recordset (EOF) Is reached

        strServerName = rstRecord("Code")   'get the server Name

        o.SystemName = strServerName

        o.InputCounters = Counter


        i = 0

        For Each Myitem In o.OutPutResults
                If Myitem = "Error Adding Counter" Then
                    Myitem = Null
                End If

                results(i) = Myitem

                i = i + 1
    strRecset.Fields("Server") = strServerName
    strRecset.Fields("Disk") = results(0)
    strRecset.Fields("Memory") = results(1)
    strRecset.Fields("CPU") = results(2)

    rstRecord.MoveNext      'move to the next Record in the table

    rstRecord.Close     'Finished with table so close recordset
    dbsPerf.Close       'Finished with Database so Close

Thu, 20 Nov 2003 09:42:14 GMT  
 [ 1 post ] 

 Relevant Pages 

1. read the performance data

2. pdh - performance data

3. performance data for X11/NeWS server

4. question regarding the garbage collector

5. Parallel interface card with Coin Collector in VB

6. Parallel interface card with Coin Collector in VB

7. FA: Old L100 imagesetter - suit Australian collector

8. garbage collector

9. Garbage Collector

10. Modifying datas / sending to the server / garbage collector ?

11. Performance problems when reading schema data from field objects

12. Performance Data class, call to NextValue Kills CPU


Powered by phpBB® Forum Software