[hobbit] Windows Print Server Monitoring
Malcolm Hunter
malcolm.hunter at gmx.co.uk
Thu Apr 9 19:12:17 CEST 2009
> I just posted the Windows Printer Monitoring Script on XYMONTON
>
> Feel free to give suggestions.
Thanks for posting. I've been working on something similar trying to use the fsmon code model (no small task). I can see why you used tables to make the layout of the web page neater. Unfortunately this means the email alerts are full of HTML and almost illegible. The log is displayed using <pre></pre> tags on the Xymon web pages, so you _can_ use normal text separated by tabs. To facilitate this I wrote a Pad() function to make all of the fields the same width in each column. You need to find out the maximum length of each field to make use of this:
' Get max lengths
For Each objPrinter in colInstalledPrinters
If Len(objPrinter.Name) > iMaxNameLen Then iMaxNameLen = Len(objPrinter.Name)
If Len(objPrinter.PortName) > iMaxPortLen Then iMaxPortLen = Len(objPrinter.PortName)
If Len(objPrinter.Location) > iMaxLocnLen Then iMaxLocnLen = Len(objPrinter.Location)
Next
' Use tabs and padding to format each line
strDetailAll = "&red " & Pad(objPrinter.Name, iMaxNameLen) & vbTab & Pad(objPrinter.PortName, iMaxPortLen) & vbTab & Pad(objPrinter.Location, iMaxLocnLen)
' Returns text padded to iLength
Function Pad(sText, iLength)
Dim iPadBy, sTemp
sTemp = sText
iPadding = iLength - Len(sText)
If iPadding > 0 Then sTemp = sTemp & Space(iPadding)
Pad = sTemp
End Function
--
Technical copy-editor & proofreader
KDE Proofreading Team
KDE British English Translation Team
http://l10n.kde.org/team-infos.php?teamcode=en_GB
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01
More information about the Xymon
mailing list