Facter for BMC Discovery
tw_facter
is a tool which provides facts about BMC Discovery Appliance in JSON format.
tw_facter
can provide following information:
kind | description |
---|---|
appliance | info about BMC Discovery appliance |
cluster | info about cluster service |
custom | custom facts defined in ~/.tw_facter_custom |
cores | info about cores files |
discovery | info about discovery like exclude ranges, scheduled runs or processing runs |
env | env variables |
facter | info about tw_facter |
jdbc | info about jdbc |
metadata | some metadata |
omninames | info about omninames service |
options | tw_options |
rpms | info about rpms |
security | tw_secopts |
services | tw_service_control |
system | info about OS |
taxonomy | info about taxonomy |
users | info about users |
vault | info about credentials |
windows | info about windows, pools and proxies |
- by default it does expect
tw_facter
user withPublic, System
permissions and password file in/usr/tideway/.tw_facter_passwd
- other (not mandatory, but highly recommended) tool -> see below
mkdir -p /usr/tideway/bin-custom/
wget https://raw.githubusercontent.com/mjaromi/tw_facter/master/tw_facter.py -O /usr/tideway/bin-custom/tw_facter.py
chmod +x /usr/tideway/bin-custom/tw_facter.py
ln -s /usr/tideway/bin-custom/tw_facter /usr/tideway/bin/tw_facter
tw_facter_passwd_file=/usr/tideway/.tw_facter_passwd
tw_facter_passwd=$(openssl rand -base64 12 | tee ${tw_facter_passwd_file})
tw_adduser --fullname=tw_facter --groups=public,system --password=${tw_facter_passwd} --no-force-password-change tw_facter
chmod 644 ${tw_facter_passwd_file}
chown tideway.tideway ${tw_facter_passwd_file}
wget -q https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -O /usr/tideway/bin-custom/jq
chmod +x /usr/tideway/bin-custom/jq
ln -s /usr/tideway/bin-custom/jq /usr/tideway/bin/jq
By default you can run it just like this and it will provide all kinds mentioned above.
tw_facter
Show tw_facter
version:
tw_facter -v
Dry run:
tw_facter -d
Dry run with some kinds:
tw_facter -d -k services appliance discovery
tw_facter | jq '.services'
or
tw_facter -d -k services | jq
tw_facter | jq '.custom'
or
tw_facter -d -k custom | jq
tw_facter | jq -r '.users | with_entries(.value |= .user.state)'
or
tw_facter -d -k users | jq -r '.users | to_entries[] | "\(.key) - \(.value | .user.state)"'
tw_facter | jq -r '.users | to_entries[] | "\(.key), \(.value | .fullname), \(.value | .user.state)"'
or
tw_facter -d -k users | jq -r '.users | to_entries[] | "\(.key), \(.value | .fullname), \(.value | .user.state)"'
tw_facter | jq '.vault'
or
tw_facter -d -k vault | jq
tw_facter | jq '.vault[] | select(.types[] == "sql")'
or
tw_facter -d -k vault | jq '.vault[] | select(.types[] == "sql")'