Add result of an app to Mail Action

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Add result of an app to Mail Action

Post by MirkoW »

Hi,

i have a test element who check the cpu usage and it want to run an action if the usage are upper then 95 % but how i can recieve the running processes with a high cpu usage in mail ?

i have created a script who get all running processes with cpu usage. how i can run this and add this to the mail action alert ?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

You may execute specially prepared scripts using Active Script or Shell Script test methods
http://www.ks-soft.net/hostmon.eng/mfra ... htm#script
http://www.ks-soft.net/hostmon.eng/mfra ... m#chkShell

Your script should return "Bad" status and information about process (Reply field) when CPU Usage is over 95%

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

Hi,

the Test Event should only return the percent value but the alert action mail should contain the percent value AND a process list with cpu usage.

so i have wrote a script who display all infos. but how i can run the script and add the results into the mail.

i cant using the "attach file" function because this test event and alert actions running on diverence servers on the same time.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

the Test Event should only return the percent value but the alert action mail should contain the percent value AND a process list with cpu usage.
If script returns just CPU Usage value, how HostMonitor can get information about process? Script may return to HostMonitor only 2 variables: Status and Reply. That's it.
i cant using the "attach file" function because this test event and alert actions running on diverence servers on the same time
Attached file? Yes, this can be solution if your script can create such file. If you setup several test items to run this script, its not a big problem. You may setup Shell Script test items to start your script, using different parameters so each test item will create unique result files. You may create designated alert profile for each of such tests...

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

hm okay here my idea:

at first an action event run a vb script that create a textfile with all process infos and cpu usage.

after them hm should run the next action event that send a mail to admin and contain the textfile from the first step.

But how i can select or enter the order of this actions and how i can use a variable in this two actions for the filename ? and how i can create a third and last step, that delete the textfile ?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

at first an action event run a vb script that create a textfile with all process infos and cpu usage.
I thought your script acts like test (not action), it checks CPU and records information about process into file...
So you want setup HostMonitor to checks CPU Usage and then start your script when CPU Usage is over 95%?
May be you can simply use Dominant Process test method instead?
http://www.ks-soft.net/hostmon.eng/mfra ... topprocess
But how i can select or enter the order of this actions
If you are using the same conditions to start both actions, HostMonitor will start actions in creation order. So, create HM Script action 1st, and add "Send e-mail" action after that. Use ExecuteProgram HMScript command to start your script and wait for results.
http://www.ks-soft.net/hostmon.eng/mfra ... #actScript
and how i can use a variable in this two actions for the filename
If you create separate alert profile for each of such CPU-Process tests, you don't need to use any variables.
However its more convenient to use just one profile. You may use Comment field of the test item to store file name, than you may use %FCommentLine1% (%FCommentLine2% or %FCommentLine3%, etc) variable as parameter of the action.
http://www.ks-soft.net/hostmon.eng/mfra ... .htm#macro
and how i can create a third and last step, that delete the textfile
Is this really necessary?

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

Hi,

no i'm using the Performance Test to get the cpu usage.

And when the cpu usage higher then 95% the alert event should run a vb-script that get all processes with cpu usage so i cant use the Dominant Process method because i need all processes.

so i want to use one test with 2 alert events.

the first should create the file and the 2. test should send an email with the textfile
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

no i'm using the Performance Test to get the cpu usage
Why? You don't like CPU Usage test method? CPU Usage test method does not use buggy PDH.DLL and works more reliable.

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

ya. but the cpu usage test need the a agent ??
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Agent? Agent is necessary when you need to check remote system located in different network protected by firewall. In such case you will need agent for Performance Counter test as well.
Actually both test methods have exactly the same requirements: admin rights, RPC and Remote Registry service, no firewall should block ports above 1023, etc

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

okay thanks.

but this does not a solution for my problem with the needet process list.

it is not able to add a function that allow to run a command and add the results to the mail ? as addon for "attach file" ?
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I thought we already discussed this... If you have script that retrieves list of processes and records information into the file, you need to add 2 actions into profile.

Regards
Alex
MirkoW
Posts: 210
Joined: Tue Jul 01, 2008 6:51 am

Post by MirkoW »

ya but i dont know whats the 2. action. it is "run hms script" ??
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

So, create HM Script action 1st, and add "Send e-mail" action after that. Use ExecuteProgram HMScript command to start your script and wait for results.
http://www.ks-soft.net/hostmon.eng/mfra ... #actScript
In other words
- 1st action: Run HMScript
- 2nd action: "Send e-mail"

Regards
Alex
Post Reply