Managing Auto Setup
This page provides a quick-study guide to configuring GDMA Auto Setup. Background and detailed reference material are available in sibling pages.
Client-side Configuration
The initial versions of GDMA where Auto-Setup was available did not provide for automatic configuration of this feature on the client; manual intervention was necessary. However, to take advantage of a variety of improvements and bug fixes in GDMA overall, you should be using GDMA 2.7.1 or later, where enabling Auto-Setup is supported during the installation process. Here, we will focus mainly on that context.
GDMA Auto-Setup is not enabled by default; because locally-tailored server-side instructions and trigger files are involved, using it is a deliberate choice. Also, it uses the same user credentials as GDMA Auto-Registration. Therefore, the following unattended-mode command-line install options (or their equivalent option-file forms) are needed to make Auto-Setup available on the client.
--gdma_autoregistration_username 'my_gdma_autoregistration_username' --gdma_autoregistration_password 'my_gdma_autoregistration_password' --gdma_auto_configuration autosetup
Equivalent choices are available in text-mode and UI-mode GDMA-client installation interactions. You must provide the user/pass values in order for the choice of enabling Auto-Setup to appear.
Behind the scenes, enabling Auto-Setup modifies the following settings in gdma/config/gdma_auto.conf
on the client, to values as shown. (The Auto_Register_User
and Auto_Register_Pass
values must be tuned as appropriate for your site. Some other settings are also involved, but they remain unchanged so we will not discuss them here.)
Auto_Register_Attempts = "never" Auto_Register_Host_Profile = "none" Auto_Register_Pass = "gdma" Auto_Register_User = "gdma" Enable_Auto_Setup = "on"
Auto_Register_Attempts
is changed from its typical value of fibonacci
to never
instead, to disable that mode of automatically establishing an initial configuration for the GDMA client. Similarly, Auto_Register_Host_Profile
is set to none
so as to prevent any possible application of this field should Auto-Setup be mistakenly disabled at some point in the future.
When installing GDMA 2.6.X on a client, where you did not have the opportunity to enable Auto-Setup from the get-go during the install process, there was a danger that Auto-Registration would kick in and establish an undesired initial client configuration before you had a chance to set up Auto-Setup. There are ways around that, but the simple approach is to just not use such an older release. Use GDMA 2.7.1 or later, instead.
The following setting is also highly recommended now, established in gdma/config/gdma_auto.conf
and not overridden in host externals:
Enable_Local_Logging = "on"
Note: There are some issues with controlling Enable_Local_Logging
in host externals if you are sharing host externals between Windows GDMA 2.7.1-or-later machines and earlier releases on this platform. See GDMA 2.7.1 Release Notes for more information.
While developing new Auto-Setup instructions, you might also want to shorten tests of successive versions on one GDMA machine of interest with:
Poller_Proc_Interval = "60"
Poller_Proc_Interval = "600"
Once gdma/config/gdma_auto.conf
is configured, if you had disabled starting the GDMA daemons automatically at install time, you can start them using the appropriate platform-specific command, see Docker Commands.
Setting Up Service Externals
Starting with GroundWork Monitor 7.2.0, building externals now supports several new macros that may be referenced within externals. These may be used in combination with Auto-Setup facilities to make service externals definitions almost completely boilerplate. A typical service external definition might look like this:
Check_$BASESERVICEDESC$[$INSTANCE$]_Enable="ON" Check_$BASESERVICEDESC$[$INSTANCE$]_Service="$SERVICEDESC$" Check_$BASESERVICEDESC$[$INSTANCE$]_Command="check_train -t $INSTANCESUFFIX$ -w $ARG2$ -c $ARG3$" Check_$BASESERVICEDESC$[$INSTANCE$]_Check_Interval="1" Check_$BASESERVICEDESC$[$INSTANCE$]_Timeout="30"
_Command
line that must still be tuned for the particular service check to be run. And even that definition can take advantage of some of the new macro support. For exmple, in the sample externals above, $INSTANCESUFFIX$
refers to the service instance name as defined in Monarch, for a multiple-instance service, with a possible leading underscore omitted. Also, argument references like $ARG2$
and $ARG3$
refer to either externals arguments defined at the host-service level (for a single-instance-on-host service), or at the service-instance level (for a multiple-instance-on-host service). Especially when using GDMA Auto-Setup, you should strive to make your service externals as general as possible, and use such argument substitution to fill in the details. With Auto-Setup in particular, the values substituted for these macros can be derived automatically from the auto-discovery results, greatly reducing the manual work involved. We'll have more to say about that in later sections of this document.
Effectively, as of GroundWork Monitor 7.2.0, all service externals should be converted over to this kind of boilerplate definition, whether or not Auto-Setup is in use. That will simplify maintenance going forward.
Creating Instructions Files
Instructions files consist of a single heading line specifying the file format version:
format_version = "1.0"
#
character and run to the end of the line. Instructions files are subject to one pass of backslash-escape interpretation as they are read, which means you must double any backslashes you wish to be present as literal characters in directive values. Depending on the nature of how the directive value is to be processed, further doubling may be required to have the value interpreted as you wish by the final code. For instance, a pattern
directive value is a Perl regular expression, so to get a backslash recognized as a literal character in the regex, it will need to be doubled for that purpose.
(Because handling of backslashes that way can be so clumsy on Windows, some sensors allow forward slashes to be used in pathnames on Windows platforms. We will have more to say on that in the discussion of those sensors, in the configuration-reference material on GDMA Auto-Setup.)
Most directive values should be double-quoted, to guard against any misinterpretation when the value is parsed as the instructions file is read:
instance_ext_args = "$MATCHED1$!40!60"
resource = " "C:\\\\program files/outlook*" "
Sensor definitions come in three flavors, depending on the type of Monarch object the sensor is to configure (host profile, service profile, or individual service).
<host "my label 1"> type = "..." ... host_profile = "my-host-profile-name" </host> <service "my label 2"> type = "..." ... service_profile = "my-service-profile-name" </service> <service "my label 3"> type = "..." ... service = "my-service-name" </service>
host_profile
sensor to match on each GDMA client, to define all host-level setup. It is perfectly acceptable to include multiple host_profile
sensors in a single instructions file, but you must ensure that their matching behavior is mutually exclusive.
You can have as many service_profile
and service
sensors as you wish match on each GDMA client, depending on the monitoring requirements. service_profile
sensors are provided for generality, but they are less useful than original envisaged. Using them effectively requires that you create service profiles within Monarch that contain only a single service, which leads to a somewhat pointless proliferation of service profiles. It's generally better to just use service
sensors instead, and skip the intermediate level of configuration.
As noted, each sensor definition refers to a single object in Monarch to be configured (a host profile, service profile, or service). That means you must provide the initial definition of the host profile, service profile, or generic service for the server-side discovery processing to customize and fold into the setup for the GDMA client. Those object definitions must be in place before discovery results are processed, or the processing will generate an error and fail to change the host's configuration.
In GroundWork Monitor 7:
- Host profiles are defined under Configuration > Profiles > Host profiles.
- Service profiles are defined under Configuration > Profiles > Service profiles.
- Generic services are defined under Configuration > Services, not attached to an individual host.
In GroundWork Monitor 8:
- Host profiles are defined under Configuration > Nagios Monitoring > Profiles > Host profiles.
- Service profiles are defined under Configuration > Nagios Monitoring > Profiles > Service profiles.
- Generic services are defined under Configuration > Nagios Monitoring > Services, not attached to an individual host.
To ease your own maintenance burden, you will want to create a small set of general-purpose instructions files that each applies to many GDMA client machines. If a given service only runs on a few GDMA machines, it can still be processed on other GDMA machines. The resource
filtering and pattern
matching in the sensor definition should be sufficient to exclude the sensor from consideration on those other clients.
You can find some sample instructions files Examples of Auto Setup, and detailed reference material on the available sensors in the document Configuration Reference for Auto Setup.
The autosetup
tool installs instructions files in a special location where the GDMA clients know to pick them up, using a special protocol to avoid race conditions. In order that autosetup
be able to recognize an instructions file so it can put it in the proper location, the name of each of your instructions files must consist of at least one character followed by _instructions
to form the complete filename. Typically, you would name each master instructions file based on the class of machines it is meant to configure, such as:
backup_server_instructions compute_node_instructions database_server_instructions file_server_instructions eb_server_instructions
linux_database_instructions windows_database_instructions
linux_instructions windows_instructions
Creating Trigger Files
Trigger files consist of just a few possible directives. Here is the canonical dry-run trigger file:
# Dry-run Auto_Setup discovery trigger. last_step = "test_configuration" if_duplicate = "optimize" soft_error_reporting = "ignore" change_policy = "non_destructive"
The autosetup
tool installs trigger files in a special location where the GDMA clients know to pick them up, using a special protocol to avoid race conditions. In order that autosetup
be able to recognize a trigger file so it can put it in the proper location, the name of each of your trigger files must consist of at least one character followed by _trigger
to form the complete filename. Beyond that, the filename can be whatever you want, though for everyone's sanity, it should describe the particular purpose of the trigger:
dry_run_trigger live_action_trigger
Invoking the autosetup Command
In GroundWork 7, the command to run autosetup
is:
/usr/local/groundwork/gdma/bin/autosetup
autosetup
is:# Situate yourself in the proper directory before running autosetup. cd /path/to/gw8 docker-compose exec monarch /usr/local/groundwork/monarch/bin/autosetup
Installing Instructions and Trigger Files
All of the instructions files that you create must be kept in your own private master stash, located in some place that you define. See Practical Advice for Auto Setup for more information about this.
To run discovery, a GDMA client must find an instructions file and a corresponding trigger file in a known location on the GDMA server. The names of those two files in the known locations must be myhostname
_instructions
and myhostname
_trigger
, respectively, so each GDMA host can tell which file is intended for its own use. The myhostname
part may be specified in either fully-qualified or unqualified form; the GDMA client will look first for the one form and then for the other if the first is not found.
You should adopt some consistent conventions up front as to how you will install your instructions and trigger files. In particular, you don't want both fully-qualified and unqualified files for the same host to be present in the special locations known to the GDMA client, or the situation will become muddled as to which of them you intend to be in play.
In order for a discovery instructions file to be downloaded by a GDMA client and used to run a pass of discovery there, the GDMA client must find a corresponding trigger file with its last-modified timestamp later than that on the instructions file. This provides safety against race conditions when these files are copied separately into their respective known locations for pickup by the GDMA clients. If both instructions and trigger files are mentioned on the same autosetup
command line, this constraint will be automatically forced. If you use separate autosetup
commands to install instructions and trigger files, the autosetup
command for the instructions file must be run first, and running the autosetup
command that installs the trigger file afterward will ensure that its last-modified timestamp has the proper relationship to the already-existing instructions file.
Generally, you don't concern yourself any of with those details, except for understanding the proper ordering if separate autosetup
commands are used. What you care about is specifying the master files you wish to be interpreted by particular GDMA clients, and the autosetup
commands used to install your master files in the special known locations, as shown just below. (To keep the column width small in this text, we use a bash
alias so we don't need to type the full path to the autosetup
command. You can also do the equivalent by other means, such as using the full path in each invocation, or (in GW7) by adding /usr/local/groundwork/gdma/bin
to your command-search PATH
environment variable.)
Here are typical commands you might use in GroundWork 7:
alias autosetup=/usr/local/groundwork/gdma/bin/autosetup cd /path/to/my_master_stash autosetup install -p my_special_class_instructions my-gdma-hostname autosetup install -p live_action_trigger my-gdma-hostname
alias autosetup=/usr/local/groundwork/gdma/bin/autosetup cd /path/to/my_master_stash autosetup install -p my_class_instructions myhost1 myhost2 myhost3 autosetup install -p dry_run_trigger myhost1 myhost2 myhost3
docker-compose
can only be done in the .../gw8
directory used for your GroundWork 8 installation. Thus all pathnames to your master instructions and trigger files must be written to assume that they are being accessed while the gw8
directory is the current working directory, even though that will typically not be where you store your master copies of those files.alias autosetup="cd /path/to/gw8; docker-compose exec monarch /usr/local/groundwork/monarch/bin/autosetup" set stash="/path/to/my_master_stash" autosetup install -p $stash/my_special_class_instructions my-gdma-hostname autosetup install -p $stash/live_action_trigger my-gdma-hostname
alias autosetup="cd /path/to/gw8; docker-compose exec monarch /usr/local/groundwork/monarch/bin/autosetup" set stash="/path/to/my_master_stash" autosetup install -p $stash/my_class_instructions myhost1 myost2 myhost3 autosetup install -p $stash/dry_run_trigger myhost1 myhost2 myhost3
Dry Run Testing
If you have any concerns about how the discovery instructions will be interpreted on a given GDMA client, you should perform a dry-run discovery. The key part is the setting of last_step
in the trigger file:
last_step = "test_configuration"
dry_run_trigger
, as we referenced above.
When discovery results are sent from the GDMA client to the server, the registration script on the server saves them in a file. On the GroundWork server, you can probe for what happened during discovery using the following command, using the same autosetup
alias as shown above for either GW7 or GW8, respectively:
autosetup print results my-gdma-hostname
To go one step further and see what the server did during its dry-run configuration using the discovery results, use the following command, again using the autosetup
alias:
autosetup print analysis my-gdma-hostname
Live Action Configuration
To perform live-action discovery, intending for the results to affect the production configuration, the trigger file must specify that the results are to be processed all the way to the end:
last_step = "do_configuration"
live_action_trigger
, as we referenced above.
You can verify the discovery results and the configuration changes in summary form using the same autosetup
commands as we just described for a dry run.
Related Resources
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page: