Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel2
minLevel2

Image Removed

...

Creating a

...

Image Removed

Creating an Action Profile and Adding it to a Service Monitor

Image Removed

Related Article

Image Removed

Creating an Action Profile to Start Any Windows Service

Creating a recovery script

...

The

...

recovery

...

script

...

depends on

...

the

...

desired

...

action

...

and must be developed based on the user's

...

specific

...

environment.

...

After

...

the

...

agent-side

...

script

...

is

...

written,

...

the

...

Uptime

...

Infrastructure

...

Monitor

...

agent must be configured to execute it. As a minimum, configure the following settings for each agent-side command:

  • For agents running on non-Windows systems, define a password and command pair in the agent-side password file by completing the following steps:
    • Ensure that a file named .uptmpasswd is created in the Uptime Infrastructure Monitor agent bindirectory (either /opt/SPYNuptm/bin/

...

    • or

...

    • /opt/uptime-agent/bin

...

    • depending

...

    • on

...

    • the

...

    • agent

...

    • version).

...

    • This

...

    • file

...

    • must

...

    • be

...

    • owned

...

    • and

...

    • readable

...

    • by

...

    • the

...

    • user

...

    • that

...

    • the

...

    • agent

...

    • is

...

    • run

...

    • as.

...

    • Open

...

    • the

...

    • .uptmpasswd

...

    • file

...

    • in

...

    • a

...

    • text

...

    • editor.

...

    • Enter

...

    • a

...

    • password

...

    • and

...

    • command

...

    • pair

...

    • for

...

    • each

...

    • command

...

    • that

...

    • you

...

    • want

...

    • to

...

    • run

...

    • on

...

    • the

...

    • agent

...

    • system.

...

    • The

...

    • following

...

    • is

...

    • an

...

    • example

...

    • format

...

    • and

...

    • contents

...

    • of

...

    • an

...

    • agent-side

...

    • command

...

    • script:

...


    • Format

...

    • :

...

    • [password

...

    • ]

...

    • [command

...

    • path,

...

    • no

...

    • arguments

...

    • ]
      Example file contents:
      Code Block
      languagesql
      secretpassword /opt/uptime-agent/my-scripts/show_temp.sh

...

    • 
      $%^& /usr/local/bin/appstatus.sh

...

  • For agents running on Windows systems, define a password and command pair in the

...

  • UIM agent console by completing the following steps:

...

    1. Open the

...

    1. UIM Agent Admin console, and then click

...

    1. Advanced > Custom Script

...

    1. .

...

    1. Provide a simple command name in the Command Name field

...

    1. , and then type the path of the script in the Path to Script field.

Image Removed

    1. Click the Add / Edit button

...

    1. to close the window.

...

    1. Type the password in the Password field, save it, and then restart the agent.

Verify that the agent-side command permissions allow the execution of the command by the user that the agent is run as. If the commands within your script require additional system permissions, you may need to alter the security settings for the execution of the agent.

Creating a monitoring station script

...

The

...

next

...

step

...

is

...

to

...

write

...

a

...

monitoring

...

station

...

script

...

that

...

attempts to

...

execute

...

your

...

agent-side

...

script

...

so

...

the

...

action

...

profile

...

can

...

perform

...

the

...

task

...

based

...

on

...

the

...

script's

...

output.

...

The

...

monitoring

...

station

...

script

...

can

...

be

...

written

...

in

...

any

...

language

...

and

...

format

...

provided

...

that

...

it

...

adheres

...

to

...

these

...

general

...

rules:

...

  • The script must exit with a success status (i.e.

...

  • no

...

  • errors

...

  • during

...

  • the

...

  • execution).

...

  • The script must accept the host name of the agent system as the third argument (UIM automatically adds this argument to the arguments that are passed to the script).

In most cases, the monitoring station script contacts an agent system and attempts to run a pre-defined agent-side script. You can use any transport tool, such as rexec, rsh or ssh, to contact the agent system. However, we recommend using the bundled agentcmd or netcat utility to contact your agent systems from your monitoring station script.

The agentcmd utility is commonly called in the format listed below to execute a command on the agent-side system. The following example uses the settings that were configured above to execute the agent-side script:

  • Format: /usr/local/uptime/scripts/agentcmd

...

  • \[-s/+s\]

...

  • -p

...

  • \[agent

...

  • port\]

...

  • \[agent

...

  • hostname\]

...

  • rexec

...

  • \[password\]

...

  • \[path\]

...

  • Example:

...

  • /usr/local/uptime/scripts/agentcmd

...

  • my-agent

...

  • -p

...

  • 9998

...

  • rexec

...

  • secretpassword

...

  • /opt/uptime-agent/my-scripts/show_temp.sh

...

  • my-arguments

...

  •  
  • For more information on agentcmd syntax, see Using the agentcmd utility.

The netcat utility is commonly called in the format listed below to execute a command on the agent-side system. This example uses the settings that were configured above to execute the agent side script:

  • Format: echo -n rexec \[password\] \[path\] | /usr/local/uptime/bin/netcat

...

  • \[agent

...

  • hostname\]

...

  • \[agent

...

  • port\]

...

  • Example:

...

  • echo

...

  • -n

...

  • rexec

...

  • secretpassword

...

  • /opt/uptime-agent/my-scripts/show_temp.sh

...

  • my-arguments

...

  • |

...

  • /usr/local/uptime/bin/netcat

...

  • my-agent

...

  • 9998

...

  • !

...

  • Note:

...

  • the

...

  • rexec

...

  • text

...

  • above

...

  • does

...

  • not

...

  • indicate

...

  • use

...

  • of

...

  • the

...

  • rexec

...

  • system

...

  • utility,

...

  • it

...

  • is

...

  • simply

...

  • a

...

  • key

...

  • word

...

  • used

...

  • to

...

  • indicate

...

  • to

...

  • the

...

  • agent

...

  • that

...

  • you

...

  • are

...

  • attempting

...

  • to

...

  • run

...

  • a

...

  • pre-defined

...

  • command.

...

For

...

monitoring

...

stations

...

running

...

on

...

Windows:

...

  1. Open a command prompt and go to the <uptime dir>uptimescripts folder.

...

  1. Run

...

  1. the

...

  1. following

...

  1. command

...

  1. to

...

  1. verify

...

  1. if

...

  1. you

...

  1. can

...

  1. create

...

  1. a

...

  1. rexec

...

  1. session:

...


  1. Code Block
    languagesql
    agentcmd.exe -s -p 9998 \[hostname\] "rexec \[password\] \[CommandName\]"
    For example: C:Program Filesuptime softwareuptimescripts>agentcmd.exe -s -p 9998 testhost "rexec uptime test"

...

  1. Image Modified

Creating an action profile and adding it to a service monitor

...

Example monitor configuration:

For more information about this feature, see Creating an Action Profile to Start Any Windows Service.