Link to home
Start Free TrialLog in
Avatar of trcadmin
trcadmin

asked on

GFI Faxmaker Queue monitor

We need to monitor the Fax Queue for the GFI Faxmaker product.  The vendor does not provide a way to monitor the fax queue unless we use the MMC.  This will not work for us due to the multiple fax servers we have installed.  We would want to be able to monitor the Fax Queue and report any findings to our monitoring software "Big Brother".  We know from the vendor that when a fax is sent or received it saves a file with an extension .sfm to the in or the out directory under the faxmaker directory.  Is there a way to write a script to monitor both directories and if it finds a .sfm file report it? For example if no files are found report no error if 1 or more files are found report an error.
Avatar of DSchel01
DSchel01

The SFM files are a legacy proprietary format from the earlier versions of FAXmaker from the 90s. Unfortunately these file formats have not yet been upgraded to modern formats such as XML and cannot be read by third party software to the best of my knowledge.

You could use the FAXmaker monitoring script (vbs) included in GFi Network Server Monitor to monitor the health of multiple FAXmaker servers. If there are more than x files in the FAXmaker\in or FAXmaker\out or FAXmaker\out\pending folders an alert can automatically be triggered. This script does not report  information about the fax (i.e. destination number etc) but rather that there were more than x faxes in the queue.
Avatar of trcadmin

ASKER

Thanks DSCHED01 for putting in the right path.  We are not using the GFi Network Server Monitor product.  I was able to install the evaluation copy and locate the FaxMaker.vbs file but i am not sure how to make run without using the GFi Network Server Monitor product.  The script is below i changed the strFAXmakerServer= to use our servername and uncommented the line.  When i tried to run it nothing happens.



' /////////////////////////////////////////////////////////////////////////////
' This file contains a set of VBScript functions, and can be used
' inside Monitor Rules.
' You can write your own functions and them to this file.
' Use the following guidelines when writing a new function:
'   - The routine must be a Function, not a Sub;
'   - The Function must return True (-1), False (0) or Unknown (1);
'   - Optionally, use the EXPLANATION system variable to add your own
'     explanation to the result of the function;
'   - All variables must be 'dimmed', except EXPLANATION. EXPLANATION is an
'     GFI Network Server Monitor system variable and is already dimmed
'     by the GFI Network Server Monitor service.
'
' Prototype:
'   Function MyFunc( var1, var2, ..., varn )
'       ' Own stuff
'       MyFunc = True  ' or False (0) or Unknown (1)
'       EXPLANATION = "MyFunc returns True"
'   End Function
'
' /////////////////////////////////////////////////////////////////////////////
 
Const retvalUnknown = 1
 
Function GetFAXmaker(strFAXmakerServer, strUsername, strPassword)
On Error Resume Next
 'strFAXmakerServer="FAX1"
strFAXmakerFolder = "\\" & strFAXmakerServer & "\fmserver$" 'FAXmaker path
 
intSinkDropThreshold = 5 'alert when more than x emails in sinkdrop dir.
intInDirThreshold = 4 'alert when more than 4 faxes in FAXmaker\In
intOutDirThreshold = 4 'alert when more than 4 faxes in the FAXmaker\out.
intUndeliverableThreshold = 0 'alert when more than 0 files in the FAXmaker\in\undelverable directory.
 
'no changes to variables need to be made beyond this point.
 
'check services
if (strUsername = "") then	
		'Connect to remote host on same domain using same security context
		Set objWMIService = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & strFAXmakerServer &"\root\cimv2")
else	
		'Connect to remote host using different security context and/or different domain 
		Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
		Set objWMIService = objSWbemLocator.ConnectServer(strFAXmakerServer, "root\cimv2", strUsername, strPassword)
		if (Err.Number <> 0) Then
			GetServicesList = retvalUnknown			
			EXPLANATION = "Unable to access '" & strFAXmakerServer & "'. Possible reasons: no WMI installed on the remote server, no rights to access remote WMI service, or remote server down"
			Exit Function
		End if
		objWMIService.Security_.ImpersonationLevel = 3
end if
 
If (Err.Number <> 0) Then
	GetFAXmaker = retvalUnknown
	EXPLANATION = "Unable to access '" & strFAXmakerServer & "'. Possible reasons: no WMI installed on the remote server, no rights to access remote WMI service, or remote server down" 	
	Exit Function
End If
 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where name = 'smtpsvc'",,48)
bRunning = false
For Each objItem in colItems
  if objItem.State = "Running" Then
    bRunning = true
  end If
Next
if not bRunning then 
		GetFAXmaker=False
		EXPLANATION = "Simple Mail Transport Protocol (SMTP) Service is not running."
		Exit Function
end if
 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where name = 'FAXmaker Fax Server'",,48)
bRunning = false
For Each objItem in colItems
  if objItem.State = "Running" Then
    bRunning = true
  end If
Next
If not bRunning Then
		GetFAXmaker=False
		EXPLANATION = "GFI FAXmaker Fax Server Service is not running."
		Exit Function
end If 
 
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service where name = 'FAXmaker MTA Service'",,48)
bRunning = false
For Each objItem in colItems
  if objItem.State = "Running" then
    bRunning = true
  end if
Next
If not bRunning Then
		GetFAXmaker=False
		EXPLANATION = "GFI FAXmaker Message Transfer Agent Service is not running."
		Exit Function
end If 
 
'check directory counts
strFAXmakerSinkDrop = strFAXmakerFolder & "\sinkdrop"
strFAXmakerIn = strFAXmakerFolder & "\In"
strFAXmakerOut = strFAXmakerFolder & "\out"
strFAXmakerUndeliverable = strFAXmakerIn & "\undeliverable"
 
funcEcho("Servername=" & strFAXmakerServer)
funcEcho("strFAXmakerIn=" & strFAXmakerIn)
funcEcho("strFAXmakerOut=" & strFAXmakerOut)
funcEcho("strFAXmakerUndeliverable=" & strFAXmakerUndeliverable)
funcEcho("strFAXmakerSinkDrop=" & strFAXmakerSinkDrop)
 
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strFAXmakerSinkDrop)
Set colFiles = objFolder.Files
 
GetFAXmaker=False
 
If colFiles.count > intSinkDropThreshold Then
	GetFAXmaker=False
	EXPLANATION = colFiles.count & " (>" & intSinkDropThreshold & ") Files found in SinkDrop directory. Check GFI FAXmaker Message Transfer Agent status."
	Exit Function
End If
 
Set objFolder = objFSO.GetFolder(strFAXmakerIn)
Set colFiles = objFolder.Files
 
filesCount = CountSfmFiles(objFSO, colFiles)
If filesCount > intInDirThreshold Then
	GetFAXmaker = False
	EXPLANATION = filesCount & " (>" & intInDirThreshold & ") Files found in FAXmaker\In directory. Check GFI FAXmaker Message Transfer Agent status."
	Exit Function
End If
 
Set objFolder = objFSO.GetFolder(strFAXmakerOut)
Set colFiles = objFolder.Files
 
filesCount = CountSfmFiles(objFSO, colFiles)
If filesCount > intOutDirThreshold Then
	GetFAXmaker=False
	EXPLANATION = filesCount & " (>" & intOutDirThreshold & ") Files found in FAXmaker\out directory. Check GFI FAXmaker Fax Server status."
	Exit Function
End If
 
Set objFolder = objFSO.GetFolder(strFAXmakerUndeliverable)
Set colFiles = objFolder.Files
 
If colFiles.count > intUndeliverableThreshold Then
	GetFAXmaker=False
	EXPLANATION = colFiles.count & " (>" & intUndeliverableThreshold & ") Files found in FAXmaker\in\undeliverable directory. Check GFI FAXmaker Message Transfer Agent status and SMTP connectivity."
	Exit Function
End If
 
GetFAXmaker=True
EXPLANATION = "FAXmaker status is healthy."
 
End Function
 
Function funcEcho(strLog)
	blnDebug = 0 
	If blnDebug=1 Then
		EXPLANATION =  strLog
	End If
End Function
 
function CountSfmFiles(objFSO, colFiles)
	Dim file, count
	count = 0
	for each file in colFiles	  
		if lCase(objFSO.GetExtensionName(file)) = "sfm" then  
			count = count + 1
		end if
	next
	CountSfmFiles = count
end function

Open in new window

I actually wrote the original version of the FAXmaker VBS script used by Network Server Monitor. The script returns true or false which then triggers the appropriate action in the NSM configuration.

What do you actually want to happen when a check fails?

Daniel
Since we are not using the NSM we need this script to work without it.  I believe that the variables are passed to the script via the NSM configuration and the results are passed back from the script to the NSM.  What we need is the full script to run without the need of the NSM.  This script looks like it does what we are looking for but we only need to monitor FAX queues since our monitoing software already monitors the services.
I understand that you are not planning to use Network Server Monitor. I was asking about the action you were after. When the check fails do you want the script to email you, write to a text file? etc.

If you let me know I should be able to customise it quickly for you.

Daniel
Sorry i did not understand your question.  We would want to write to a text file to a specified location and specific file name .  Our Big Brother monitoring software would capture this file and post it to our monitoring console.
Attached is an updated version of the script which will write a timestamp  and "Check passed." or "Check failed" to a text file dependant on the result.

I don't have the time at the moment to make the script run for multiple installations, or return a more detailed response, at the moment so you would need to perform further customisation of the script, or run a copy of the script for each FAXmaker server.
FAXmaker-status.txt
Thanks, DShel01.

The only attechment included on your response is a txt file with the following text:

10/10/2008 Check passed.
10/10/2008 1:53:10 PM Check passed.
10/10/2008 1:53:25 PM Check passed.
10/10/2008 1:54:30 PM Check passed.
10/10/2008 1:54:38 PM Check passed.
ASKER CERTIFIED SOLUTION
Avatar of DSchel01
DSchel01

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much for your help.  This was exactly what we were looking for.
How can we modify the code so that the log file displays the test failed.  If a test failed display the description line on the log.
Sorry display the EXPLANATION line on the log this way we know what failed.