Run a given command on specified Opsview hosts.
Synopsis
/opt/opsview/support-scripts/bin/dosh
dosh -l
dosh -t opsview_collectors <command to run>
Description
Run a given command on a selection of the Opsview hosts by using the Ansible ‘shell’ module.
Must be run on your deployment host as the root
user. Requires the utility jq
be installed.
Options
Option | Purpose | Default |
---|---|---|
-h |
Terse help output | |
-l |
List available host groupings | |
-m <module> |
Specify the Ansible module to use | Shell |
-t <target> |
Set the host grouping to <target> |
opsview_collector:!opsview_orchestrator |
Arguments
Argument | Purpose |
---|---|
<commands to run> |
The command to run on the remote servers (or arguments to pass to the Ansible module) |
Files
File | Description |
---|---|
/opt/opsview/deploy/etc/opsview_deploy.yml |
Configuration file used by Ansible |
Examples
- Run
hostname
on all collectors:
/opt/opsview/supportscripts/bin/dosh -t opsview_collectors hostname
- Run
uptime -p
on all collectors in the cluster_fr cluster:
/opt/opsview/supportscripts/bin/dosh -t opsview_cluster_cluster_fr uptime -p
- Run
cat /opt/opsview/var/machine.ref
on all collectors but not the orchestrator:
/opt/opsview/supportscripts/bin/dosh -t 'opsview_collector:!opsview_orchestrator' cat /opt/opsview/var/machine.ref
Alternative: Ansible
You can achieve the same effects of dosh
by using Ansible on your orchestrator.
Before running any of the following commands for the first time in a shell session, you need to log in as root
and use this source
command:
source /opt/opsview/deploy/bin/rc.ansible
List available host groupings
This command requires the jq
package be installed.
ansible-inventory --list | jq -r '.opsview_all.children[]'
Run commands on hosts
ansible -m shell -a '<command>' '<hosts>'
For example, run hostname
on every Opsview host:
ansible -m shell -a 'hostname' 'opsview_all'
Comments
0 comments
Please sign in to leave a comment.