Autor Thema: Database Activity  (Gelesen 7255 mal)

Offline HipSlu

  • Senior Mitglied
  • ****
  • Beiträge: 339
  • Geschlecht: Männlich
  • I am from Austria
    • konfabulieren.com
Database Activity
« am: 30.09.04 - 12:07:29 »
hi,

kennt ihr eine möglichkeit, wie ich per lotus script an die Database Activity herankomme?

danke!
Notes ist ein Bananenprodukt - es reift beim Kunden
--------------------------------------

Server: 6.5.5 EN auf Sun Solaris 8 & W2K / W2k3
Clients: 6.5.4 DE auf W2K und XP (ca. 3000)

Addon: Group 8.6

klaussal

  • Gast
Re: Database Activity
« Antwort #1 am: 30.09.04 - 12:11:48 »
... was meinst du damit ?

Mögl. Lösung: die log.nsf auswerten.
klaus

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.718
  • Geschlecht: Männlich
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

Offline HipSlu

  • Senior Mitglied
  • ****
  • Beiträge: 339
  • Geschlecht: Männlich
  • I am from Austria
    • konfabulieren.com
Re: Database Activity
« Antwort #3 am: 30.09.04 - 13:58:16 »
guckst du http://eknori.dyndns.org/knowledge/devidea.nsf/Alpha/D65E491F10C037A2802568860028C383?OpenDocument

... geht grad nicht auf. aber deine db hab ich auch lokal, und da hab ich nixe gefunden; oder ist das neu?
Notes ist ein Bananenprodukt - es reift beim Kunden
--------------------------------------

Server: 6.5.5 EN auf Sun Solaris 8 & W2K / W2k3
Clients: 6.5.4 DE auf W2K und XP (ca. 3000)

Addon: Group 8.6

Offline koehlerbv

  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 20.460
  • Geschlecht: Männlich
Re: Database Activity
« Antwort #4 am: 30.09.04 - 14:02:33 »
Vorhin ging es noch, und da habe ich mir das in meine "Schatzkiste" geworfen:

Zitat
Represents a summary of user activity for a specified database.
Containment
Contains: NotesUserActivityEntry
Properties
UserActivityCount As Long
HasUserActivity As Integer
Parent As NotesDatabase

Methods
First as String
Last As String
Uses As Long
Reads As Long
Writes As Long
PrevDayUses As Long
PrevDayReads As Long
PrevDayWrites As Long
PrevWeekUses As Long
PrevWeekReads As Long
PrevWeekWrites As Long
PrevMonthUses As Long
PrevMonthReads As Long
PrevMonthWrites As Long
GetNthUserActivityEntry(EntryNumber As Long) As NotesUserActivityEntry

Access & New
The NotesUserActivity class represents a summary of user activity for a specified database as well as providing access to individual user activity entries. User activity for the specified database must be enabled for this function to work. After creating a new instance of the NotesUserActivity object for a database you should interegate the HasUserActivity property to ensure that activity is available.

Installation
Copy and paste the CLASSNotesUserActivity library from this database to your source database.

In the Options section of your code include the line:

Use "CLASSNotesUserActivity"

Syntax
Dim variableName As New NotesUserActivity( notesDatabase)
or
Set notesUserActivityEntry = New NotesUserActivity( notesDatabase)

NotesUserActivityEntry class

Represents an User Activity Entry for a specified database.
Containment
Contain by: NotesUserActivity
Properties
UserName As String
Reads As Long
Writes As Long
Time As String

Methods
None

Example

Dim db As New NotesDatabase("","")
Dim ua As NotesUserActivity
Dim uae As NotesUserActivityEntry
Dim iCounter As Long

Call db.OpenMail
If Not db Is Nothing Then
Set ua = New NotesUserActivity(db)
If ua.HasUserActivity Then
Print "First: " + ua.First
Print "Last: " + ua.Last
Print "Uses: " + Cstr(ua.Uses)
Print "Uses Day: " + Cstr(ua.PrevDayUses)
Print "Uses Week: " + Cstr(ua.PrevWeekUses)
Print "Uses Month: " + Cstr(ua.PrevMonthUses)

For iCounter = 1 To ua.UserActivityCount
Set uae = ua.GetNthUserActivityEntry(iCounter)
Print "(" + Cstr(iCounter) + ") " + uae.Time + " " + uae.UserName + " " + "Reads:" + Cstr(uae.Reads) + " Writes:" + Cstr(uae.Writes)
Next iCounter
End If
End If

Code: '
' NotesUserActivity class (R1.0)
' Written by: Daniel Alvers (daniel.alvers@au.pwcglobal.com)
' PricewaterhouseCoopers (Aust)
' February, 14 2000
'
' This code is provided as is and no warranty, express or implied, exists
' as to its fitness for use for any purpose.
' You are free to use and distributed the code as long as credit is retained
' and this header is not removed
'

'Paste as a function into your code
Function ConvertTIMEtoText(TIMESTRUCT As TIMEDATE) As String

Dim spTime As String * MAXALPHATIMEDATE
Dim retLength As Integer

spTime = Space(MAXALPHATIMEDATE)
Call ConvertTIMEDATEToText (&h0,&h0, TIMESTRUCT, spTime,MAXALPHATIMEDATE,retLength)
ConvertTIMEtoText = Left(spTime,retLength)
End Function

'Paste into the declarations section of your code

Const MAXALPHATIMEDATE = 80

Type TIMEDATE
Innard1 As Long
Innard2 As Long
End Type

Type DBACTIVITY
First As TIMEDATE
Last As TIMEDATE
Uses As Long
Reads As Long
Writes As Long
PrevDayUses As Long
PrevDayReads As Long
PrevDayWrites As Long
PrevWeekUses As Long
PrevWeekReads As Long
PrevWeekWrites As Long
PrevMonthUses As Long
PrevMonthReads As Long
PrevMonthWrites As Long
End Type

Type DBACTIVITY_ENTRY
Time As TIMEDATE
Reads As Integer
Writes As Integer
UserNameOffset As Long
End Type

Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" ( Byval dbName As String, hDb As Long) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" ( Byval hDb As Long) As Integer
Declare Function W32_NSFDbGetUserActivity Lib "nnotes.dll" Alias "NSFDbGetUserActivity" ( Byval hDB As Long, Byval flags As Long, retDbActivity As DBActivity, rethUserInfo As Long, retUserCount As Long) As Integer
Declare Function W32_OSLockObject Lib "nnotes.dll" Alias "OSLockObject" ( Byval handle) As Long
Declare Sub OSUnlockObject Lib "NNOTES.DLL" Alias "OSUnlockObject" (Byval handle)
Declare Sub W32_OSMemFree Lib "NNOTES.DLL" Alias "OSMemFree" (Byval handle)
Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" ( hpvDest As Any, Byval hpvSource As Long, Byval cbCopy As Long)
Declare Sub CopyMemoryString Lib "KERNEL32" Alias "RtlMoveMemory" ( Byval hpvDest As String, Byval hpvSource As Long, Byval cbCopy As Long)
Declare Sub ConvertTIMEDATEToText Lib "NNOTES.DLL" Alias "ConvertTIMEDATEToText" (Byval IntlFormat As Long,Byval TextFormat As Long, actTIMEDATE As TIMEDATE, Byval retTextBuffer As String,Byval TextBufferLength As Integer,retTextLength As Integer)

Class NotesUserActivityEntry
Public UserName As String
Public Reads As Long
Public Writes As Long
Public Time As String
End Class

Class NotesUserActivity

Private hDb As Long
Private pDbActivity As DBACTIVITY
Private rethUserInfo As Long
Private retUserCount As Long
Private prvdb As NotesDatabase
Private flgHasActivity As Integer

Sub Delete
If Me.flgHasActivity Then Call W32_OSMemFree(rethUserInfo)
If hDb <> 0 Then Call W32_NSFDbClose(hDb)
End Sub

Sub New (inpNotesDatabase As NotesDatabase)

Dim sDatabase As String
Dim rc As Integer

Me.flgHasActivity = False

'Get a valid NotesDatabase to the specified database
If inpNotesDatabase Is Nothing Then
Error 14101, "NotesUserActivity: Database Object is invalid"
Exit Sub
End If

Set prvdb = New NotesDatabase(inpNotesDatabase.Server, inpNotesDatabase.FilePath)

If prvdb.Server = "" Then
sdatabase = prvdb.filepath
Else
sdatabase = prvdb.server + "!!" + prvdb.filepath
End If

'Open the target database
rc = W32_NSFDbOpen(sDatabase,Me.hDb)
If rc <> 0 Then
Me.flgHasActivity = False
End If

'Get the Summary User information
rc = W32_NSFDbGetUserActivity(Me.hDb, &h0, Me.pDbActivity, Me.rethUserInfo, Me.retUserCount)
If rc <> 0 Then
Me.flgHasActivity = False
End If
Me.flgHasActivity = True
End Sub

'Global Times
Public Function First As String
First = ConvertTIMEtoText(pDbActivity.First)
End Function
Public Function Last As String
Last = ConvertTIMEtoText(pDbActivity.Last)
End Function

'Total summary
Public Function Uses As Long
Uses = pDbActivity.Uses
End Function
Public Function Reads As Long
Reads = pDbActivity.Reads
End Function
Public Function Writes As Long
Writes = pDbActivity.Writes
End Function

'Day summary
Public Function PrevDayUses As Long
PrevDayUses = pDbActivity.PrevDayUses
End Function
Public Function PrevDayReads As Long
PrevDayReads = pDbActivity.PrevDayReads
End Function
Public Function PrevDayWrites As Long
PrevDayWrites = pDbActivity.PrevDayReads
End Function

'Week summary
Public Function PrevWeekUses As Long
PrevWeekUses = pDbActivity.PrevWeekUses
End Function
Public Function PrevWeekReads As Long
PrevWeekReads = pDbActivity.PrevWeekReads
End Function
Public Function PrevWeekWrites As Long
PrevWeekWrites= pDbActivity.PrevWeekWrites
End Function

'Month summary
Public Function PrevMonthUses As Long
PrevMonthUses = pDbActivity.PrevMonthUses
End Function
Public Function PrevMonthReads As Long
PrevMonthReads = pDbActivity.PrevMonthReads
End Function
Public Function PrevMonthWrites As Long
PrevMonthWrites = pDbActivity.PrevMonthWrites
End Function

Public Function UserActivityCount As Long
UserActivityCount = retUserCount
End Function

Public Function HasUserActivity As Integer
HasUserActivity = Me.flgHasActivity
End Function

Public Function Parent As NotesDatabase
Set Parent = prvdb
End Function

Public Function GetNthUserActivityEntry(inpEntry As Long) As NotesUserActivityEntry
Dim puActivity As Long
Dim lEntry As Long
Dim puActivityEntry As DBACTIVITY_ENTRY
Dim StructureOffset As Long
Dim UsernameOffset As Long
Dim spUsername As String * 256
Dim sUsername As String
Dim nuae As New NotesUserActivityEntry

lEntry = inpEntry - 1

If Not Me.flgHasActivity Then Error 14104, "NotesUserActivity: No activity available"

If lEntry > Me.retUserCount Or lEntry < 0 Then
Error 14103, "NotesUserActivity: Subscript out of range."
End If

'Lock the structure get the required entry
puActivity = W32_OSLockObject(Me.rethUserInfo)
StructureOffset = puActivity + (Lenb(puActivityEntry) * lEntry)
Call CopyMemory (puActivityEntry, StructureOffset, Len(puActivityEntry))

'Load the User name for the Activity Structure
UsernameOffset = puActivity + puActivityEntry.UserNameOffset
spUsername = Space(256)
Call CopyMemoryString(spUsername, UsernameOffset,Lenb(spUsername))
sUserName = Left(spUsername, Instr(spUsername, Chr(0)) - 1)

With nuae
.UserName = sUserName
.Reads = puActivityEntry.Reads
.Writes = puActivityEntry.Writes
.Time = ConvertTIMEtoText(puActivityEntry.Time)
End With

Call OSUnlockObject(rethUserInfo)

Set GetNthUserActivityEntry = nuae

End Function
End Class

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.718
  • Geschlecht: Männlich
Re: Database Activity
« Antwort #5 am: 30.09.04 - 14:06:47 »
Zitat
geht grad nicht auf.
Habe eben eine VPN verbindung zwischen meinem 2003 Server und unserer Checkpoint FW-1 aufbauen wollen. dabei habe ich mir die Netzwerksettings auf dem heimischen Server verbogen  :'( Jetzt komme ich aus der ferne nicht mehr dran  ;D

in der lokalen Schatzkiste findest du den Code unter "Clsnotesuseractivity"
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

Offline HipSlu

  • Senior Mitglied
  • ****
  • Beiträge: 339
  • Geschlecht: Männlich
  • I am from Austria
    • konfabulieren.com
Re: Database Activity
« Antwort #6 am: 30.09.04 - 14:09:19 »
Habe eben eine VPN verbindung zwischen meinem 2003 Server und unserer Checkpoint FW-1 aufbauen wollen. dabei habe ich mir die Netzwerksettings auf dem heimischen Server verbogen  :'( Jetzt komme ich aus der ferne nicht mehr dran  ;D

 ;D

danke!!
Notes ist ein Bananenprodukt - es reift beim Kunden
--------------------------------------

Server: 6.5.5 EN auf Sun Solaris 8 & W2K / W2k3
Clients: 6.5.4 DE auf W2K und XP (ca. 3000)

Addon: Group 8.6

Offline HipSlu

  • Senior Mitglied
  • ****
  • Beiträge: 339
  • Geschlecht: Männlich
  • I am from Austria
    • konfabulieren.com
Re: Database Activity
« Antwort #7 am: 01.10.04 - 09:43:58 »
@eknori: hattest du schon mal das problem mit diesem script, dass es bei manchen datenbanken eine nette rote box bringt?
ich kann bei solchen datenbanken allerdings keine besonderheit feststellen können, aber es passiert jedes mal
Notes ist ein Bananenprodukt - es reift beim Kunden
--------------------------------------

Server: 6.5.5 EN auf Sun Solaris 8 & W2K / W2k3
Clients: 6.5.4 DE auf W2K und XP (ca. 3000)

Addon: Group 8.6

Offline eknori

  • @Notes Preisträger
  • Moderator
  • Gold Platin u.s.w. member:)
  • *****
  • Beiträge: 11.718
  • Geschlecht: Männlich
Re: Database Activity
« Antwort #8 am: 01.10.04 - 09:52:18 »
ehrlich gesagt, ich habe das Script nie unter r6 getestet; R4 +5 funktionierten aber soweit immer ( also ohne rbod )
Egal wie tief man die Messlatte für den menschlichen Verstand auch ansetzt: jeden Tag kommt jemand und marschiert erhobenen Hauptes drunter her!

 

Impressum Atnotes.de  -  Powered by Syslords Solutions  -  Datenschutz