Back to Opsview FAQ

Dosh

Run a given command on specified Opsview hosts.

Synopsis Copied

/opt/opsview/support-scripts/bin/dosh
dosh -l
dosh -t opsview_collectors <command to run>

Description Copied

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 Copied

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 Copied

Argument Purpose
<commands to run> The command to run on the remote servers (or arguments to pass to the Ansible module)

Files Copied

File Description
/opt/opsview/deploy/etc/opsview_deploy.yml Configuration file used by Ansible

Examples Copied

  1. Run hostname on all collectors:
/opt/opsview/supportscripts/bin/dosh -t opsview_collectors hostname
  1. Run uptime -p on all collectors in the cluster_fr cluster:
/opt/opsview/supportscripts/bin/dosh -t opsview_cluster_cluster_fr uptime -p
  1. 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 Copied

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 Copied

This command requires the jq package be installed.

ansible-inventory  --list | jq -r '.opsview_all.children[]'

Run commands on hosts Copied

ansible -m shell -a '<command>' '<hosts>'

For example, run hostname on every Opsview host:

ansible -m shell -a 'hostname' 'opsview_all'
["Geneos"] ["FAQ"]

Was this topic helpful?