Managing the scheduled tasks for Metrics

Use administrative commands to manage scheduled tasks in Metrics.

Before you begin

To run administrative commands, you must use the wsadmin client. See Starting the wsadmin client for details.

About this task

Metrics uses the IBM® WebSphere® Application Server scheduling service for performing regular managed tasks. For more information about how the scheduler works, see Scheduling tasks.

To manage a task, complete the following steps:

Procedure

  1. Start the Metrics Jython script interpreter.
    1. Use the following command to access the Metrics configuration file:
      execfile("metricsAdmin.py")

      If prompted to specify a service to connect to, type 1 to pick the first node in the list. Most commands can run on any node.

      If the command writes or reads information to or from a file using a local file path, you must pick the node where the file is stored.

  2. Use the following commands to administer the Metrics scheduler service.
    • MetricsSchedulerService.getTaskDetails(java.lang.String taskName)
      Returns information about the scheduled task specified by taskName. Specify one of the following jobs:
      • "ReportGenerator"
      • "MetricsDBCleanup"
      • "DataSynchronization"

      The values returned are server time, next scheduled run time, status (SCHEDULED, RUNNING, SUSPENDED), and task name. When the task has been paused, then the status parameter shows as SUSPENDED instead of SCHEDULED. SUSPENDED means that the task is not scheduled to run.

      For example:
      MetricsSchedulerService.getTaskDetails("ReportGenerator")
      returns output similar to the following:
      {currentServerTime=Fri Jan 22 14:13:52 EST 2010, nextFireTime=
      Fri Jan 22 14:21:00 EST 2010, status=SCHEDULED, taskName=ReportGenerator}
    • MetricsSchedulerService.pauseSchedulingTask(java.lang.String taskName)

      Temporarily pauses the specified task and stops it from running.

      When you pause a scheduled task, the task remains in the suspended state even after you stop and restart Metrics or the IBM® WebSphere® Application Server. You must run the MetricsScheduler.resumeSchedulingTask(String taskName) command to get the task running again.

      If the task is currently running, it continues to run but is not scheduled to run again. If the task is already suspended, this command has no effect.

      For example:
      MetricsSchedulerService.pauseSchedulingTask("ReportGenerator")
      returns output similar to the following:
      ReportGenerator paused
    • MetricsSchedulerService.resumeSchedulingTask(java.lang.String taskName)

      If the task is suspended, puts the task in the scheduled state. If the task is not suspended, this command has no effect.

      When a task is resumed, it does not run immediately; it runs at the time when it is next scheduled to run.

      For example:
      MetricsSchedulerService.resumeSchedulingTask("ReportGenerator")
      returns output similar to the following:
      ReportGenerator resumed