logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

moncmd - send commands to mon daemon and show the results.

Author

       Jim Trocki <trockij@arctic.org>

Linux                                     $Date: 2005/04/17 07:42:27 $                                 moncmd(1)

Batch Operation

       If  no  commands  are  supplied  to  moncmd  on the command line, then commands will be taken from either
       standard input, or from the file specified by the -f parameter.  If standard input is connected to a  TTY
       and  the -a option is supplied, then it will prompt for a password.  If the -a option is supplied without
       the -f option and standard input is not a TTY, then the username and  password  are  read  from  standard
       input  using the syntax "USER=username" and "PASS=password". The remaining input lines are interpreted as
       commands to send to the server.  moncmd will not take usernames or passwords from  a  file,  for  obvious
       security reasons.

       If  the  username is neither supplied by the -l parameter or through standard input, it is taken from the
       effective user ID of the current process.

Bugs

       Report bugs to the email address below.

Commands

       The following is a list of the commands that the server understands.

       enable|disableservicegroupservicename
              Enables/disables alerts for group and servicename.  All disabled states are automatically saved to
              the state file, which may optionally be re-loaded  upon  restarting  or  initial  startup  of  the
              server.

       ackgroupservicecomment
              Acknowledge  a  failure  condition.  This will store comment in the state of service (queryable by
              doing a listopstatus command), and will surppress  further  alerts  for  the  service.  Once  the
              service returns to a non-failure state, then the acknowledgement is reset.

       version
              Displays  the  protocol  version  in  the  form of "version num" where num is the protocol version
              number.

       listaliases
              Lists aliases.

       listaliasgroups
              Lists alias groups.

       savestate
              Save  the  state  of  the  server.  Currently,  the   only   state   which   is   saved   is   the
              host/watches/services which are disabled.

       loadstate
              Load   the   state   of   the   server.   Currently,  the  only  state  which  is  loaded  is  the
              host/watches/services which are disabled.

       enable|disablehosthostname
              Enables/disables host hostname in all groups. When the monitor is called, this hostname  will  not
              be  included in the list of hostnames sent to the monitor. If a group has only one hostname in it,
              then the enable|disablewatch command should be used instead.

       enable|disablewatchwatchgroup
              Enables/disables an entire watch for watchgroup, as defined in the configuration file. Disabling a
              watch not only stops alerts from happening, but it stops the actual monitor processes  from  being
              scheduled.

       reset  Resets  the  server,  forcing  it  to  re-read  the configuration file, kill off currently running
              monitors, restart all monitoring, and reset all counters.  This  command  is  only  accessible  if
              moncmd connects from the host which is running the mon server.

       resetstopped
              Resets  the server and immediately stops the scheduler.  This is an atomic version of the commands
              reset and stop.

       reloadauth
              Reloads the auth.cf file in order to incorporate any new changes.  The auth  table  is  completely
              re-generated; it is not merged.

       resetkeepstate
              If  the  word  "keepstate"  comes  after the reset command, the server will do a "loadstate" right
              after the reset, before the scheduler kicks back in.

       stop   Stops the scheduler, but continues to allow client connections.

       start  Re-starts the scheduler after it has been stopped.

       testmonitorgroupservicename
              Triggers a test for group and service immediately by setting  the  service's  countdown  timer  to
              zero.

       test(alert|upalert|startupalert)groupservicenameretvalperiod
              Triggers  a test alert, upalert, or startupalert for group and servicename.  retval is the integer
              exit value to pass to the alert via the MON_RETVAL environment variable. You must also specify the
              period as it appears in the configuration file.  All alerts of the given type in that period  will
              be triggered, but the alert will not be logged.

       servertime
              Returns the current time of the server as seconds since Jan 1, 1970.

       listgroupgroupname
              Lists the members of group groupname.

       listdescriptions
              List  the  descriptions  of  each  service,  as  defined  in  the configuration file. If a service
              description is undefined, then it is not listed.

       listalerthist
              Lists the last alarms triggered for each service of each watch group, in addition to  the  summary
              output. The number of alerts to keep in memory is bounded by the maxkeep variable, configurable on
              the mon command line at startup, and expandable with the set command during runtime.

       listfailurehist
              Lists  the  last failures, in addition to the summary output.  This is also limited by the maxkeep
              variable.

       listopstatus
              Lists operational status of all services. Reports whether the last time a service group was tested
              resulted in success or failure. The output is:

              group service untested
              group service time timeleft succeeded
              group service time timeleft failed output

              where output is the first line of output from the monitor script which failed, time  is  the  time
              that  the condition was last noticed in time(2) format, and timeleft is the number of seconds left
              until the service is tested again.

       listsuccesses
              Generates the same output as the listopstatus command, but only  shows  the  services  that  have
              succeeded the last time they were tested.

       listfailures
              Generates  the  same  output  as  the listopstatus command, but only shows the services that have
              failed the last time they were tested.

       listdisabled
              Lists all hosts and services which have been disabled by the disablehost|service command.

       listpids
              Shows the currently active watch groups/services along with their process IDs, and it  process  ID
              of the server daemon.

       listwatch
              Lists all watches and services.

       liststate
              Lists the state of the scheduler.

       setgroupservicevariablevalue
              Sets  a  variable  to  value.  Useful for temporarily changing an interval or alertevery value. Be
              careful, because this can just set any value  in  the  %watch  hash,  and  some  values  that  are
              specified  in  the  configuration  file like "10m" or "35s" are converted and stored as just plain
              integer seconds (e.g. "alertevery").

       getgroupservicevariable
              Displays the value of group service variable.

       setvariablevalue
              Assigns value to the global variable variable.

       setopstatusgroupservicevalue
              Sets the opstatus value for group and service.getvariable
              Shows the value of global variable variable.

       term   Terminates the server.  This command is only accessible if moncmd connects from the host which  is
              running the mon server.

Description

moncmd sends commands to the mon server.

Environment Variables

       MONSERVER
              The hostname of the server which runs the mon process.

       MONPORT
              The port number to connect to.

Monitor Host

moncmd  will  use  the  host specified by the -s parameter as the server.  If there is no -s parameter it
       will use the host specified in the MONHOST environment variable.  If there is no host in either of  these
       locations it will exit with an error.

Name

       moncmd - send commands to mon daemon and show the results.

Options

-a     Authenticate with the server.

       -d     enable debugging, which is the same as -slocalhost.

       -ffile
              Read and execute commands from file.

       -lusername
              Supply username as the username while authenticating to the server.

       -sserver
              Connect to server.

       -pport
              Use TCP port port when connecting to the server, instead of the default of 32777.

See Also

mon(8)

Synopsis

moncmd [-a] [-d] [-lusername] [-ffile] [-sserver] [-pport] [command]

See Also