DragonFly On-Line Manual Pages

Search: Section:  


ambit(1)                        ambit man page                        ambit(1)

NAME

Ambit - Expand Host Groups OR Expand + Execute Commands

SYNOPSIS

ambit [AmbitExpandableString] ambit hostfile ambit /path/to/hostfile ambit [UserHostGroup] ambit [SystemHostGroup] ambit [NetworkHostGroup] ambit [ list | create ] hostgroup ambit [ edit | remove ] hostgroup [HostGroupName] ambit command [AmbitExpandableString]

DESCRIPTION

Ambit at its simplest uses Bash Brace Expansion to expand and list hostnames OR commands. Ambit is first and foremost meant to be a general purpose hostlist enumerator for use by other applications or scripts. Additionally Ambit can be used to manage hostgroups specific to a single user or accessible to all users on a system or queryable from anywhere on the network. Finally, Ambit is able to detect when it is passed a command on the command line, allowing for the command to be expanded into separate commands that are then executed in serial. This means Ambit can expand and run just about anything on the command line and usually works in places where Bash Brace Expansion will fail. Ambit allows for hosts to be enumerated from a number of different places including directly on the command line (via an Ambit expandable string), a file in the current working directory ($PWD), a file whose path is specified, user pre-defined hostgroups, system pre-defined hostgroups and network defined hostgroups. CLI Argument Ambit will accept an expandable string on the command line and expand that string into either hosts or hostgroups. If any part of a string expands to a hostgroup, Ambit will then enumerate the hostgroup along with any other hosts/hostgroups that may also result from expansion. File in $PWD If a file happens to be in a user's $PWD and has either Ambit expandable strings or hostnames, it can be passed to Ambit as an argument and Ambit will expand it. File Path Ambit will accept the full path to a file with Ambit expandable strings or hostnames that it will enumerate. User Hostgroups Ambit will enumerate Ambit expandable strings or hostnames by a designated name created with 'ambit create hostsgroup' or manually and located in the directory $HOME/.ambit/hosts. System Hostgroups Ambit will enumerate Ambit expandable strings or hostnames by a designated name created as root via 'ambit create hostsgroup' or manually and located in the directory /var/ambit/hosts. Network Hostgroups Ambit will enumerate Ambit expandable strings stored in DNS TXT records at a domain specified in the Domain="" option.

OPTIONS

HostGroup Controls list hostgroups List all User, System and Network Hostgroups. Name and Description are displayed. create hostgroup Create a new Hostgroup. If executing Ambit with root privileges the Hostgroup will be created as a System Hostgroup, otherwise it will be a User Hostgroup. remove hostgroup Remove a User or System Hostgroup. edit hostgroup Edit an existing User or System Hostgroup. Option Controls list options List both System and User Tunable Options. edit option Edit or Set a User Option. User options override System Options.

SHORT COMMANDS

Ambit supports an abbreviated subcommand syntax: ambit list hgroups ambit show hgroups ambit ls hgs ambit create hostgroup ambit add hgroup ambit add hg ambit cr hg ambit edit hostgroup [HostGroupName] ambit ed hg [HostGroupName] ambit remove hostgroup [HostGroupName] ambit del hgroup [HostGroupName] ambit rm hg [HostGroupName]

SPECIAL HOSTGROUP

There is a special System HostGroup called 'down' (/var/ambit/hosts/down) that is installed and left empty by default. This group is meant to provide a dynamic, near realtime listing of hosts that have been determined to be unreachable from the local host for one reason or another. Reasons can range from, a host or hosts in 'down' have failed specific monitoring check or failed the last periodic ping check or someone with root privileges has decided that it is down. If a host happens to be currently listed in the System HostGroup 'down' AND a user has a User HostGroup named down ($HOME/.ambit/hosts/down) Ambit will omit the host from all results for that user. In other words, users can choose whether they want to honor the current list of unreachable hosts according the local host. To do so they simple have to create the HostGroup down with no hosts listed. The existence of this group tells Ambit to honor the System HostGroup 'down'. 'down' $ sudo ambit create hostgroup HostGroup Name : down HostGroup Summary : System Wide Unreachable Hosts Enter Hostnames Below [Ctrl-d to End]: test1.mydomain.org $ ambit list hostgroups | grep down down: System Wide Unreachable Hosts $ ambit down test1.mydomain.org $ ambit create hostgroup HostGroup Name : mydomain HostGroup Summary : Production mydomain.org Servers Enter Hostnames Below [Ctrl-d to End]: test[1..12].mydomain.org $ ambit mydomain test1.mydomain.org test10.mydomain.org test11.mydomain.org test12.mydomain.org test2.mydomain.org test3.mydomain.org test4.mydomain.org test5.mydomain.org test6.mydomain.org test7.mydomain.org test8.mydomain.org test9.mydomain.org $ ambit create hostgroup HostGroup Name : down HostGroup Summary : Honoring System HostGroup 'down' Enter Hostnames Below [Ctrl-d to End]: $ ambit list hostgroups System HostGroups ------------------ down: System Wide Unreachable Hosts User HostGroups ---------------- mydomain: Production mydomain.org Servers down: Honoring System HostGroup 'down' $ ambit mydomain test10.mydomain.org test11.mydomain.org test12.mydomain.org test2.mydomain.org test3.mydomain.org test4.mydomain.org test5.mydomain.org test6.mydomain.org test7.mydomain.org test8.mydomain.org test9.mydomain.org $ sudo ambit edit hostgroup down # # Summary - System Wide Unreachable Hosts # test1.mydomain.org test10.mydomain.org test11.mydomain.org test12.mydomain.org $ ambit mydomain test2.mydomain.org test3.mydomain.org test4.mydomain.org test5.mydomain.org test6.mydomain.org test7.mydomain.org test8.mydomain.org test9.mydomain.org

EXAMPLES

Listing All Enumerable HostGroups $ ambit list hostgroups Network Host Groups ------------------- svn: descriptive text "web[1..3].mydomain.org" yum: descriptive text "web[4..6].mydomain.org" web: descriptive text "web[7..50].mydomain.org" System Host Groups ------------------ down: System Wide Down Hosts admin: All Admin Hosts User Host Groups ---------------- aff: Test Group For Expansion latest: The Latest Hotness in Hosts stuff: Stuff and Thing Listing Configurable Options $ ambit list options System Options -------------- WeLogin="yes" YouMask="0077" Random="$RANDOM" AllFiles="/var/$MyNameIs" UsrFiles="$HOME/.$MyNameIs" AllConf="/etc/$MyNameIs/$MyNameIs.conf" UsrConf="$HOME/.$MyNameIs.conf" Domain="" User Options ------------ Domain="mydomain.org" Creating, Listing and Expanding a HostGroup $ ambit create hostgroup Host Group Name: manpage Host Group Description: Sweet HostGroup For Ambit's ManPage Enter Hostnames Below [Ctrl-d to End]: manpage[1..5].mydomain.org manpage7.mydomain.org manpage10.mydomain.org $ ambit list hostgroups | grep manpage manpage: Sweet HostGroup For Ambit's ManPage $ ambit manpage manpage10.mydomain.org manpage1.mydomain.org manpage2.mydomain.org manpage3.mydomain.org manpage4.mydomain.org manpage5.mydomain.org manpage7.mydomain.org Mixing HostGroups and Expandable Strings $ ambit [manpage,aff,ns[1..4].google.com] 1.a.ff 2.a.ff 3.a.ff manpage10.mydomain.org manpage1.mydomain.org manpage2.mydomain.org manpage3.mydomain.org manpage4.mydomain.org manpage5.mydomain.org manpage7.mydomain.org ns1.google.com ns2.google.com ns3.google.com ns4.google.com Expanding Commands $ ambit host -t ns [google,facebook,twitter].com facebook.com name server ns1.facebook.com. facebook.com name server ns2.facebook.com. facebook.com name server ns3.facebook.com. facebook.com name server ns4.facebook.com. facebook.com name server ns5.facebook.com. google.com name server ns1.google.com. google.com name server ns2.google.com. google.com name server ns3.google.com. google.com name server ns4.google.com. twitter.com name server ns1.p34.dynect.net. twitter.com name server ns2.p34.dynect.net. twitter.com name server ns3.p34.dynect.net. twitter.com name server ns4.p34.dynect.net. $ ambit sudo /sbin/service [httpd,postfix,named] restart Stopping httpd: [ OK ] Starting httpd: [ OK ] Shutting down postfix: [ OK ] Starting postfix: [ OK ] Stopping named: [ OK ] Starting named: [ OK ] $ ambit lastlog -u [$(grep Wheel /etc/group |sed -e 's/W.*//g')] Username Port From Latest bill ttyp3 cpe-76-87-95-166 Thu Jul 29 08:48:33 -0700 2010 doug ttyp0 99-64-251-98.lig Fri Oct 22 14:47:48 -0700 2010 felipe ttyp0 pool-108-41-38-2 Sun Mar 20 16:52:36 -0700 2011 james **Never logged in** john **Never logged in** kurtis **Never logged in** mm pts/3 cpe-76-171-101-9 Sat Jul 9 02:31:50 -0700 2011 sara **Never logged in** shaun **Never logged in** shomari **Never logged in** victor **Never logged in** zack **Never logged in** ^^ Listing for the last time the members of the Wheel group logged in (if ever).

BUGS

Fleas, Adam Had 'em.

AUTHOR

Mike Marschall (mm@a.tt) 2.0 08 Jul 2011 ambit(1)

Search: Section: