1moncmd(1)                           moncmd                           moncmd(1)
2
3
4

NAME

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

SYNOPSIS

9       moncmd  [-a]  [-d]  [-l username] [-f file] [-s server] [-p port] [com‐
10       mand]
11

DESCRIPTION

13       moncmd sends commands to the mon server.
14

OPTIONS

16       -a     Authenticate with the server.
17
18       -d     enable debugging, which is the same as -s localhost.
19
20       -f file
21              Read and execute commands from file.
22
23       -l username
24              Supply username as the  username  while  authenticating  to  the
25              server.
26
27       -s server
28              Connect to server.
29
30       -p port
31              Use  TCP port port when connecting to the server, instead of the
32              default of 32777.
33
34

MONITOR HOST

36       moncmd will use the host specified by the -s parameter as  the  server.
37       If  there is no -s parameter it will use the host specified in the MON‐
38       HOST environment variable.  If there is no  host  in  either  of  these
39       locations it will exit with an error.
40
41

BATCH OPERATION

43       If  no  commands  are supplied to moncmd on the command line, then com‐
44       mands will be taken from either standard input, or from the file speci‐
45       fied  by the -f parameter.  If standard input is connected to a TTY and
46       the -a option is supplied, then it will prompt for a password.  If  the
47       -a option is supplied without the -f option and standard input is not a
48       TTY, then the username and password are read from standard input  using
49       the  syntax  "USER=username"  and  "PASS=password". The remaining input
50       lines are interpreted as commands to send to the server.   moncmd  will
51       not  take usernames or passwords from a file, for obvious security rea‐
52       sons.
53
54       If the username is neither supplied by  the  -l  parameter  or  through
55       standard  input,  it is taken from the effective user ID of the current
56       process.
57
58

COMMANDS

60       The following is a list of the commands that the server understands.
61
62       enable | disable service group servicename
63              Enables/disables alerts for group and servicename.  All disabled
64              states  are  automatically  saved  to  the state file, which may
65              optionally be re-loaded upon restarting or  initial  startup  of
66              the server.
67
68
69       ack group service comment
70              Acknowledge  a failure condition. This will store comment in the
71              state of service (queryable by doing a list  opstatus  command),
72              and will surppress further alerts for the service. Once the ser‐
73              vice returns to a non-failure state, then the acknowledgement is
74              reset.
75
76
77       version
78              Displays the protocol version in the form of "version num" where
79              num is the protocol version number.
80
81
82       list aliases
83              Lists aliases.
84
85
86       list aliasgroups
87              Lists alias groups.
88
89
90       savestate
91              Save the state of the server. Currently, the only state which is
92              saved is the host/watches/services which are disabled.
93
94
95       loadstate
96              Load the state of the server. Currently, the only state which is
97              loaded is the host/watches/services which are disabled.
98
99
100       enable | disable host hostname
101              Enables/disables host hostname in all groups. When  the  monitor
102              is  called,  this  hostname  will not be included in the list of
103              hostnames sent to the monitor. If a group has only one  hostname
104              in  it,  then  the enable | disable watch command should be used
105              instead.
106
107
108       enable | disable watch watchgroup
109              Enables/disables an entire watch for watchgroup, as  defined  in
110              the  configuration file. Disabling a watch not only stops alerts
111              from happening, but it stops the actual monitor  processes  from
112              being scheduled.
113
114
115       reset  Resets the server, forcing it to re-read the configuration file,
116              kill off currently running monitors, restart all monitoring, and
117              reset  all  counters.  This command is only accessible if moncmd
118              connects from the host which is running the mon server.
119
120       reset stopped
121              Resets the server and immediately stops the scheduler.  This  is
122              an atomic version of the commands reset and stop.
123
124
125       reload auth
126              Reloads  the  auth.cf  file  in  order  to  incorporate  any new
127              changes.  The auth table is completely re-generated; it  is  not
128              merged.
129
130
131       reset keepstate
132              If  the  word  "keepstate"  comes  after  the reset command, the
133              server will do a "loadstate" right after the reset,  before  the
134              scheduler kicks back in.
135
136
137       stop   Stops the scheduler, but continues to allow client connections.
138
139
140       start  Re-starts the scheduler after it has been stopped.
141
142
143       test monitor group servicename
144              Triggers a test for group and service immediately by setting the
145              service's countdown timer to zero.
146
147
148       test (alert | upalert | startupalert) group servicename retval period
149              Triggers a test alert, upalert, or startupalert  for  group  and
150              servicename.   retval  is  the integer exit value to pass to the
151              alert via the MON_RETVAL environment  variable.  You  must  also
152              specify the period as it appears in the configuration file.  All
153              alerts of the given type in that period will be  triggered,  but
154              the alert will not be logged.
155
156
157       servertime
158              Returns  the  current time of the server as seconds since Jan 1,
159              1970.
160
161
162       list group groupname
163              Lists the members of group groupname.
164
165
166       list descriptions
167              List the descriptions of each service, as defined in the config‐
168              uration  file. If a service description is undefined, then it is
169              not listed.
170
171
172       list alerthist
173              Lists the last alarms triggered for each service of  each  watch
174              group,  in  addition to the summary output. The number of alerts
175              to keep in memory is bounded by the  maxkeep  variable,  config‐
176              urable  on  the mon command line at startup, and expandable with
177              the set command during runtime.
178
179
180       list failurehist
181              Lists the last failures, in  addition  to  the  summary  output.
182              This is also limited by the maxkeep variable.
183
184
185       list opstatus
186              Lists  operational  status  of all services. Reports whether the
187              last time a service group was  tested  resulted  in  success  or
188              failure. The output is:
189
190              group service untested
191              group service time timeleft succeeded
192              group service time timeleft failed output
193
194              where output is the first line of output from the monitor script
195              which failed, time is the  time  that  the  condition  was  last
196              noticed in time(2) format, and timeleft is the number of seconds
197              left until the service is tested again.
198
199
200       list successes
201              Generates the same output as the list opstatus command, but only
202              shows  the  services that have succeeded the last time they were
203              tested.
204
205
206       list failures
207              Generates the same output as the list opstatus command, but only
208              shows  the  services  that  have  failed the last time they were
209              tested.
210
211
212       list disabled
213              Lists all hosts and services which have  been  disabled  by  the
214              disable host|service command.
215
216
217       list pids
218              Shows  the  currently  active  watch  groups/services along with
219              their process IDs, and it process ID of the server daemon.
220
221
222       list watch
223              Lists all watches and services.
224
225
226       list state
227              Lists the state of the scheduler.
228
229
230       set group service variable value
231              Sets a variable to value. Useful  for  temporarily  changing  an
232              interval  or alertevery value. Be careful, because this can just
233              set any value in the %watch hash, and some values that are spec‐
234              ified  in  the  configuration  file like "10m" or "35s" are con‐
235              verted and stored as just plain integer seconds (e.g.  "alertev‐
236              ery").
237
238
239       get group service variable
240              Displays the value of group service variable.
241
242
243       set variable value
244              Assigns value to the global variable variable.
245
246
247       set opstatus group service value
248              Sets the opstatus value for group and service.
249
250
251       get variable
252              Shows the value of global variable variable.
253
254
255       term   Terminates  the server.  This command is only accessible if mon‐
256              cmd connects from the host which is running the mon server.
257
258

ENVIRONMENT VARIABLES

260       MONSERVER
261              The hostname of the server which runs the mon process.
262
263       MONPORT
264              The port number to connect to.
265
266

SEE ALSO

268       mon(8)
269

BUGS

271       Report bugs to the email address below.
272

AUTHOR

274       Jim Trocki <trockij@arctic.org>
275
276
277
278Linux                    $Date: 2005/04/17 07:42:27 $                moncmd(1)
Impressum