Hello,
i setup a Test to query the MX Record. However I fail to present valuable infos upon failure.
Default Result is "xxx ms". Die Docs say that the variable %object2% delivers infos but on my system it shows the String %Object2%.
What I need / wish:
A Variable which contains the result to test and a variable with the current record.
Example:
Request: domain.tld
Test result for: mailserver.domain.tld
On Error Reply value: "ERROR: Tested for %Test% but got %Answer% instead !!!"
Is this already possible?
HM Version 11.54 on a german Server 2016
Question regarding DNS MX Test
What exactly means "present valuable infos upon failure"?
Are you using some actions assigned to the test, like Send e-mail action?
Then you can use variables designed for the actions
E.g. %DnsResult% or %DnsResults%
https://www.ks-soft.net/hostmon.eng/mfr ... .htm#macro
%Object2% is variable that can be used in test name or test comment so you can setup patterns and HostMonitor will set test name automatically.
Regards
Alex
Are you using some actions assigned to the test, like Send e-mail action?
Then you can use variables designed for the actions
E.g. %DnsResult% or %DnsResults%
https://www.ks-soft.net/hostmon.eng/mfr ... .htm#macro
%Object2% is variable that can be used in test name or test comment so you can setup patterns and HostMonitor will set test name automatically.
Regards
Alex
You can use External Shell script (VBscript) like this:
It takes the domain name as parameter.
It will use Windows 'nslookup' and query a DNS server (8.8.8.8 in this case) to return MX records.
Tweak to your own needs.
Code: Select all
strDomain = WScript.Arguments(0)
Set oShell = CreateObject("WScript.Shell")
Set oExec = oShell.Exec("nslookup -q=mx " & strDomain & " 8.8.8.8")
Do Until oExec.StdOut.AtEndOfStream
strLine = oExec.StdOut.ReadLine()
If InStr(strLine, "MX preference") > 0 then
strResult = strResult & strLine & " | "
End If
Loop
If trim(strResult) <> "" then
WScript.StdOut.Write "ScriptRes:Ok:" & strResult
Else
WScript.StdOut.Write "ScriptRes:Unknown: No MX records found for domain '" & strDomain & "'"
End If
It will use Windows 'nslookup' and query a DNS server (8.8.8.8 in this case) to return MX records.
Tweak to your own needs.
Hello,
thanks for the hint. The Variable %DNSResult% was exactly what I needed. Sometimes its not so easy to find the corresponing infos in the docs.
Also thanks for the script. Ich use a couple of scripts to overcome hostmon's limit but I prefer a buildin command as I guess that calling an external programm like cscript.exe or powershell.exe is more expensive in terms of I/O, RAM and CPU use than the hostmon calls.
thanks for the hint. The Variable %DNSResult% was exactly what I needed. Sometimes its not so easy to find the corresponing infos in the docs.
Also thanks for the script. Ich use a couple of scripts to overcome hostmon's limit but I prefer a buildin command as I guess that calling an external programm like cscript.exe or powershell.exe is more expensive in terms of I/O, RAM and CPU use than the hostmon calls.
That's true.but I prefer a buildin command as I guess that calling an external programm like cscript.exe or powershell.exe is more expensive in terms of I/O, RAM and CPU use than the hostmon calls.
External tests can be used if you don't need to start them often, but 50 powershell.exe processes started every sec is pretty heavy for the system
Regards
Alex