Help with New-UDChart

Hopefully I can explain what I’m trying to do here…I have a pretty extensive dashboard for aggregating a bunch of data from our 3 Citrix sites. One panel that I’m trying make is a “user sessions” line chart that shows user growth/shrink over the day. I’ve been using a UDMonitor to do that but the problem there is every time the page is refreshed it starts over. I understand why. So what I’m trying to do is instead use a scheduled endpoint to write my data out to a text file, then use New-UdChart to display the data from the text file…A poor mans database…

So my scheduled endpoint is working without issue. I can see the text file, and I can see the data in it. (Essentially I’m just doing a count and writing that number out to the text file)

When I try to pull that data into the chart it shows 0. Here is my UDChart code:

            New-UDChart -Title "Sessions Over Time" -Type Line -AutoRefresh -RefreshInterval 60 -Endpoint {
            $SessionsCount = Get-Content -Path "Sessions.txt" -Raw
            $SessionsCount | Out-UDChartData -DataProperty $_
        } 

This is what my sessions.txt file looks like.
sessions

Thanks!

The problem is you need an x value to chart against. Can you get your endpoint to record rows as “datetime,value” in a csv?

gav

Yeah let me give that a try. Thanks.

Ok…so I’m close but racking my brain over what I’m missing here. I exporting my data into a simple csv that looks like this.

csv

But the time still shows as null across the x axis.

Here is what I have for my udchart…

    New-UDChart -Title "Sessions Over Time" -Type Line -AutoRefresh -RefreshInterval 60 -Endpoint {
        $SessionsCount = Import-Csv -Path "Sessions.csv"
        $SessionsCount | Out-UDChartData -DataProperty 'datetime' -LabelProperty "Date/Time" -Dataset @(
            New-UDChartDataset -DataProperty 'value' -Label "Users"
            #New-UDChartDataset -DataProperty 'datetime' -Label "Time"
        )
    }

chart

Try this:

   New-UDChart -Title "Sessions Over Time" -Type Line -AutoRefresh -RefreshInterval 60 -Endpoint {
        $SessionsCount = Import-Csv -Path "Sessions.csv"
        $SessionsCount | Out-UDChartData -LabelProperty "datetime" -Dataset @(
            New-UDChartDataset -DataProperty 'value' -Label "Users"
        )
    }

ahhhh…I see. Yes, it’s working now. Thank you adam! (and OpsEng!)

2 Likes