nbtstat
nbtstat
Hi,
I use static IP in my lan, when a new IP is used I can see it by an alert from HostMonitor; I want know also the name of machine (nbtstat -a %testName%) and send it in the mail alert.
I tried an "execute external command" nbtstat -a ipaddress > filename.txt but don't work.
Any idea?
Thanks
TM
I use static IP in my lan, when a new IP is used I can see it by an alert from HostMonitor; I want know also the name of machine (nbtstat -a %testName%) and send it in the mail alert.
I tried an "execute external command" nbtstat -a ipaddress > filename.txt but don't work.
Any idea?
Thanks
TM
What exactly means "don't work"? I assume you are receiving mail but it does not contain information about correct ip address. Am I right?
It happens because "Execute external command" action launch external application but it does not wait until application terminates. So, e-mail message could be send before external application creates file.
Solution: use HMScript action with ExecuteProgram command instead (http://www.ks-soft.net/hostmon.eng/mfra ... #actScript). Please note: you should add "HM Script" action 1st and THEN add "Send e-mail" action to the profile.
Regards
Alex
It happens because "Execute external command" action launch external application but it does not wait until application terminates. So, e-mail message could be send before external application creates file.
Solution: use HMScript action with ExecuteProgram command instead (http://www.ks-soft.net/hostmon.eng/mfra ... #actScript). Please note: you should add "HM Script" action 1st and THEN add "Send e-mail" action to the profile.
Regards
Alex
nbtstat ...long
Alex thanks for the answer,
"don't work" means that i'm not able to create the file independently to send mail; I tried (after reading other msgs in forum) using HMscript action but I'm only able to execute a bat (or cmd) file with inside the command. In other case the "filename.txt (output redirected) is not create.
Example HMscript:
ExecuteProgram 5000 nbtstat -a 192.168.10.103 > c:\filename.txt
do not create any file
ExecuteProgram 5000 c:\batfile.cmd
(where batfile.cmd contains nbtstat -a 192.168.10.103 > c:\filename.txt) works fine.
Note that I would want use %TestName% not the ip address... but how can i put in batfile.cmd ip variable?
The real problem is that i have many ip in 7 subnet; create bat-files and alerts for any ip to monitor require a lot of work...
. I hope that using %TestName% or something like it i can control entire network with only 3 or 4 different alerts or script.
May be I'm wrong in writing the HMscript... (?)
The initial idea is create a file containing the resolved name of "bad" ip and send it in a mail-alert (attached or in the body). May be that there is a better way for obtaining this...
I also hope my orrible english is
...readable.
regards and sorry for th log msg
TM
"don't work" means that i'm not able to create the file independently to send mail; I tried (after reading other msgs in forum) using HMscript action but I'm only able to execute a bat (or cmd) file with inside the command. In other case the "filename.txt (output redirected) is not create.
Example HMscript:
ExecuteProgram 5000 nbtstat -a 192.168.10.103 > c:\filename.txt
do not create any file
ExecuteProgram 5000 c:\batfile.cmd
(where batfile.cmd contains nbtstat -a 192.168.10.103 > c:\filename.txt) works fine.
Note that I would want use %TestName% not the ip address... but how can i put in batfile.cmd ip variable?
The real problem is that i have many ip in 7 subnet; create bat-files and alerts for any ip to monitor require a lot of work...

May be I'm wrong in writing the HMscript... (?)
The initial idea is create a file containing the resolved name of "bad" ip and send it in a mail-alert (attached or in the body). May be that there is a better way for obtaining this...
I also hope my orrible english is

regards and sorry for th log msg
TM
One solution - BAT file.Example HMscript:
ExecuteProgram 5000 nbtstat -a 192.168.10.103 > c:\filename.txt
do not create any file
ExecuteProgram 5000 c:\batfile.cmd
(where batfile.cmd contains nbtstat -a 192.168.10.103 > c:\filename.txt) works fine.
Another solution - simply modify command: ExecuteProgram 5000 cmd /c nbtstat -a 192.168.10.103 >c:\filename.txt
Its easy.Note that I would want use %TestName% not the ip address... but how can i put in batfile.cmd ip variable?
Script command: ExecuteProgram 5000 c:\batfile.cmd "%TestName%"
BAT file: nbtstat -a %1 > c:\filename.txt
Regards
Alex
test runs only one time...
...now I'm a registred user
, but my script do not run regulary, it runs only sometimes...
Example: if you copy (duplicate) the test it runs, if you re-assign the filename of .hms file and then try the test it runs.
...if the test is activated because there is an event, it do not runs...
My test is in two parts:
one --> create a txt file with inside the result of nbtstat,
two --> send a mail with in attachment the file.
Part two works fine every time, but part one ...never.
Better, not never, but sometimes ...yes, sometimes ...not
May be that execute program 1000 is too short?
may be the pc is too slow (Celeron 633+326MB ram+W2k)?
i don't understand where the process is defective


Example: if you copy (duplicate) the test it runs, if you re-assign the filename of .hms file and then try the test it runs.
...if the test is activated because there is an event, it do not runs...
My test is in two parts:
one --> create a txt file with inside the result of nbtstat,
two --> send a mail with in attachment the file.
Part two works fine every time, but part one ...never.
Better, not never, but sometimes ...yes, sometimes ...not
May be that execute program 1000 is too short?
may be the pc is too slow (Celeron 633+326MB ram+W2k)?
i don't understand where the process is defective
What test method do you use? NT Event Log?Example: if you copy (duplicate) the test it runs, if you re-assign the filename of .hms file and then try the test it runs.
...if the test is activated because there is an event, it do not runs...
What parameters of the action you have set? "Start when ?? consecutive Bad results occur", "Repeat ?? times"?
Regards
Alex
Oooppss....
ok, test is "ping test" reverse alert (starts when ip good)
the alert is
1- "execute hml script" starts when 2 consecutive bad... repeat 1
2- send email with attachment "C:\Programmi\HostMonitor4\Examples\%HostAddr%.txt"
hml script is "C:\Programmi\HostMonitor4\Examples\nb.hms"
nb.hms contains:
ExecuteProgram 10000 batfile.cmd "%HostAddr%"
batfile.cmd contains:
nbtstat -a %1 > %1.txt
there is no way to run the first part of alert... but it worked some time ago
so the alert is sent without attachment.
Test always works... excuse for the question made badly, problem is first part of alert, "nbtstat execution is not executed"...
Best regards
the alert is
1- "execute hml script" starts when 2 consecutive bad... repeat 1
2- send email with attachment "C:\Programmi\HostMonitor4\Examples\%HostAddr%.txt"
hml script is "C:\Programmi\HostMonitor4\Examples\nb.hms"
nb.hms contains:
ExecuteProgram 10000 batfile.cmd "%HostAddr%"
batfile.cmd contains:
nbtstat -a %1 > %1.txt
there is no way to run the first part of alert... but it worked some time ago
so the alert is sent without attachment.
Test always works... excuse for the question made badly, problem is first part of alert, "nbtstat execution is not executed"...
Best regards
So, 1st action should be executed when host joins network, after 2nd ping test. You are using the same parameters for "send e-mail" action?the alert is
1- "execute hml script" starts when 2 consecutive bad... repeat 1
2- send email with attachment "C:\Programmi\HostMonitor4\Examples\%HostAddr%.txt"
What action was created 1st? If you are using the same start parameters, "send e-mail" action should be created after "HM Script" action. If you are not sure, remove "send e-mail" action and create it again.
If HostMonitor really does not execute external program, please check system log (log that is specified on Advanced Logs page in the Options dialog). There should be a message that explains why HostMonitor cannot start external program
Regards
Alex
syslog.htm says cannot execute command "batfile.cmd"
...done:
1 send mail was executed before external prg
2 problem in path, %HostAddr%.txt was created in winnnt\system32...
3 problem executing cmd without path.
solved:
1 deleted "send e-mail" action and created again
2 now hms has complete path c:\programmi\hostmonitor4\examples\batfile.cmd "%hostaddr%" ...not only batfile.cmd ....
3 now batfile.cmd declare the complete destination path where create file used in mail-attach
I only cannot understand why it worked some time ago with all these problems (?)
In any case now it works fine and seems ok
Many thanks for your great help.
Best regards
...done:
1 send mail was executed before external prg
2 problem in path, %HostAddr%.txt was created in winnnt\system32...
3 problem executing cmd without path.
solved:
1 deleted "send e-mail" action and created again
2 now hms has complete path c:\programmi\hostmonitor4\examples\batfile.cmd "%hostaddr%" ...not only batfile.cmd ....
3 now batfile.cmd declare the complete destination path where create file used in mail-attach
I only cannot understand why it worked some time ago with all these problems (?)
In any case now it works fine and seems ok
Many thanks for your great help.
Best regards
Probably because you started HostMonitor as application before?I only cannot understand why it worked some time ago with all these problems (?)
When you start application, HostMonitor uses work directory as default path. When its started as service, Windows says that %system% directory is current path
Regards
Alex