Script Usage¶
Simple Usage¶
$ ./csv_to_static_groups.py sample_csv.csv -u administrator
Script Options¶
Required Arguments (In positional order)
|
Path to input csv |
Optional arguments. Text between quotations indicates user specified content.
|
Show options. |
|
Turbonomic Username, Password will be prompted. |
|
Base64 encoded credentials. Use this to provide all credentials without entering a password each time. |
|
Turbonomic server address. Default=localhost |
|
Prevents adding entities when updating groups |
|
Prevents removing entities when updating groups |
|
Delete groups that match csv |
|
Match entity names without case-sensitivity |
|
String to separate grouping values. Default=’_’ |
|
CSV Headers to group on. By default all columns except ‘Entity Type’ and ‘Entity Name’ are used in order from left to right |
|
Prevents commits to the Turbonomic server |
|
Disable warning output to console |
|
Suppress output to console |
|
Path to file record log entries |
|
Suppress insecure HTTPS request warnings |
|
Path to JSON Config file with arguments |
† encoded_creds can be generated with this command (Remember to disable console history so the credentials are not stored):
$ echo -n "username:password" | base64
Using a Config File¶
All options can be specified in a single json formatted file for quick option configurations.
Options passed with a config file will override any overlapping CLI arguments.
An example config file could be:
sample_config.json:
{
"encoded_creds":"dXNlcm5hbWU6cGFzc3dvcmQ=",
"target": "some_ip",
"case_insensitive": true,
"quiet": true,
"log": "/somepath/logfile.log"
}
Then run it with:
$ ./csv_to_static_groups.py sample_csv.csv --config sample_config.json
Importing As A Module¶
csv_to_static_groups can be imported to create your own CSV to static group script, create/update/delete static groups without a csv, or incorporate the main csv_to_static_groups function anywhere within your script.
import vmtconnect
import csv_to_static_groups
conn = vmtconnect.VMTConnection(host='localhost', username='austin',
password='*****')
my_group = csv_to_static_groups.StaticGroup(conn, "My Group", "VirtualMachine",
["SampleVM1", "SampleVM2"])
my_group.add_or_update(lookup_names=True)
Please reference the developer interfaces documentation and code examples.