Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- C:\Windows\system32> Function ReportToInfluxDB($duration, $name, $cpu, $memory, $hypervisor, $exitcode)
- {
- $username = "foo"
- $password = "union-share-itself-aid" | ConvertTo-SecureString -asPlainText -Force
- $credential = New-Object System.Management.Automation.PSCredential($username,$password)
- $influxdatabase = 'foobar'
- $influxtable = 'bar'
- $influxserver = "http://influxdb.example.com:8086/db/$influxdatabase/series"
- $influxdata = [ordered]@{}
- $influxdata.name = $influxtable
- $influxdata.columns = @("duration","name","cpu","memory","hypervisor","exitcode")
- $influxdata.points = @()
- $influxdata.points += ,@("$duration", "$name", "$cpu", "$memory", "$hypervisor", "$exitcode")
- $influxdatajson = $influxdata | ConvertTo-Json -Depth 2
- $influxdatajson
- }
- $sw.elapsed.seconds = 28
- $GUESTCPUS = 2
- $GUESTMEMORY = 2147483648
- C:\Windows\system32> ReportToInfluxDB $sw.elapsed.seconds, $GUESTNAME, $GUESTCPUS, $GUESTMEMORY, $HVCOMPUTERNAME
- "name": "foobar",
- "columns": [
- "duration",
- "name",
- "cpu",
- "memory",
- "hypervisor",
- "exitcode"
- ],
- "points": [
- [
- "28 2 2147483648 ",
- "",
- "",
- "",
- "",
- ""
- ]
- ]
Advertisement
Add Comment
Please, Sign In to add comment