Solved

How to restart application on server via batch/script when CPU usage high

Posted on 2013-01-15
2
940 Views
Last Modified: 2013-01-23
We have a server with a program called autoview on it.  This is older and unsupported by the manufacturer as we've not upgraded to the latest version.  It tends to max out the CPU about 1-3 times per day and we have to go in and manually restart the application.

This guest OS is on a VMWare ESX system. (not sure if I can have that trigger a script)

I would like to somehow have either ESX trigger a script to run or a script to determine if the CPU is at 90% or higher for more than 5 minutes that it would then remotely run the script that kills that application and restarts it.

If ESX cannot do this then any script that runs local on the box would work as well.

This is not a service, but an application.

We start it with this script on the local machine:

@start e:\jVue\bin\jVueServerX.exe -standalone %*
0
Comment
Question by:norcalty
  • 2
2 Comments
 
LVL 28

Assisted Solution

by:becraig
becraig earned 500 total points
ID: 38780769
In Performance Logs and Alerts in Computer manager create an alert for cpu exceeding a certain threshold - have it call a simple script to find the pid for that exe and kill it then restart it.  You could probably add messages as well to let users know it will be restarting in x seconds and save work etc.
0
 
LVL 28

Accepted Solution

by:
becraig earned 500 total points
ID: 38780809
Here is a how to on how to create alerts in 2k3

http://support.microsoft.com/kb/324752

How to Create an Alert
To create or modify a log configuration, you must have Full Control permission for the following registry key, which controls the Performance Logs and Alerts service:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\SysmonLog\Log Queries
To create an alert:

    Click Start, point to Administrative Tools, and then click Performance.
    Double-click Performance Logs and Alerts, and then click Alerts.

    NOTE: Any existing alerts are listed in the Details pane. A green icon indicates that the logs are running, and a red icon indicates alerts that have stopped.
    Right-click a blank area in the Details pane, and then click New Alert Settings.
    In the Name box, type the name of the alert, and then click OK.

    The AlertName dialog box is displayed. In this dialog box, you configure settings for the alert that you created.

    To define a comment, add counters, alert thresholds, and the sample interval, use the General tab. To specify the actions that occur when counter data triggers an alert, use the Action tab. To define start and stop parameters for an alert, use the Schedule tab.

The following sections of this article describe how to configure alert options in each of these tabs.
How to Configure Alerts
Define Counters and Thresholds for an Alert

    Click Start, point to Administrative Tools, and then click Performance.
    Double-click Performance Logs and Alerts, and then click Alerts.
    In the Details pane, double-click the alert that you want to configure.
    Click the General tab.
    In the Comment box, type an appropriate comment to describe the alert (if you have not already added a comment), and then click Add.
    For each counter or group of counters that you want to add to the log, follow these steps:
        To monitor counters from the computer on which the Performance Logs and Alerts service runs, click Use local computer counters. Or, to monitor counters from a specific computer regardless of where the service is run, click Select counters from computer, and then specify the name of the computer you want to monitor.
        In the Performance object box, click the object that you want to monitor.
        In the Select counters from list box, click the counter(s) that you want monitor.
        To monitor all instances of the selected counters, click All instances. Note that binary logs can include instances that are not available at log startup but subsequently become available. Or, to monitor particular instances of the selected counters, click Select Instances From List, and then click the instances that you want to monitor.
        Click Add.
    Click Close when you are finished.
    In the Alert when the value is box, click either Under or Over, and then specify the value that triggers the alert in the Limit box.
    In the Sample data every box, specify the amount and the unit of measure for the update interval that you want.
    Click OK.

Define Actions for an Alert

    Click Start, point to Administrative Tools, and then click Performance.
    Double-click Performance Logs and Alerts, and then click Alerts.
    In the Details pane, double-click the alert that you want to configure.
    Click the Action tab.
    Specify the action or actions that you want:
        If you want the Performance Logs and Alerts service to create an entry in the application log of Event Viewer when an alert occurs, click to select the Log an entry in the application event log check box.
        If you want the Performance Logs and Alerts service to trigger the Messenger service to send a message, click to select the Send a network message to check box, and then type the IP address or name of the computer on which the alert message should be displayed.
        To run a counter log when an alert occurs, click to select the Start performance data log check box, and then specify the counter log that you want to run.
        To run a command or program when an alert occurs, click to select the Run this program check box, and then type the file path and name of the program or command that you want to run, or click Browse to locate the file.

        When an alert occurs, the service creates a process and runs the specified command file. The service also copies any command-line arguments you define to the command line that is used to run the file. Click Command Line Arguments, and then click to select the appropriate check boxes to include the arguments that you want when the program is run.

        Note You must select at least one command-line argument or the program will not run. (This is true regardless of what program you have selected.)
    Click OK.

Define Start or Stop Parameters for an Alert

    Click Start, point to Administrative Tools, and then click Performance.
    Double-click Performance Logs and Alerts, and then click Alerts.
    In the Details pane, double-click the alert that you want to configure.
    Click the Schedule tab.
    Under Start scan, do one of the following:
        Click Manually if you want to manually start the scan. After you select this option, right-click the alert in the right pane, and then click Start to start the scan.
        Click At to start the scan at a specific time and date, and then specify the time and date that you want.
    Under Stop scan, do one of the following:
        Click Manually if you want to manually stop the scan. After you select this option, right-click the alert in the right pane, and then click Stop to start the scan.
        Click After to stop the scan after a specified duration, and then specify the time interval that you want.
        Click At to stop the scan at a specific time and date, and then specify the time and date that you want.
    If you want to stat a new scan, click to select the Start a new scan check box.
    Click OK.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

HOW TO: Connect to the VMware vSphere Hypervisor 6.5 (ESXi 6.5) using the vSphere (HTML5 Web) Host Client 6.5, and perform a simple configuration task of adding a new VMFS 6 datastore.
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
Teach the user how to configure vSphere Replication and how to protect and recover VMs Open vSphere Web Client: Verify vsphere Replication is enabled: Enable vSphere Replication for a virtual machine: Verify replicated VM is created: Recover replica…
Teach the user how to configure vSphere clusters to support the VMware FT feature Open vSphere Web Client: Verify vSphere HA is enabled: Verify netowrking for vMotion and FT Logging is in place or create it: Turn On FT for a virtual machine: Verify …

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now