Storage Capacity: example

Storage Capacity API Export Example - How It Works
This Node.js script storage_capacity_api.zip demonstrates how to use our Public API to export storage capacity data to CSV format.

Prerequisites & Setup

  • Node.js (v20 or newer recommended)
  • Network access to your XORMON instance
  • Valid Public API credentials
Command Line Usage:
node storage_capacity_api.js <username> <password> <filename.csv>
SSL Configuration: Script handles self-signed certificates (configurable)
Server Configuration: Update the server variable to point to your XORMON instance
Subsystem Selection: Choose what type of storage items to query (device, pool, volume, etc.) //changes are made inside file in variable subsystem

Workflow Overview:

  1. Authentication
    • Sends POST request to /api/public/v1/auth endpoint
    • Exchanges username/password for an API key
    • API key is used for all subsequent requests
  2. Item Discovery with Pagination
    • Queries /api/public/v1/architecture/search endpoint
    • Fetches all storage items matching the specified subsystem and class
    • Handles pagination automatically (50 items per page)
    • Continues fetching until all items are retrieved
  3. Capacity Data Export
    • Calls /api/public/v1/exporter/capacity endpoint
    • Sends all discovered item IDs in a single request
    • Requests data in CSV format for easy processing
    • Returns comprehensive capacity metrics for all items
  4. File Output
    • Writes the CSV data directly to the specified filename
    • Creates a ready-to-use spreadsheet with capacity information

Key Features

  • Automatic Pagination: Handles large datasets by fetching data in chunks
  • Error Handling: Comprehensive error messages for troubleshooting
  • Flexible Configuration: Easy to modify for different subsystems or servers
  • CSV Output: Standard format compatible with Excel, databases, and analysis tools
  • Secure Authentication: Uses API key-based authentication after initial login

Use Cases

  • Capacity Planning: Regular exports for trend analysis
  • Reporting: Automated data collection for executive dashboards
  • Integration: Feed capacity data into external monitoring systems
  • Backup Documentation: Periodic snapshots of storage utilization
This example showcases the power of our Public API for automated data extraction and integration with your existing workflows.