1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366
|
.\" $Id: moncmd.1 1.2 Sun, 24 Jun 2001 22:41:40 -0400 trockij $
.TH moncmd 1 "$Date: Sun, 24 Jun 2001 22:41:40 -0400 $" Linux "moncmd"
.SH NAME
moncmd \- send commands to mon daemon and show the results.
.SH SYNOPSIS
.B moncmd
.RB [ \-a ]
.RB [ \-d ]
.RB [ \-l
.IR username ]
.RB [ \-f
.IR file ]
.RB [ \-s
.IR server ]
.RB [ \-p
.IR port ]
.RB [ command ]
.SH DESCRIPTION
.B moncmd
sends commands to the
.B mon
server.
.SH OPTIONS
.TP
.B \-a
Authenticate with the server.
.TP
.B \-d
enable debugging, which is the same as
.B \-s
.IR localhost .
.TP
.BI "-f " file
Read and execute commands from
.IR file .
.TP
.BI "-l " username
Supply
.I username
as the username while authenticating to the server.
.TP
.BI \-s\ server
Connect to
.IR server .
.TP
.BI \-p\ port
Use TCP port
.I port
when connecting to the server, instead of the
default of 32777.
.SH MONITOR HOST
.B moncmd
will use the host specified by the
.B \-s
parameter as the server. If there is no
.B \-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.
.SH BATCH OPERATION
If no commands are supplied to
.B 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.
.B 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.
.SH COMMANDS
The following is a list of the commands that
the server understands.
.\"
.\"
.TP
.BI "enable | disable service " group " " servicename
Enables/disables alerts for
.I group
and
.IR 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.
.TP
.BI "ack " "group service comment"
Acknowledge a failure condition. This will store
.I comment
in the state of service (queryable by doing a
.I "list opstatus"
command), and will surppress further alerts for
the service. Once the service returns to a non-failure
state, then the acknowledgement is reset.
.TP
.B "version"
Displays the protocol version in the form of
"version
.BR num """
where
.B num
is the protocol version number.
.TP
.BI "list aliases"
Lists aliases.
.TP
.BI "list aliasgroups"
Lists alias groups.
.TP
.B savestate
Save the state of the server. Currently, the only state which
is saved is the host/watches/services which are disabled.
.TP
.B loadstate
Load the state of the server. Currently, the only state which
is loaded is the host/watches/services which are disabled.
.TP
.BI "enable | disable host " hostname
Enables/disables host
.I 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
.BI "enable | disable watch"
command should be used instead.
.TP
.BI "enable | disable watch " watchgroup
Enables/disables an entire watch for
.IR 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.
.TP
.BI "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
.B moncmd
connects from the host which is running the
.B mon
server.
.TP
.BI "reset stopped"
Resets the server and immediately stops the scheduler.
This is an atomic version of the commands
.B "reset"
and
.BR "stop" .
.TP
.BI "reload auth"
Reloads the auth.cf file in order to incorporate any new changes.
The auth table is completely re-generated; it is not merged.
.TP
.BI "reset keepstate"
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.
.TP
.BI "stop"
Stops the scheduler, but continues to allow
client connections.
.TP
.BI "start"
Re-starts the scheduler after it has been
stopped.
.TP
.BI "test monitor " group " " servicename
Triggers a test for
.I "group"
and
.I "service"
immediately by
setting the service's countdown timer to zero.
.TP
.BI "test (alert | upalert | startupalert) " group " " servicename " " retval " " period
Triggers a test alert, upalert, or startupalert for
.I group
and
.IR servicename .
.I retval
is the integer exit value to pass to the alert via
the MON_RETVAL environment variable. You must also
specify the
.I 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.
.TP
.BI "servertime"
Returns the current time of the server as seconds since Jan 1, 1970.
.TP
.BI "list group " groupname
Lists the members of group
.IR groupname .
.TP
.B "list descriptions"
List the descriptions of each service, as defined
in the configuration file. If a service description
is undefined, then it is not listed.
.TP
.BI "list alerthist"
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
.I maxkeep
variable, configurable on the
.B mon
command line at startup, and expandable with the
.B set
command during runtime.
.TP
.BI "list failurehist"
Lists the last failures, in addition to the summary output.
This is also limited by the
.I maxkeep
variable.
.TP
.BI "list opstatus"
Lists operational status of all services. Reports whether the last time
a service group was tested resulted in success or failure. The output
is:
.nf
group service untested
group service time timeleft succeeded
group service time timeleft failed output
.fi
where
.I output
is the first line of output from the monitor script
which failed,
.I time
is the time that the condition was last noticed in
.BR time (2)
format, and
.I timeleft
is the number of seconds left until the service is tested
again.
.TP
.BI "list successes"
Generates the same output as the
.B "list opstatus"
command, but only shows the services that
have succeeded the last time they were tested.
.TP
.BI "list failures"
Generates the same output as the
.B "list opstatus"
command, but only shows the services that
have failed the last time they were tested.
.TP
.BI "list disabled"
Lists all hosts and services which have been disabled by the
.B "disable host|service"
command.
.TP
.BI "list pids"
Shows the currently active watch groups/services along with their
process IDs, and it process ID of the server daemon.
.TP
.BI "list watch"
Lists all watches and services.
.TP
.BI "list state"
Lists the state of the scheduler.
.TP
.BI "set " group " " service " " variable " " value
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").
.TP
.BI "get " group " " service " " variable
Displays the value of group service variable.
.TP
.BI "set " variable " " value
Assigns
.I value
to the global variable
.IR variable .
.TP
.BI "set opstatus " group " " service " " value
Sets the opstatus value for
.I group
and
.I service.
.TP
.BI "get " variable
Shows the value of global variable
.IR variable .
.TP
.BI "term"
Terminates the server.
This command is only accessible if
.B moncmd
connects from the host which is running the
.B mon
server.
.SH "ENVIRONMENT VARIABLES"
.IP MONSERVER
The hostname of the server which runs the
.B mon
process.
.IP MONPORT
The port number to connect to.
.SH SEE ALSO
mon(8)
.SH BUGS
Report bugs to the email address below.
.SH AUTHOR
Jim Trocki <trockij@transmeta.com>
|