3.2.22. devices get-by-hostname¶
This command lets you search for devices by hostname and export the data to CSV or JSON.
3.2.22.1. Common Options¶
Connection Options for examples of supplying the Axonius credentials and URL.
Export Options for examples of exporting data in different formats and outputs.
3.2.22.2. Common Examples¶
Get By Examples for examples that are common to all
get-by..
commands.Selecting Fields Examples for examples of selecting which fields (columns) to include in the response.
3.2.22.3. Help Page¶
3.2.22.3.1. axonshell devices get-by-hostname¶
Get assets where hostname equals value
axonshell devices get-by-hostname [OPTIONS]
Options
- -u, --url <URL>¶
Required URL of an Axonius instance
- -k, --key <KEY>¶
Required API Key (or username if credentials=True) of user in an Axonius instance
- -s, --secret <SECRET>¶
Required API Secret (or password if credentials=True) of user in an Axonius instance
- --max-rows <max_rows>¶
Stop fetching assets after this many rows have been received
- --max-pages <max_pages>¶
Stop fetching assets after this many pages have been received
- --page-size <page_size>¶
Number of assets to fetch per page
- Default:
2000
- --page-sleep <page_sleep>¶
Seconds to wait in between each fetch of a page
- Default:
0
- -xf, --export-file <PATH>¶
File to save data to (supports templating: {DATE}, {HISTORY_DATE})
- Default:
- -xp, --export-path <export_path>¶
If –export-file supplied, the directory to write –export_file to (supports templating: {DATE}, {HISTORY_DATE})
- Default:
/home/docs/checkouts/readthedocs.org/user_builds/axonius-api-client/checkouts/latest/docs
- -xo, --export-overwrite, -nxo, --no-export-overwrite¶
If –export-file supplied and it exists, overwrite it
- Default:
False
- -xb, --export-backup, -nxb, --no-export-backup¶
If –export-file supplied and it exists, rename it with datetime
- Default:
False
- --echo, --no-echo¶
Print out details during fetch
- Default:
True
- --page-progress <page_progress>¶
Print progress every N rows
- Default:
10000
- -xt, --export-format <export>¶
Formatter to use when exporting asset data
- Default:
json
- Options:
json_to_csv | table | xlsx | xml | csv | json
- -tf, --table-format <table_format>¶
Base format to use for –export-format=table
- Default:
fancy_grid
- Options:
asciidoc | double_grid | double_outline | fancy_grid | fancy_outline | github | grid | heavy_grid | heavy_outline | html | jira | latex | latex_booktabs | latex_longtable | latex_raw | mediawiki | mixed_grid | mixed_outline | moinmoin | orgtbl | outline | pipe | plain | presto | pretty | psql | rounded_grid | rounded_outline | rst | simple | simple_grid | simple_outline | textile | tsv | unsafehtml | youtrack
- --table-max-rows <table_max_rows>¶
Only return this many rows for –export-format=table
- Default:
5
- --table-api-fields, --no-table-api-fields¶
Include API related fields in table output
- Default:
False
- --schema, --no-schema¶
Add schema information to the export
- Default:
False
- --json-flat, --no-json-flat¶
Flat JSON output (one line per row)
- Default:
False
- --titles, --no-titles¶
Rename fields from internal field names to their column titles
- Default:
False
- --field-compress, --no-field-compress¶
Compress field names
- Default:
False
- --field-replace <field_replace>¶
Replace characters in field names ex: ‘text=replace’ (multiples)
- Default:
- --join, --no-join¶
Join multivalue fields using –join-value
- Default:
False
- --join-value <field_join_value>¶
Value to use for joining multivalue fields, default: n
- Default:
- --join-trim <field_join_trim>¶
Character length to trim joined multivalue fields
- Default:
32000
- -exf, --explode <FIELD>¶
Flatten and explode a fields values into multiple rows
- -exe, --explode_entities, --explode-entities, -nexe, --no-explode_entities, --no-explode-entities¶
Split rows into one row for each asset entity (will enable include-details)
- Default:
False
- --flatten, --no-flatten¶
Remove complex fields and re-add their sub-field values to the row
- Default:
False
- -fx, --field-exclude <FIELD>¶
Fields to exclude from each row (multiples)
- Default:
- --field-null, --no-field-null¶
Add missing fields with –field-null-value
- Default:
False
- --field-null-value <field_null_value>¶
Value to use for fields that are not returned
- --adapters-missing, --no-adapters-missing¶
Add a column showing adapters missing from each asset
- Default:
False
- --include-dates, --no-include-dates¶
Include history date and current date as columns in each asset
- Default:
False
- --software-whitelist-file <whitelist>¶
Read in a file of software names to add missing and delta sw columns
- --tag <TAG>¶
Tags to add to each asset (multiples)
- Default:
- -exp, --expirable_tags <expirable_tags>¶
Expirable date for tag to set in the format of tag_name=YYYY-MM-DD or tag_name=days_from_now (multiple)
- --tag-invert, --no-tag-invert¶
Only add tags to assets that do NOT match the query provided
- Default:
False
- --untag <TAG>¶
Tags to remove from each asset (multiples)
- Default:
- --untag-invert, --no-untag-invert¶
Only remove tags from assets that do NOT match the query provided
- Default:
False
- -id, --include-details, -nid, --no-include-details¶
Include details for aggregated fields
- Default:
False
- -sd, --sort-descending, -nsd, --no-sort-descending¶
Sort –sort-field descending
- Default:
False
- -sf, --sort-field <sort_field>¶
Sort assets based on a specific field
- --csv-field-flatten, --no-csv-field-flatten¶
For CSV/XLSX Export: Enable flattening of complex fields
- Default:
True
- --csv-field-join, --no-csv-field-join¶
For CSV/XLSX Export: Enable joining of list fields
- Default:
True
- --csv-field-null, --no-csv-field-null¶
For CSV/XLSX Export: Enable null values for missing fields
- Default:
True
- -anfne, --api-null-for-non-exist, -nanfne, --no-api-null-for-non-exist¶
Ask the REST API to return null for non existent fields
- Default:
False
- -afonef, --api-filter-out-non-existing-fields, -nafonef, --no-api-filter-out-non-existing-fields¶
Ask the REST API to filter out non existent fields
- Default:
True
- -amfi, --api-max-field-items <max_field_items>¶
Ask the REST API to limit the number of values returned for a field
- -amcfi, --api-complex-fields-preview-limit <complex_fields_preview_limit>¶
Ask the REST API to limit the number of values returned for a complex field
- -hd, --history-date <YYYY-MM-DD>¶
Return results for a given date in history
- -hda, --history-days-ago <history_days_ago>¶
Return results for a history snapshot N days ago
- -hex, --history-exact, -nhex, --no-history-exact¶
Date supplied in history-date or history-days-ago is an exact date
- Default:
False
- -f, --field <ADAPTER:FIELD>¶
Fields to include in the format of adapter:field (multiples)
- -fr, --field-regex <ADAPTER_REGEX:FIELD_REGEX>¶
Regular expressions of fields to include (multiples)
- -frro, --fields-regex-root-only, -nfrro, --no-fields-regex-root-only¶
Only include root fields for –field-regex
- Default:
True
- -ff, --field-fuzzy <ADAPTER:FIELD>¶
Fuzzy matching of fields to include (multiples)
- -fro, --fields-root <ADAPTER>¶
Select all root fields for a given adapter (PERFORMANCE HIT!)
- -fer, --fields-error, -nfer, --no-fields-error¶
Throw errors for invalid fields supplied in –field
- Default:
True
- -fd, --fields-default, -nfd, --no-fields-default¶
Include the default fields defined in the API library
- Default:
True
- --pre <QUERY>¶
Query to prefix the query built to search for –value
- Default:
- --post <QUERY>¶
Query to postfix the query built to search for –value
- Default:
- -nf, --not-flag, -nnf, --no-not-flag¶
Build the query as a NOT query
- Default:
False
- -v, --value <value>¶
Required Value to search for
- --help-detailed <help_detailed>¶
Show detailed help and exit
- Options:
auth | assetexport | selectfields