Note
This project is under active development. Please remember to check for new releases often.
Hyperview CLI (hvcli) is a command-line program for interacting with data in Hyperview.
** Important Reminders **
- Powerful Capabilities: This tool can make modify data in Hyperview. Please take the time to familiarize yourself with its features.
- Check Twice, Act Once: Ensure that all your inputs are accurate. A small oversight can lead to unintended consequences.
- Test with a small sample first: Test and verify bulk changes with a small sample before making big changes.
Your success is important to us! Enjoy using the Hyperview CLI (hvcli), and remember to proceed with caution!
To use this tool, simply download a pre-built binary from the Releases section.
A valid Hyperview API client must be used. The API client must have the appropriate access. The configuration file must be placed in $HOME/.hyperview/hyperview.toml
client_id = 'c33472d0-c66b-4659-a8f8-73c289ba4dbe'
client_secret = '2c239e21-f81b-472b-a8c3-82296d5f250d'
scope = 'HyperviewManagerApi'
auth_url = 'https://example.hyperviewhq.com/connect/authorize'
token_url = 'https://example.hyperviewhq.com/connect/token'
instance_url = 'https://example.hyperviewhq.com'Run the command with the --help option to get usage information.
hvcli --helpList all available properties for an asset identified by its unique id.
List all available custom properties for an asset identified by its unique id.
Search for assets in Hyperview.
List assets that match a specific set of property values. For example, a list of serial numbers. Please note that the matches are exact.
Update the display name of an asset identified by its unique id.
Update multiple assets from a CSV file. Example data is in the example_input folder.
Update the location of an asset identified by its unique id.
Update the location of multiple assets from a CSV file. Example Data is in the example_input folder.
Update the serial number of an asset identified by its unique id. Applies to manually created assets and assets discovered without a serial number.
Update the serial numbers of multiple assets from a CSV file. Applies to manually created assets and assets discovered without a serial number. Example data is in the example_input folder.
Update the asset tag of an asset identified by its unique id.
Update the asset tag of multiple assets from a CSV file. Example data is in the example_input folder.
Update the power design value property of an asset identified by its unique id. This applies to Rack and Location asset types.
Update the power “design value” property of multiple assets from a CSV file. This applies to Rack and Location asset types. Example data is in the example_input folder.
List the physical network ports of an asset identified by its unique id.
Update the physical network port names of patch panel assets from a CSV file. Example data is in the example_input folder.
Update the physical network port names of other (non-patch-panel) assets from a CSV file, E.g. a network switch. Example data is in the example_input folder.
Update the value of a custom property of an asset identified by its unique id.
Update the custom property value of multiple assets using a CSV file. Example data is in the example_input folder.
List alarm events. By default, it will list active events. It can also list unacknowledged events via a command-line option.
Acknowledge or close alarm events using a CSV file generated by the list-alarms command. By default, this command closes the events; it can also acknowledge them via a command-line option.
Add a blanking panel or cable management panel to a rack identified by its unique id.
Add blanking panels or cable management panels to multiple racks using a CSV file. Example data is in the example_input folder.
List sensors for an asset identified by its unique id.
Update asset sensor name and/or access policy using a CSV file. IMPORTANT: Keep the access policy field empty to maintain the original and only change the name. Use a NIL UUID (00000000-0000-0000-0000-000000000000) to reset to the parent access policy. Example data is in the example_input folder.
List Rack PDU outlets for an asset identified by its unique id.
List busway tap-offs for an asset identified by its unique id.
List PDU/RPP Breakers for an asset identified by its unique id.
Add power association. Note that associations are asset-to-asset. For example, when associating with a specific outlet or tap-off, you need its id.
Add power associations between assets using a CSV. Example data is in the example_input folder.
Note
Use --help to explore the various options available within the main command and each subcommand.
Every command has a --help option for more information.
$ hvcli list-alarms --help
List alarm events
Usage: hvcli list-alarms [OPTIONS]
Options:
-s, --skip <SKIP> Number of records to skip (0 -> 99999), e.g. 100 [default: 0]
-l, --limit <LIMIT> Record limit (1 -> 100000), e.g. 100 [default: 100]
-a, --alarm-filter <ALARM_FILTER> Asset alarm event filter option, e.g. active [default: active] [possible values: unacknowledged, active]
-o, --output-type <OUTPUT_TYPE> Output type, e.g. csv-file [default: record] [possible values: csv-file, json, record]
-f, --filename <FILENAME> Output filename, e.g. output.csv
-h, --help Print help
-V, --version Print version
$ hvcli manage-alarms --help
Acknowledge or close alarm events using CSV file output from the list-alarms command
Usage: hvcli manage-alarms [OPTIONS] --filename <FILENAME>
Options:
-f, --filename <FILENAME> Input filename, e.g. port_name_update.csv
-m, --manage-action <MANAGE_ACTION> Manage action to use, e.g. close [default: close] [possible values: acknowledge, close]
-h, --help Print help
-V, --version Print versionFor troubleshooting, a master debug level can be set using -d or --debug-level.
Some commands allow the user to set the output to record, json or csv-file. Refer to the command help for more information.
$ hvcli search-assets -P serialNumber=SERIALNUMBEREXAMPLE1234 -o json
[
{
"id": "\"58af63dc-1e9e-4b8b-b2b7-e0451aaca8fb\"",
"name": "\"UpsExample\"",
"assetLifecycleState": "\"Active\"",
"assetTypeId": "\"Ups\"",
"manufacturerId": "\"cd85e92d-869c-470a-a3ba-df8b2b7196e3\"",
"manufacturerName": "\"Liebert\"",
"monitoringState": "\"On\"",
"parentId": "\"9a877a93-1f21-4895-a078-5c67f531ea0b\"",
"parentName": "\"Simulated SNMP Devices\"",
"productId": "\"aedbd4b9-06ae-4768-ba4a-64847b60d334\"",
"productName": "\"eXM\"",
"status": "\"Normal\"",
"path": "\"All/Simulated SNMP Devices/UpsExample\"",
"serialNumber": "[\"SERIALNUMBEREXAMPLE1234\"]"
}
]
$ hvcli search-assets -p "UpsExampl*"
---- [0] ----
id: "58af63dc-1e9e-4b8b-b2b7-e0451aaca8fb"
name: "UpsExample"
asset_lifecycle_state: "Active"
asset_type_id: "Ups"
manufacturer_id: "cd85e92d-869c-470a-a3ba-df8b2b7196e3"
manufacturer_name: "Liebert"
monitoring_state: "On"
parent_id: "9a877a93-1f21-4895-a078-5c67f531ea0b"
parent_name: "Simulated SNMP Devices"
product_id: "aedbd4b9-06ae-4768-ba4a-64847b60d334"
product_name: "eXM"
status: "Normal"
path: "All/Simulated SNMP Devices/UpsExample"
serial_number: ["SERIALNUMBEREXAMPLE1234"]$ hvcli search-assets -p "UpsExample" --location-path "All/Simulated SNMP Devices/" -M "Liebert" -o json
[
{
"id": "\"58af63dc-1e9e-4b8b-b2b7-e0451aaca8fb\"",
"name": "\"UpsExample\"",
"assetLifecycleState": "\"Active\"",
"assetTypeId": "\"Ups\"",
"manufacturerId": "\"cd85e92d-869c-470a-a3ba-df8b2b7196e3\"",
"manufacturerName": "\"Liebert\"",
"monitoringState": "\"On\"",
"parentId": "\"9a877a93-1f21-4895-a078-5c67f531ea0b\"",
"parentName": "\"Simulated SNMP Devices\"",
"productId": "\"aedbd4b9-06ae-4768-ba4a-64847b60d334\"",
"productName": "\"eXM\"",
"status": "\"Normal\"",
"path": "\"All/Simulated SNMP Devices/UpsExample\"",
"serialNumber": "[\"SERIALNUMBEREXAMPLE1234\"]"
}
]cargo build
The binary will be under target/debug/hvcli.
cargo build --release
The binary will be under target/release/hvcli.
Install the x86_64-unknown-linux-musl target and run the command to build a statically-linked version:
PKG_CONFIG_SYSROOT_DIR=/ RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-unknown-linux-musl --release
docker build --tag hvcli:latest -f docker/Dockerfile .
To run the Docker image generated, you need to:
- Map the application configuration directory to the container.
- Optional, map an output folder to the container
Assuming the username is albert
docker run -v /home/albert/.hyperview:/root/.hyperview hvcli search-assets
If you are planning to output to csv
docker run -v /home/albert/.hyperview:/root/.hyperview -v /tmp:/output hvcli search-assets -o csv-file -f /output/assets.csv