|
i am using a perl script as a target in the mrtg.cfg
Target[spamfilter.yourserver.local]: `c:\perl\bin\perl.exe d:\mrtg\logsat.pl`
is processes the spamfilter ini the same way to return values as the
stats asp file from dan.
i am stealing dan`s code, because the values mrtg uses are the same,
rx bytes -> value can be messages forwarded
tx bytes -> value can be messages blocked
that makes it possible...
the vb code so far : (must follow the perl script mrtg target)
<% '============================================================ 'Functions to parse out a section of the spamfilter.ini file '============================================================
Function ReadFromIniFile(strFileName,strSection, strKey)
Dim blnSectionFound: blnSectionFound = False
Dim blnKeyFound: blnKeyFound = False
Dim objFSO: Set objFSO = Server.CreateObject ("Scripting.FileSystemObject")
Dim objTextStream: Set objTextStream = objFSO.OpenTextFile(strFileName)
Dim strLine Dim astrTemp
Do While Not objTextStream.AtEndOfStream And Not blnSectionFound strLine = objTextStream.ReadLine If InStr (strLine,"[" & strSection & "]") > 0 Then blnSectionFound = True End If Loop
Do While Not objTextStream.AtEndOfStream And Not blnKeyFound And blnSectionFound strLine = objTextStream.ReadLine If Not strLine = vbNullString Then If Not InStr (strLine,"[") > 0 And Not InStrRev (strLine,"]") > 0 Then astrTemp = Split(strLine,"=") If IsArray(astrTemp) Then If trim(astrTemp(LBound(astrTemp))) = strKey Then blnKeyFound = True End If End If Else blnSectionFound = True End If End If Loop
If blnKeyFound Then strValue = astrTemp(UBound(astrTemp)) End If
ReadFromIniFile = strValue End Function
'============================================================
%>
<%Response.Write ReadFromIniFile("SpamFilter.ini","stats","EMailsForwarded:")
<%Response.Write ReadFromIniFile("SpamFilter.ini","stats","EMailsBlocked")
i am currently using the net::telnet module but was not yet succesfull with it,
(telnetting to my windows server into the path where spamfilter resides.)
maybe it`s better to pipe the vbscript as a target, in mrtg...on the local server..
thats the current status.
-eric-
[ sysadmin / not a programmer :-) ]
|