Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
\n \n \n \n \n \n \n \n \n \n \n \n \n
Related DocumentationVersion of up.time \naffectedAffected Platforms
\n4.5 or newerAll

...

There are two main scenarios for using the agentcmd utility:

...

    \n
  • With an agent on a system that has been added to up.timeUptime Infrastructure Monitor. In this case, the hostname is in the up.time DataStore.
  • \n
  • With an agent that has been deployed on a system that has not been added to up.timeUptime Infrastructure Monitor. If there is no agent on the system, or there are network problems, agentcmd returns the following error message: \n

    ERR Unable to contact Agent (10.1.2.34 on port 9998)

    \n
  • \n

...

You can use agentcmd in two ways: from the command line or in an agent-side script.

...

Table of Contents

Using agentcmd at the command line

...

The command line syntax of agentcmd is:

...

Code Block
languagetext
agentcmd <t#> <-/+s> <-p #> hostname command

...

Where:

...

    \n
  • t# = use timeout.
  • -s = do not use an SSL connection to the agent (default).
  • \n
  • +s = connect to the agent using SSL. \n
  • If SSL is not enabled on the host, the following error message appears:

    \n

    ERR The host was not configured to use SSL

    \n

  • \n
  • -p # = connect to the agent on the specified port (default is 9998).
  • \n
  • hostname = the name or IP address of the host on which the agent is running.
  • \n
  • command = the agent command to run.
  • \n

...

For example, to get basic system information from an agent running on the server Solaris1, type the following command:

...

Code Block
languagetext
agentcmd +s Solaris1 sysinfo

...

 

The agent will return output similar to the following:

...


\nSYSNAME SYSNAME=Solaris1
\nDOMAIN DOMAIN=myDomain.com
\nARCH ARCH="SunOS Solaris1 5.9 Generic_118558-03 sun4u sparc SUNW,Ultra-Enterprise"
\nOSVER OSVER=5.9
\nNUMCPUS NUMCPUS=4
\nMEMSIZE MEMSIZE=1048576
\nPAGESIZE PAGESIZE=8192
\nSWAPSIZE SWAPSIZE=1021624
\nGPGSLO GPGSLO=25
\nVXVM VXVM=""
\nSDS SDS="YES"
\nHOSTID HOSTID="808cf673"
\nCPU0 CPU0=" 0 - - 168 - UltraSPARC - "
\nCPU1 CPU1=" 1 - - 168 - UltraSPARC - "
\nCPU4 CPU4=" 4 - - 168 - UltraSPARC - "
\nCPU5 CPU5=" 5 - - 168 - UltraSPARC - "
\nNET0 NET0=lo0=127.0.0.1
\nNET1 NET1=hme0=10.0.0.010
\n

...

 

Using agentcmd in an agent-side script

...

As with netcat, agentcmd is typically used in a script on the monitoring station to perform the following tasks:

...

    \n
  • Contact an agent system.
  • \n
  • Attempt to run a predefined agent-side script.
  • \n
  • Return the results of an agent-side script.
  • \n
  • Validate the status of those results.
  • \n
  • Return the status to up.timeUptime Infrastructure Monitor.
  • \n

...

The following example illustrates how to run agentcmd in an agent side script:

...

Note
titleNote

The rexec in the command below does not indicate use of the rexec system utility. It is a keyword that is used to indicate to the agent that you are attempting to run a pre-defined command.

...

...

Code Block
languagetext
/usr/local/uptime4/scripts/agentcmd [-s/+s] -p [agent port] [agent hostname] rexec [password] [path]

...

...

If you use netcat in your scripts, see the following Knowledge Base articles for information on replacing netcat with agentcmd:

...