Forum Discussion

TMiller's avatar
8 years ago

Powershell results - working with son

Hi everyone,

I'm trying to get some results off a Simplivity system using power shell and json.  I have the powershelgl working as I would expect, but I can't get the results to show up in LogicMonitor. 

In collector debug, I see this when running the script.

>!posh
returns 0
output:
[
    {
        "id":  "53466cdf-ee82-435e-8619-334b3a3e7583",
        "name":  "Fakename",
        "type":  "OMNISTACK",
        "members":  [
                        "4230cce1-f672-e708-0ed6-3310d6db8222",
                        "4230e3c6-4cf6-7228-fc86-cbce8cfa4af7",
                        "564dcac8-b774-c644-cb22-e63acfd07cb9"
                    ],
        "arbiter_connected":  true,
        "arbiter_address":  "10.1.1.6",
        "stored_compressed_data":  731283120128,
        "compression_ratio":  "1.8 : 1",
        "deduplication_ratio":  "300.9 : 1",
        "free_space":  14779864866201,
        "capacity_savings":  387454100800512,
        "efficiency_ratio":  "530.8 : 1",
        "local_backup_capacity":  385825262157824,
        "used_logical_capacity":  388185382895616,
        "remote_backup_capacity":  0,
        "allocated_capacity":  15511146961305,
        "stored_virtual_machine_data":  2360120737792,
        "stored_uncompressed_data":  1290225192960,
        "used_capacity":  731282095104
    }
]

I've attached example of what I've tried for output.  Nothing is showing up.

 

  • I ended up working with support on this.  It turns out that the information coming back from Powershell is actually strings.  I had to use regex to access the data.

  • Because the fundamental JSON datastructure is an array, I believe you'll need to reference the root array element as $[0]. So:

    $[0].compression_ratio
    $[0].used_capacity
    ...