General discussion

Locked

Perfmon Command Line Variables

By sfix ·
I've set up some Perfmon alerts and I'm using a freeware command line Email program to send an Email alert. I've put a .bat file in the "program to run" section of the alert tab which sends an existing text file.

Does anyone know how to add variables to the email alert so I'll know which server is affected and which resource is triggering the alert?

This conversation is currently closed to new comments.

6 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Perfmon Command Line Variables

by Joseph Moore In reply to Perfmon Command Line Vari ...

It really depends on from where you are running this BAT file. If the BAT file is running locally on the server you are monitoring, then you can just add the %COMPUTERNAME% variable to get the system's machine name.
For example, in your BAT file after you generate the text file from Perfmon, you can do something like:

ECHO %COMPUTERNAME% Performance Monitor Alert >machine.txt

That would create a TXT file with the machine name, and the words "Performance Monitor Alert" right after the machine name. This would be saved in the file "machine.txt"
At this point, use your e-mail program to send both the Perfmon alert file AND this machine.txt file.

Then, you will have the alert info and the machine name.

There are other ways of doing this also, but this is a fast way!

hope this helps

Collapse -

Perfmon Command Line Variables

by sfix In reply to Perfmon Command Line Vari ...

I should have been more specific. I'm running perfmon on a utility server that is monitoring 15 other servers.

Collapse -

Perfmon Command Line Variables

by Joseph Moore In reply to Perfmon Command Line Vari ...

Well, since Perfmon is running remotely, then there are several ways to get the remote machine name.
Do you have a separate alert per machine you are monitoring, or are you doing a mass broadcast monitoring? Do you connect to each machine with Perfmon using the IP address of the remote machine, or the machine name?
This is why I ask. If you have a separate alert based off IP address, then you can put in your alert BAT file a PING -A ipaddress
The -A switch of PING tries to resolve the machine name with the IP address given. You could then redirect all of the PING output to a file (PING -A ipaddress > machine.txt) and e-mail that TXT file along with your Perfmon alert file.

There are also other tools you can use. www.sysinternals.com makes some free tools that work against remote systems to determine information. One tool ls PSINFO. It's output can be directed to a text file using the same "> filename.txt" syntax. YOu would get machine name, system up time, and some other info.
So, how do you have your alerts set up?

Collapse -

Perfmon Command Line Variables

by sfix In reply to Perfmon Command Line Vari ...

Poster rated this answer

Collapse -

Perfmon Command Line Variables

by sfix In reply to Perfmon Command Line Vari ...

Separate alerts for each by remote machine name. How would perfmon indicate which machine to ping? Would I need 15 different .bat files?

Collapse -

Perfmon Command Line Variables

by sfix In reply to Perfmon Command Line Vari ...

This question was closed by the author

Back to Windows Forum
6 total posts (Page 1 of 1)  

Related Discussions

Related Forums