Tools and Files for Auto Setup
This page provides details about tools and files you will encounter while using GDMA Auto Setup.
The autosetup Tool
The autosetup
program is designed to handle the most common tasks in a simple way. Aside from your favorite editor, which will be used to construct the content of instructions and trigger files, it is the central server-side tool for managing all interactive aspects of GDMA Auto Setup.
autosetup Commands
Many of these commands take a list of hostnames as arguments and look for filenames with those hostnames embedded. Such commands normally look for files under an alternative form of each hostname if an exact match is not found. If you want to control which hostname alternatives are considered, you may specify one of the following options:
-e
to only allow an exact match to the hostname(s) given-f
to only allow a fully-qualified hostname as an alternative match-u
to only allow an unqualified hostname as an alternative match
Command | Use |
---|---|
|
Lists the status of all the files for the named hosts, in a compact form. This is used to answer the questions:
Use the |
|
Checks that the listed instructions, trigger, or results files pass validation tests (are parseable, have the right collections of content, etc.). This can help in particular when preparing auto-discovery instructions files, before putting them into play for the GDMA clients to pick up. |
|
Safely installs the In general, you will want to keep a collection of standard trigger files in your master stash for common purposes, such as for dry-run discovery-only, dry-run discovery-and-test-configuration, and live-run discovery. See Examples of Auto Setup for examples of such files. These standard trigger files can then be copied using this command as needed for individual hosts. |
|
Safely installs the named instructions and/or trigger files to their respective configured locations for pickup by GDMA clients. A careful protocol is used for this copying, taking care of atomicity and timestamp concerns. That sidesteps the race conditions that would otherwise arise when a new or updated file is being installed while the GDMA client might be trying to read the same file. In this form of the command, each listed file must exist and be appropriately named, the acceptable forms being either |
|
Finds and prints the last discovery results for the named hosts. The |
|
This command is not yet implemented. Finds and analyzes the last discovery results for the named hosts. The -e, -f, and -u options act as noted above. |
|
Finds and prints the last discovery results analyses for the named hosts. The |
|
This command is not yet implemented. Compares current configuration with the last discovery results for the named hosts. The This command is intended to execute a dry-run reconfiguration of the specified hosts based on their respective last auto-discovery results, and identify any current differences from that setup. These differences could be used to identify mistakes or unintended outside-the-box changes, or they could be ripe for inclusion in the auto-discovery instructions. They could also be used to identify what changes might come into play because host and service profiles and other server-side changes have been modified, and a new round of live-action auto-setup would change the configuration even if the auto-discovery results themselves were unchanged. |
|
Removes all instructions, trigger, results, and analysis files for the named hosts, from their respective configured directories. The |
|
Print the help message (i.e., a form of the same material as in the section you are reading). |
|
Print the program version. |
autosetup Examples
Command | Use |
---|---|
|
This will find all related files and print last-modified timestamps for them. |
|
autosetup install -p my_standard_instructions host1 host2 host3 autosetup install -p standard_test_only_trigger host1 host2 host3 These two commands will copy |
autosetup Usage Notes
From the page Managing Auto Setup, see the the sections Invoking the autosetup Command and Installing Instructions and Trigger Files for how to run autosetup
in GW7 and GW8 contexts. In general, you want to have a shell alias defined, as shown in the latter of those two sections.
- Hostnames are generally supposed to be case-insensitive, but all of the handling of hostnames by this tool is case-sensitive. If you wish to know exactly what lettercase forms of hostnames are currently in play, use the
autosetup status -a
command. There is an important caveat about installing files to be fetched by GDMA clients. For an instructions file to be recognized by a GDMA client, you must install a trigger file for a given host after that instructions file is installed for that host. Otherwise, the client will think that the trigger applies to some earlier copy of the instructions. In the worst case it might immediately find the trigger before you install updated instructions, and run discovery using an older copy of the instructions than the one you wanted it to use — not a scenario you want to find yourself in.
The two types of file can be installed in tandem, if desired, by specifying both of them on the "autosetup install file1 file2
" command form. However, in that case, the filenames used must be exactlyhostname_instructions
andhostname_trigger
. In general, you will not be managing your master instructions and trigger files on a host-by-host basis like that. Instead, you will keep around just a few master instructions files and a few trigger files, and you will use these two commands in sequence to install them for particular hosts:autosetup install -p my_standard_instructions host1 host2 host3 autosetup install -p my_standard_trigger host1 host2 host3
If you have already run auto-discovery on some hosts and simply want to trigger a new pass of discovery on those hosts using the same instructions file, it is not necessary to re-install the instructions file. You simply need to re-install the trigger file, which will update its timestamp so the GDMA client will recognize that a new pass of discovery has been requested.
autosetup install -p my_standard_trigger host1 host2 host3
That said, there is no harm in re-installing the instructions file first, and you might want to adopt that habit to ensure that you are always using the intended instructions when running a pass of discovery.
- See the page Practical Advice for Auto Setup under the section Best Practices for advice on where to store your master instructions and trigger files, as well as other recommendations about how to manage them.
The discover Tool
discover
is a program provided on the GDMA client that allows you to interactively and immediately run a pass of discovery. This can help when you are developing new sensor definitions.
discover Commands
Command | Use |
---|---|
|
Run a pass of discovery, using the specified trigger and instructions files.
Diagnostic information will always be written to the standard output stream, to help with understanding the parsing and execution of the trigger and instructions files. If the If both the |
| Print the help message (i.e., a form of the same material as in the section you are reading). |
| Print the program version. |
If you try to send results to the server but the last_step
value in the trigger file is not at least send_results
, the discover
tool will complain that the discovery results had an inappropriate last_step
value, due to the mismatch of expectations. It's not that the value was illegal, it's that it was inappropriate for the use you appear to be wanting to put it to. Use a trigger file with different content if you run into this.
The auto_wrapper Tool
The auto_wrapper
tool runs on the system where GroundWork 8 is installed, as the user that installed it (the user in the docker group), and allows you to run Auto Setup commands without the need to be in the docker container. This tool also provides the capability to copy the files autosetup needs in order to function, such as instructions, triggers, and profiles into place so that they can be picked up by the agents.
auto_wrapper Options
Usage:
auto_wrapper.pl -directory /path/to/files/ -hosts /path/to/hosts.txt -import -install trigger/pattern_name -validate -remove -results -analysis -help -h -version
Where:
-directory
Contains the full path to the automation subdirectories:profiles/
The directory containing GroundWork Monitor profilestrigger/
The trigger files for GDMA Auto Setupinstructions/
The instructions files for GDMA Auto Setup- Example (used with
-import
):./auto_wrapper.pl -import -directory /home/gwos/autosetuplinux/
-import
Imports profiles, trigger files, and instructions into the monarch container- Requires
-directory
- Example:
./auto_wrapper.pl
-import -directory /home/gwos/autosetuplinux/
- Requires
-install
Installs instructions and trigger files for the specified pattern, for example, winpattern or linuxpattern- Requires
-hosts
- Example:
./
auto_wrapper.pl -install linuxpattern -hosts /home/gwos/autosetuplinux/hosts.txt
- Requires
-validate
Validates instructions for the specified pattern, for example, winpattern or linuxpattern- Combined with -import to validate instructions directly after install
- Example:
./auto_wrapper.pl -import -directory /home/gwos/autosetuplinux/ -validate
-remove
Removes Auto Setup configuration from hosts in the host list- Requires
-hosts
- Example:
./auto_wrapper.pl -remove /home/gwos/autosetuplinux/hosts.txt
- Requires
-results
Prints sensor results of GDMA Auto Setup- Requires
-hosts
- Example:
./auto_wrapper.pl -results -hosts /home/gwos/autosetuplinux/hosts.txt
- Requires
-analysis
Prints sensor analysis of GDMA Auto Setup- Requires
-hosts
- Example:
./auto_wrapper.pl -analysis -hosts /home/gwos/autosetuplinux/hosts.txt
- Requires
-version
Prints version information- Example:
./auto_wrapper.pl -version
- Example:
-help
Prints help information- Example:
./auto_wrapper.pl -help
- Example:
An Example Workflow
Go to the Downloads page under the Tools section to download the auto_wrapper ansible playbook tool, expand the file and place it in the home directory of the
gwos
user (e.g.,/home/gwos
, or other user that was created during your GroundWork installation).Change to the directory where the
auto_wrapper.pl
resides, and run the following status command to ensure a valid output in the form of a (likely empty) table is returned:cd /home/gwos/autosetuplinux ./auto_wrapper.pl -status
CODEAdjust
instructions/linuxpattern_instructions
if desired:cd /home/gwos/autosetuplinux/instructions vi linuxpattern_instructions
CODEAdjust
instructions/linuxpattern_trigger
if desired:cd /home/gwos/autosetuplinux/trigger vi linuxpattern_trigger
CODEAdd desired hosts by DNS name to
hosts.txt
, one host per line in the file is all that is required here:cd /home/gwos/autosetuplinux vi hosts.txt
CODE- If using new services (not already existing in your GroundWork Monitor instance), copy the profile XML to the profiles directory.
Import the instructions, triggers, and profiles with the following:
cd /home/gwos/autosetuplinux ./auto_wrapper.pl -import -directory /home/gwos/autosetuplinux/
CODEInstall the instructions and trigger file for a host:
./auto_wrapper.pl -hosts /home/gwos/autosetuplinux/hosts.txt -install linuxpattern
CODEEnsure the status returns an install time for instructions and trigger for the new host:
./auto_wrapper.pl -status
CODE- Install GDMA on the host, selecting Auto Setup as the installation option.
Check status again after installation, the host should now have a timestamp for the results and analysis columns:
./auto_wrapper.pl -status
CODEIf desired, more detail on the results and analysis can be found using the following:
./auto_wrapper.pl -hosts /home/gwos/autosetuplinux/hosts.txt -results
CODEor
./auto_wrapper.pl -hosts /home/gwos/autosetuplinux/hosts.txt -analysis
CODE
Using the Ansible Playbook for Automated GDMA Installation
Ansible is a powerful tool for automation, we'll use it to install GDMA, and when combined with Auto Setup, you can monitor all of the services within your Linux environment without having to assign profiles manually to hosts, or even check to see which hosts are running what software. The provided playbook will allow you to install or uninstall GDMA on a host via shared-key authentication. You can use this process of uninstall and install to upgrade all of your agents.
Prerequisites
- Ansible playbook in Downloads
- Ansible installed on the host and accessible by the user which is running it
- Shared-key authentication to the host(s)
- 64-bit Linux is the only architecture currently supported by this playbook
- The endpoint we install GDMA on must have python2 installed. It is possible to install python2 using Ansible to allow you to use the more advanced functions required for this playbook
- If this is a requirement for your environment, please see the Ansible documentation under Managed Node Requirements, or contact GroundWork Support for an example
Steps
- Adjust
hosts.ini
:- Under the [linux] directive, input the list of hosts, one per line, using the DNS name of the hosts you wish to install GDMA.
- Under the [linux:vars] directive, input the path to your SSH shared-key (e.g.,
ansible_ssh_private_key_file=/home/ubuntu/.ssh/mykey.pem
). - Under the
[linux:vars]
directive, input the user (which must have sudo rights to install GDMA) (e.g.,ansible_ssh_user=ec2-user
).
- Update the agent (if necessary):
- Change directory to the agents directory.
- Copy the download link of the latest version of 64-bit GDMA.
- Download the agent to the system (e.g.,
wget [download link]
). Make the installer executable:
chmod +x groundworkagent-*.run
CODE
- Adjust agents/options.txt file:
- The options
gdma_target_server
,gdma_autoregistration_username
, andgdma_autoregistration_password
should be adjusted for your environment - Further customization of this file is possible, but not necessary to ensure the playbook runs in the context of Auto Setup, but will require adjustment should you choose to use Auto Registration instead (such as specifying a host profile)
- The options
- Run the playbook
To install GDMA, run:
ansible-playbook -i hosts.ini main.yml --extra-vars 'use_hosts=linux install=true'
CODETo uninstall GDMA run:
ansible-playbook -i hosts.ini main.yml --extra-vars 'use_hosts=linux uninstall=true'
CODE
Registration Script and Config File
Server-side actions for GDMA Auto Setup are undertaken by the registerAgentByDiscovery.pl
script, which has an accompanying register_agent_by_discovery.conf
config file. There may be a need to adjust options in the configuration file.
Related Resources
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page:
-
Page: