Storing and Visualizing Time Series Data with InfluxDB and Universal Dashboard
Session date: Aug 25, 2020 08:00am (Pacific Time)
PowerShell Universal is the ultimate platform for building web-based IT tools with PowerShell. Add to this an open source time series database, InfluxDB, and you can quickly create visualizations that help your users derive powerful insights.
In this webinar, Adam from Ironman Software will show you how to setup InfluxDB on Windows, send performance event data to the platform by scheduling PowerShell with Universal Automation and build a dashboard to expose the data as easy-to-view charts using Universal Dashboard.
- Download Powershell Universal
- Docs on Powershell Universal
- Universal Templates Repo
- Community Forum for Powershell Universal
Watch the Webinar
Watch the webinar “Storing and Visualizing Time Series Data with InfluxDB and Universal Dashboard” by filling out the form and clicking on the Watch Webinar button on the right. This will open the recording.
[et_pb_toggle _builder_version=”3.17.6” title=”Transcript” title_font_size=”26” border_width_all=”0px” border_width_bottom=”1px” module_class=”transcript-toggle” closed_toggle_background_color=”rgba(255,255,255,0)”]
Here is an unedited transcript of the webinar “Storing and Visualizing Time Series Data with InfluxDB and Universal Dashboard”. This is provided for those who prefer to read than watch the webinar. Please note that the transcript is raw. We apologize for any transcribing errors.
- Chris Churilo: Director Product Marketing, InfluxData
- Adam Driscoll: Founder, Ironman Software
Chris Churilo: 00:00:04.431 Cool. All right. It’s three minutes after the hour. So let’s get started. Welcome, everybody. Thank you so much for joining us today. My name is Chris Churilo, work here at InfluxData, and today we have a really wonderful webinar with our friend Adam Driscoll who is going to share his experience using InfluxDB and this new and cool dashboarding technology called PowerShell Universal. Just a reminder to everybody one more time, the recording will be posted so you can take another listen to it, today’s talk. And please post your questions in the chat or the Q&A, and we’ll get those answered at the end of today’s session. If there’s something that makes sense for me to bug Adam in the middle of his presentation, then I’ll definitely do that, we’ll insert that. But we’ll make sure that we capture all the questions and answers on the recording so that you can take another listen to it. And if you have a question after the event, don’t worry, just send me an email, and I’m always happy to forward it along to Adam. And you can also talk to Adam in our Slack channel or in our community forum. If we have a lot of questions, a lot of times what I will do is start the thread of questions in there so we can continue to have a conversation. All right, with that, I am going to hand it over to you, Adam.
Adam Driscoll: 00:01:25.905 All right. Yeah, thank you, Chris. So today, we’re going to be talking about storing and visualizing time series data with InfluxDB and PowerShell Universal. So my name is Adam Driscoll. I’m the founder of Ironman Software. So Ironman Software, if I can advance my slide here, we build powerful tools for PowerShell developers. Some of the things that we make include PowerShell Universal, PowerShell Protect, PowerShell Pro Tools, and then PowerShell Tools for Visual Studio. So today, we’re going to be focusing on PowerShell Universal, and we’re going to be integrating it with InfluxDB. So we’re actually going to use Universal to retrieve performance statistics from my machine here, and then we’re going to visualize that using Universal Dashboard. So PowerShell Universal itself is actually broken up into like three major features. First is APIs, and APIs allow you to expose PowerShell scripts to the rest of APIs. So the idea is that you can pretty much map an HTTP route and an HTTP method to a PowerShell script that then is executed based on that input. And that can then integrate with any system that PowerShell can integrate with which is - we know that PowerShell is a glue language, so that’s a lot of things that you can actually integrate with. So pretty much all the features of Universal can integrate with pretty much any PowerShell module or PowerShell cmdlet.
Adam Driscoll: 00:03:02.463 The second major feature of PowerShell universal is automation. Automation allows you to execute and schedule PowerShell scripts. So it’s a little more than that, it actually integrates into a lot of the core features of the PowerShell kind of hosting engine to allow you to get error messages back, full-featured objects back, and kind of integrate even with things where you may be receiving input from a user, that kind of thing. Finally, we’re going to be looking at Dashboard. So the dashboard feature of Universal - it used to be called the Universal Dashboard, which a lot of people are familiar with, but now it’s been integrated into this platform PowerShell Universal. And the idea with Dashboard is it allows you to create interactive web pages with PowerShell. So you use PowerShell cmdlets to kind of define the structure of your website, and then you can actually integrate with whatever PowerShell cmdlet you may want to kind of display data or interact with in other systems. In the case of today’s demo, we will be interacting with the InfluxDB REST API.
Adam Driscoll: 00:04:12.775 So I’m not a big slide guy, so this is my last slide before a demo, and I just kind of want to talk about what we’re going to be going through today. So first of all, we’re going to install and configure InfluxDB on Windows, and I’ll demonstrate the REST API via the PowerShell command line, then we’re going to install and configure Universal. I’ll install that as a service and then kind of go through an overview of the admin dashboard so you can learn a little bit kind of about Universal. Then we’re going to set up a PowerShell script to actually run on a schedule. They’ll collect performance data from my server and store that in InfluxDB via their REST API. Finally, we are going to display that data in Dashboard using Universal Dashboard. I’m going just to do a couple of charts and then the table of the data, and we’re going to actually retrieve that data via the InfluxDB REST API.
Adam Driscoll: 00:05:13.489 All right, so that slide’s for later. But let’s get started. So pretty much, this is a Windows 10 machine. You can run this on a Windows Server machine if you wanted to. But first of all, I want to show you a little bit about InfluxDB and kind of how to run that on Windows. There’s a couple of different ways that you can actually get this installed and running. The easiest way is you can just literally go to the InfluxDB website, download - in this case, I’m using the open-source community edition, and I’m running 1.8.2 for this demo. So InfluxDB comes as a zip and you have, these different, pretty much, executables that you could run to start the InfluxDB server as well as the InfluxDB shell to interact with it. So by default, there is a configuration file that comes with InfluxDB, and this configuration file kind of sets a bunch of default values that you can use to configure your InfluxDB instance, so kind of where your data is stored. You can set settings for things like the HTTP Server, data retention, that kind of thing. So for the purpose of this demo, I’m just going to kind of skip the configuration and run with the default configuration. So if I open a command prompt here and just start up the InfluxDB server, and that’s going to be the influxd.xe file here, and when I start that up, you’ll see that it notifies me of a bunch of kind of startup information. Some of that startup information includes that it’s listening on the HTTP kind of service for that, and it’s listening on port 8086 by default. So for this example, I’m just going to kind of run InfluxDB in a console, so you can kind of see the output.
Adam Driscoll: 00:07:08.505 And you can also install InfluxDB as a service using NSSM, or the Chocolatey package that is available for InfluxDB also has a switch to install InfluxDB as a service. So if you wanted a persistent service running InfluxDB, it’s really easy to do using those two methods. All right, so now that we have Influx up and running, what we can actually do is actually start interacting with that with PowerShell already. So using something like Invoke-WebRequest, I can communicate with my InfluxDB server by using 8086 and then using the ping endpoint. So the ping endpoint, what that does is - I’m going move this out of the way - it actually will ping the InfluxDB server, and it was kind of nice about having this running in the console as you can see all this information here. So we got that ping from PowerShell, and I got pretty much a return from the InfluxDB server that doesn’t include it in content but in the headers, you’ll see things like what build of InfluxDB this is, you can see I’m running the open-source version, and then what version of InfluxDB I’m running. So I’m running 1.8.2.
Adam Driscoll: 00:08:29.105 So now let’s take a look at how to kind of set up an InfluxDB database. So I’m running the InfluxDB server here using influxd.xe. But if I want to actually start the shell, what I can start is influx.xe. So by default, this will connect just to the default port and localhost. So since I’m running InfluxDB on this local machine, you can see I have connected to HTTP localhost 8086. So now I can start issuing shell commands against InfluxDB. So by default, if you run SHOW DATABASES, you’re going to see that there’s just one database, the internal database. So if we want to store data, we probably don’t want to install into the internal database. So I’m actually going to go ahead and create a new database for my performance data. So you can use the CREATE DATABASE, and then name of the database. So I’m going to call this performance data. So now if I issue the SHOW DATABASES command again, you’ll see now I have a performance data database.
Adam Driscoll: 00:09:39.901 All right, so now let’s actually look at how can we integrate PowerShell into InfluxDB. So since there’s a REST API for Influx, what we can actually do is use that via PowerShell. So PowerShell has some pretty powerful kind of curl type commands for issuing both REST Methods and web requests. The difference between Invoke-WebRequest and Invoke-RestMethod is that Invoke-WebRequest is kind of more for a raw web request that you might be doing, kind of think of like in processing a website or potentially dealing with a SOAP API or something like that. But Invoke-RestMethod is a little more specific in terms of the fact that it automatically will talk in JSON if you want it to, and that kind of thing, so it’s kind of geared towards interacting with REST APIs really easily.
Adam Driscoll: 00:10:37.822 So what we’re actually going to do is we’re going to set a variable, and this is going to be the URL that we’re going to call to actually write to the performance database. You can see here that the API endpoint is the right endpoint, and then we’re going to use the DB query string parameter and specify the database that we want to write to. Next, I’m going to set a variable to the performance counter that I want to retrieve, if I can I copy and paste. So I’m going to get the processor Total Percent Processor Time performance counter in Windows. And lucky for us, there is an easy PowerShell cmdlet for doing that, and we can use Get-Counter and just the name of the performance counter that we want. From there, we’re going to get the counter samples property of the object returned from Get-Counter which will allow us to get the value of that counter. So we’re trying to get the total processor time for the machine. So now if I run that, and I look at my value property here, you’ll see that I have about 15% processor usage for the total processor time.
Adam Driscoll: 00:11:53.330 So to send that to InfluxDB, we want to call that URL and then specify [inaudible] string as the body of the HTTP request to send that into InfluxDB. So I actually already did this once I hit a newline character, so that just invoked to a web request, which is a POST method to the URL that I specified earlier, that performance data one. From there, I want to put it in the counter table. So I’m actually going to create a new table and store my counter data, and then I’m going to use kind of the concept of tags. So after the first comma here, the next comma-delimited list are the tags for this particular set of data. So in this case, I have a host tag and a counter tag. And then the idea of a tag is that a tag is indexable. So you can kind of think of it like an indexed column inside of a relational database. But in InfluxDB, that is just what that is. And then if you have a space after that comma-delimited list, you can have another comma-delimited list of - these are fields. So fields are nonindexed values. So these are typically - they’re like data values. So in my case, this is my performance - or my processor time that I just stored in InfluxDB. And you’ll notice I didn’t put in a timestamp or anything like that. It’ll automatically put it in a timestamp if you want to. The other thing that you can do is have another space after your field-delimited lists and have timestamp value that you’d like to associate with the data that we just stored in there.
Adam Driscoll: 00:13:32.574 So now, if you go back to the performance - or the InfluxDB shell, what we’re going to do is we’re actually going to switch over to the performance data database by using used performance data and then from there, we’re going to select data from the database. So now you can see there’s the data that I actually sent from PowerShell. So this time value I think is [inaudible], nanoseconds it’s [inaudible], and then we have our counter value, so that’s the name of the counter that I used, and then here’s the host, which is the other tag, so these are the two tags, and then here’s the value that I sent in, which is my field. All right, so now that we have InfluxDB up and running, and we can kind of store data in it from PowerShell, let’s actually set up Universal and start getting data in it on a regular schedule.
Adam Driscoll: 00:14:28.317 So with Universal, you can download it as an MSI for Windows. And if you just double-click that, it’s going to go ahead and install Universal as a Windows service and get that up and running and configured for you. So pretty much what PowerShell Universal is, is .NET Core application that integrates very tightly with PowerShell. You can run multiple PowerShell environments. It works with Windows PowerShell along with PowerShell 7. And it’s also cross-platform, so if you want to install it on Linux, you can do that as well. You have a docker container for both Windows and Linux systems, so that’s another avenue you can go down. But in this case, I’m just installing it as an MSI. And once that’s done, it’ll actually start up the universal service and open a web browser to the login page. So now we’re sitting on the PowerShell Universal login page. By default, just admin and any password, you can easily change that so that you can lock it down, and then when you log in, you’re going to see this interface. So again, these are kind of the core features that I was talking about earlier. We have APIs, automation, and dashboards.
Adam Driscoll: 00:15:44.702 So APIs - I’ll just show a quick example of this. I’m not actually going to integrate this with InfluxDB today. But if I just wanted to create a Hello API, I could simply have the Hello World string returned from PowerShell, so this is just a PowerShell script. And then if I were to go over to PowerShell or any REST client, you can use curl, that kind of thing. And I were to issue this web request here - actually, I’m going to change this to Invoke-WebRequest so that we can see the content - you’re going to see that it returns Hello World from my REST API. So the idea there is that, yeah, it’s a REST API sitting over the top of pretty much a PowerShell script, so what we’re going to be more focused on today though is automation, primarily scripts and schedules, and then we’re going to put together a dashboard. So one thing I’m going to do just because I want to make sure that I can run as much as I want - so Universal offers a bunch of free features, but we do have paid features, and we limit the number of jobs that you can run per day and that kind of thing without a license. And you can’t do authentication for dashboards, but other than that, you could stand up a free dashboard and integrate it with all kinds of stuff without a license. So there’s tons of stuff you can do with universal for free; I’m just doing this so that I can run lots of jobs during this demo. So let’s do a refresh of that.
Adam Driscoll: 00:17:24.225 And now let’s start to look at creating a script. So first, I’m going to create a collect script that is going to be similar to the PowerShell script that I showed that got the performance counter data and then stored it in InfluxDB. So I click Okay there. Now I have my ps1 script here. And this is just a PowerShell script that’s sitting pretty much on the local machine. I’ll actually show you where that’s stored because it’s a core concept of Universal that we kind of - we use the file system and PowerShell files as configuration data for Universal. So what you’ll see here is that the collect script that I just created is now actually available on the file system as well as all the pretty much information that I have configured inside the Universal, so there’s a bunch of default stuff, but there’s also things like that endpoint that I created is just a PowerShell ps1 file. And kind of the concept here is that because it’s all stored as ps1 files, you can check it into source control, and then you can have these repeatable PowerShell Universal instances. You just pretty much check it out, stand up the PowerShell Universal application tier, and then you’re up and running with whatever you configured here.
Adam Driscoll: 00:18:50.297 All right, so let’s go back to the interface though. And what I’m going to do is - this looks very similar to what I was doing before where I want to set a URL for the InfluxDB server for the performance data database. And now what I’m going to do which is a little different is I am going to actually set the timestamp manually. So InfluxDB needs epoch time in nanosecond instead of - I think the milliseconds is just the default. And I’m doing this because, as you see in this script, as I insert things into InfluxDB, it puts a nanosecond timestamp on there automatically for me. But what that would do is make the charts look all bad. So we pretty much are setting a timestamp so everything lines up really nicely in the chart. So that’s the main reason for setting my timestamp immediately.
Adam Driscoll: 00:19:48.847 All right. So now, I am going to use a couple of performance counters in this case. So I’m going to do Percentage Processor Time again, I’m going to get a memory statistics of the Percent Committed Bytes in use, and then I’m going to get a disk statistic for the Percent Disk Time. I’m also going to get some network stats for this - purpose of this demonstration. I’m going to get the Bytes Received Per Second, and the Bytes Sent Per Second for my network adapter. All right, so now, similar to what we did before, I’m going to take my performance stats - so since this is an array in PowerShell, so I actually have three things in this array. I am going to loop over that array, and then for each one of the statistics, I’m going to do what I did on the command line earlier. I’m going to call Get-Counter to get the value and certain value, and then I’m going to call Invoke-RestMethod to post to it through that URL, store in the counter table. I’m going to use the same tags I used before and the same value. The only difference is that I’m specifying that timestamp so that our charts look prettier. All right. Next, I’m going to grab the network statistics. So similar to the performance counters, this is going to do the same thing, kind of go over the network statistics, call Get-Counters, store the value. The only difference with this one is I’m actually going to be storing it in a network table rather than a counter table. So obviously, I could have this as a PowerShell function and makes this a little prettier. We could actually make a PowerShell module for InfluxDB, that kind of thing, but I’m just kind of copy and paste in here.
Adam Driscoll: 00:21:38.619 All right. Finally, I want to show that we can kind of integrate with whatever we want in terms of PowerShell stuff. So I was using Get-Counter here and Invoke-RestMethod. In this instance, I’m using Get-CimInstance and the WIN32_LogicalDisk class, so this is pretty much calling WMI on this local Window’s machine, and then I’m getting all the logical disks on my machine, getting their free and used space, storing that in there, and then this is a little different because I’m actually using two fields for this particular table. So I’m actually going to start this in the disk table, I’m going to use the host tag and a device ID tag. So in the case of a Windows machine like this, the device ID will be the drive letter. And then I have a free-space and used-space field. So remember that these tags are indexed so that you’ll be able to search via those indexes in queries pretty quickly, while these are nonindexed. So those are kind of the data that you want to look up based on these tags. And then finally, I’m setting the timestamp again so that everything lines up really nicely.
Adam Driscoll: 00:22:53.244 All right, so let’s save that and I’m going to run this, and you get some options when you run in PowerShell Universal. In this case, you can select your PowerShell version. I have a couple of PowerShell version in there, but I’m just going to click Run on it in PowerShell 7. And it’s going to start running this and collecting those performance statistics for us. And if you actually go look in InfluxDB, you could see that we had a bunch of post calls. So those are the different statistics that were written to our disk network and counter tables. So now if we go over to InfluxDB, or the shell, what we can do is we can actually check things like - I think it was disk. So you can see there, there’s a timestamp, the device ID, which is the drive letter on this machine, followed by the free-space and used-space fields and also the host field. And then I should have some network statistics as well. So there you can see that we have some network statistics for bytes received and sent and the two values for that. And one thing to note is you can see that the timestamp is the same for all these statistics so that, like I said, it kind of all lines up nicely inside our chart, and we should have a bunch more counter stuff as well. So we have the three new statistics for our counter stuff.
Adam Driscoll: 00:24:25.767 So now that we have a script written, what we can do is we can actually go ahead and schedule that script. So if I go back to the script, and in the top right here, you’ll see that this little ellipsis, I can click schedule here. You can also go to the schedules tab and create a new schedule from there. But let’s say I click schedule here, you’ll see that I have a couple of options. I have a simple schedule, cron schedule, or a one-time schedule. In the simple schedule, you kind of can select these different common schedules that you may need, and really that just kind of creates a cron schedule for you, and then one-time schedule is just run sometime in the future. So I’m going to run every minute and click Okay there. And if we go to our schedules, you can see now that I’ve done that. I have the collect ps1 script running every minute. That’s going to show the next execution which is a minute from now, so we’re going to let that run. And while that’s running, what I’m actually going to do is start putting together a dashboard. So like I mentioned earlier, a dashboard is pretty much a webpage that you can define with PowerShell. So Universal Dashboard has been around for numerous years now. PowerShell Universal is kind of the new platform for it. We’ve added this kind of administrative UI and that kind of thing, and built the automation API features. But Universal Dashboard was a PowerShell module that you could use to build these dashboards and that’s kind of where this has come from. So if I click Add Dashboard, what I can do is create a new dashboard and then give a URL that I want to use to access this dashboard. So I always call it dashboard. And I’m not really going to get into the framework or anything like that, but you can also choose what PowerShell version you’re using. This could be Windows PowerShell or PowerShell 7 in this case.
Adam Driscoll: 00:26:18.497 So after I create my dashboard, and I can click view and that will take me over to pretty much the sample dashboard that we have when you add a new one. The idea here is that we have just a little Hello World, they have a button you can click, and if we actually go into the info for this dashboard, it’ll actually show the code. So as you can see here, just some PowerShell script, we have a new dashboard that kind of defines a title and then that typography, which was the Hello World, and then a button that you can click, and then it has an on-click handler that will redirect you to somewhere. So in this case, we’re going to our docs. So there’s lots of information you can see on this dashboard’s page. You can get a lot of information about who’s connected, the session, how much memory the dashboard is using, and that kind of thing. It’s actually running in a PowerShell process in the background. So that’s kind of how we allow you to kind of isolate these dashboards. So if something happens in the dashboard, it’s not going to take down your whole Universal server. What we’re going to be doing is we’re going to be adding a charts component to our dashboard. So we allow you to manage these components. We actually have a pretty big component library that you can check out. We actually have a marketplace for getting new components. So people who have made financial charts, avatars, we have cool things like confetti, that kind of thing, that you can add to your dashboards. And once those are installed, you can add them like I just did to my dashboard so then it associates that pretty much component with your dashboard, and now I can start using charts inside my dashboard.
Adam Driscoll: 00:27:58.833 So what we’re going to start doing is putting together a dashboard. The first thing I’m going to do though is I’m actually going to go out to my repository folder, and like I said, everything is ps1 scripts here, which means that I can interact with other PowerShell scripts because it’s all just kind of PowerShell through and through, and I want to add a function to retrieve data from InfluxDB and then put it into my dashboard. So we’re going to - what do they call this? - “GetInfluxData”. So I’m not going to type all this out, but I’ll kind of go through the basics of it. So what it’s going to do is create a function that allows you to specify a URL and a query parameter, and then it’s going to call an Invoke-RestMethod for you. So I was going to kind of hide a lot of the guts of doing this behind the scenes, and then I could just call Get InfluxDB directly in my dashboard rather than having to define - or do all this every single time I want to call InfluxDB. And kind of the idea here is that the data that I get back in my results variable here from the InfluxDB database is in a particular format, but I want it to be in a different format, so I’m kind of doing some data munging here. I will share the script after this. We don’t have to kind of go through exactly what’s going on here. But some of the basics are that I am creating a hash table that has the fields, and it’s turning any time field from the Unix epoch time into a date-time object, which is a .NET-like structured object that has a lot more properties and can be formatted properly and that kind of thing. So that’s kind of some of the basics that’s going on here.
Adam Driscoll: 00:29:51.534 All right, so now, let’s go back to our dashboard, and we can actually use that directly in a dashboard by importing it as a module. So if I were to just - oops, I kind of click Edit, and then import that InfluxData, ps1. So our PS script here just kind of defines the current folder, and then I’m going to import this module which makes that function available to me inside the dashboard. So we’ll call this performance data. And the first thing that I want to display is network data so let’s add that. And I’m creating a new typography which is more or less just text that allows you to specify a lot of different options. There are various variants. This is a header level three. You can do things like paragraphs or code, that kind of thing, and then we’re just going to specify some text. So this is just going to be a header level-three text.
Adam Driscoll: 00:30:52.101 Next, I want to add an element. So this is mostly for formatting purposes, but it also kind of highlights that you can just use HTML inside Universal Dashboard. So this is the new UD element command. We’re specifying a tag which is a div tag which is kind of a standard kind of divider tag inside HTML, and then we’re going to put some attributes on it. We’re going to set a style and pretty much set the size of this div to 500 pixels. Then we’re going to say that we want this particular section of the dashboard to auto-refresh on an interval of every five seconds. So it’ll actually reload the data - well, or re-execute the script that isn’t in the content of this element so that we can redraw our table every time we get new data. So I’m kind of sticking with the dashboard name, you’re going to put this up on [inaudible] or something like that, and it would automatically refresh as new data came in.
Adam Driscoll: 00:31:53.234 All right. So now we need to retrieve our data from InfluxDB. So remember I created that Get InfluxDB function and then I imported at the top here, now I’m specifying a query which is the Select Star From Network. So I want to get the network tables, pretty much all the records of the network table, or all the columns in the network table, where the time is greater than the last 60 minutes, more or less. So it’s pretty much getting the last 60 minutes of network data. And then we’re going to group by the counter that we’re using. So if you recall, I had two different counters. I had the bytes received and bytes sent counters. Next, this is something I will share as well. But pretty much I’m munging the data again in a way that fits the chart syntax. So what the chart is looking for is pretty much X, Y values to plot on this chart, and I’ll show you what that looks like. So I’m going to put the rest of this chart code in here. So the idea here is that we have this chart data which is in this case grouped by a counter, and then we’re setting a value to that counter, and then we’re storing that as a series of hash tables for PowerShell. And then we’re telling the Nivo chart cmdlet that we want to separate the values by these specific keys, which are going to be the performance counter names that I used. And that’s what’s going to be inside this counter property up here. So pretty much I’m taking the data and I’m transforming it so that it fits what the chart is looking to display. So we have examples of all this kind of stuff in our documentation on how to get your data to match the chart. So let’s save that.
Adam Driscoll: 00:33:53.906 You should be able to come here and refresh this. And now you can see that we have a really basic network chart, and you can see it refreshes every five seconds as new data comes in. And if I hover over it, you can see that kind of that tan color on the bottom is the bytes received and then the salmon color on the top is bytes sent. So since I’m doing a Zoom where I’m sharing my screen, it’s sending a lot more data. And the data actually updates every minute, so. Well, it’s getting that from InfluxDB and displaying it here. So this will display up to the last 60 minutes’ worth of network data. All right, so let’s actually look at another type of chart. So that was a streaming chart. So this new “UDNivoChart” cmdlet has a bunch of different charts, so you can do things like bar charts, line charts, stream charts, and a bunch of other weird ones like bubble charts, and that kind of thing. But let’s actually just do a real standard one. I’m actually going to do a line chart. So we’re going to put a new header there which is performance data. I’m going to do the same thing I did above where I’m going to have a new UD element so that it sets the height that I want. You can see this is a really big chart, I don’t have to actually have a chart that’s 500 pixels. You can kind of make it smaller and you can adjust the columns that you have and everything, but I’m going to keep this real simple and just kind of put some real big charts so they’re easy to see.
Adam Driscoll: 00:35:30.997 All right. So I’m going to do another new UD element, similar concept where I have a div, I’m setting it to 500 pixels high, and then it’s auto-refreshing every five seconds. And this time, I’m actually going to select a different table. I am going to select the counter table. So in this case, I’m doing the same thing that I did last time except that rather than the counter table - rather than the “network” table, I am doing the “counter” table. So then a line chart requires a little bit different kind of data structure when creating the line chart. So in terms of the line chart - let me see if your line is up a You can see here that we get the data, and then we’re going over the data inside this particular data array, I guess. And then from there, I’m getting the counter value and setting the ID, and then this is multi-series data which means that I can have multiple fields within - I guess each counter will be its own series on the line chart, so you’ll end up with multiple lines on the line chart. And then from there, we’re going to set the X, Y coordinates, one being time and the other one being the actual value of the performance counter that I’m setting. And then we can set a bunch of cool properties on this particular Nivo chart. So you can see this is a line chart. I’m setting that chart data there. This one doesn’t require any keys that you need to set like we did up here with the network stats. And then I can set things like - you could set all kinds of stuff like the margins on either side, and scaling, and you can see I’m setting some access settings and that kind of thing.
Adam Driscoll: 00:37:27.358 So now if I save that, we should have a line chart here. And I could see - I messed that up somehow. Oh, okay. I actually copy and pasted that into [this?] for each. So since we had three series of data, I ended up with three charts which is actually kind of interesting and cool. Where that was intended to go was actually outside of that, for each. So if I put that here, we should no longer have three charts but one chart with three lines. So I have to refresh, and now you can see that we have one chart with three lines. So I’d have to do a little more tweaking to kind of fix these timestamps on the bottom and that kind of thing, but you can see that our performance data now kind of interwoven onto this chart using that Nivo chart cmdlets. So like I said, there’s a lot more you can do with this in terms of which charts you can pick and that kind of thing. We have a lot of examples out on our docks. So just know that what I’m showing here today is mostly visualizing data, but Universal, especially dashboard stuff, is also interactive, so you can do things like inputs where you have things like autocomplete, date pickers, and that kind of thing, and actually take input from the user and then kind of interact with your PowerShell scripts that way.
Adam Driscoll: 00:39:04.991 But if you’re looking for information on the data visualizations, we have all the chart examples up here, and you can kind of see the different charts. You can do bar charts, stacked bar charts, and that kind of thing. So that is our documentation. All right, so there’s one more component that I actually want to show, and I’m going to use that data - or the disk data that I was collecting, so if I edit this one more time - let’s move that over there, and I’m going to just do another header for the disk data. And this time, I’m going to make this real simple, so these are kind of complicated examples of - more or less mapping our data to fit the correct format for these tables. But if you want to do something as simple as a table, what you can do is grab - I’m going to autorefresh it again so this table autorefreshes as well. But what I would actually do is I’m going to actually select from InfluxDB the disks where the time is the last 60 minutes. I’m not going to do any grouping, I just want the records of this disk data over the last hour. And I’m just going to take that data and then take the fields of that data and just store it in a “New-UDTable”. So if I save that - and this should refresh, and now you can see at the bottom here, we actually have a table that contains all that data directly from InfluxDB. So we have the host, the used space, the free space - I don’t know why that’s jumping up and down like that. But yeah, so then you can see that you kind of could just visualize that directly in Universal Dashboard without actually having to pop over an InfluxDB shell or invoke a Rest Method if you just kind of want to see the raw table data directly from InfluxDB.
Adam Driscoll: 00:41:04.547 All right, so today, we went over how to kind of integrate to PowerShell Universal with InfluxDB, to both collect the data via our automation script here which is now running on a schedule, and if you actually look at the jobs here, you can see we ran 17 jobs during the course of this presentation to collect data and then store that in InfluxDB. We set up a schedule that runs every minute. You could have this run every hour, every day once at midnight, something like that. And then we created that dashboard. You can see that our dashboard is running here. It’s all built on PowerShell which you can see we kind of authored here. And yeah, now we have a kind of a fully-featured reporting dashboard that is live collecting data kind of all in the same solution, all built on persistent data stored in InfluxDB. So if you want more information about how to get up and running with Universal, we actually have a GitHub repository that you can go and grab the [inaudible] code for what I just did here. So if you go to this Universal Templates folder, you’ll see that I have pretty much this same example right here inside this GitHub repository, so you kind of get up and running with this solution right now.
Adam Driscoll: 00:42:40.458 So one thing to note is I did kind of mention licensing earlier. Dashboards are free, so what I did with the dashboard stuff, you can definitely do automation. You can run up to 25 jobs a day. So if you wanted to collect data once an hour, that kind of thing, you could definitely do that without buying a license, so you could stand that up for free. And if you want to get a hold of the universal MSI, definitely go over to our website and go to the Downloads here, and you can download the universal MSI. We have a docker container, and we also have a Chocolatey package if you are interested in installing it via Chocolatey. So with that, I have left some time for questions at the end here, and I would love to feel those either if you want to unmute or I can go through the chat.
Chris Churilo: 00:43:26.725 Cool. Okay, we’ll run through some of these questions that we have pretty quickly, make sure we get the answers recorded as well. Before we do that, I just want to remind everybody, please put your questions in the chat or the Q&A. And if you do want me to unmute lines, just raise your hand and I can do that. And then I know this question came up again, just want to remind everybody the recording will be posted later this afternoon. And then [I don’t know?] if you can also give me the link to that GitHub repo, I will make sure that that link is on the same page that the recording is, so you can play along with that together. I think that’ll be kind of cool.
Adam Driscoll: 00:44:08.471 All right. Yeah, it sounds good. I can share a bunch of links with you after this.
Chris Churilo: 00:44:11.278 Perfect. Okay. So Frank who’s pretty much a proud InfluxDB had just made a little comment when you were talking that - I think you were just talking about pulling data from a table, and he said, “You probably meant to say measurement.” For the audience here, that’s just the terms that we use. So when you take a look at our documentation, you’ll often see that we refer to things as a measurement, a tag, a field, and I think Adam did a good job of presenting that with you. But please make sure that you get familiar with that vernacular so we don’t confuse you. But let’s see, Frank also, he did have a question, “When running under Linux, it’s not using PowerShell right, it’s using bash?”
Adam Driscoll: 00:44:55.733 PowerShell Universal uses PowerShell in both circumstances. So if you are running on Linux, it will still use PowerShell as kind of the main automation host. You can call a bash script from PowerShell kind of thing, so you would have to have the PowerShell 7 installed on Linux to get this to work the way I just had it working.
Chris Churilo: 00:45:19.556 Cool. Frank, if you have any follow-ups - Oh, he says, “Got it. Thanks.” Perfect. Okay, Jen Lin asked, “So if we’re using a free trial, would we be able to follow along with these steps as well?”
Adam Driscoll: 00:45:32.148 Yes, I think the only thing that you wouldn’t be able to do is run it every minute. You could run it up to 25 times a day in terms of collecting the data. The other thing you could consider doing is if you just kind of wanted to [adapt?] or trial [that?], you could put more data into InfluxDB directly from PowerShell without running it through Universal if you just kind of want to see the dashboard more in action. But the dashboard features, pretty much everything or everything you saw here is available for free.
Chris Churilo: 00:45:59.499 Cool. And we’ll also make sure that those links are included so that not only can you re-watch this, but you can follow along with an example. So Katherine asks, “Telegraf can be installed on Windows machines, get some metrics, and send them to InfluxDB. I’m wondering what the advantages are of using PowerShell Universal instead of Telegraf.”
Adam Driscoll: 00:46:22.023 I guess I don’t really - I haven’t played with Telegraf all that much, so it’s kind of hard for me to compare the two. My big thing with PowerShell is that it integrates with everything really easily. I am assuming Telegraf kind of has its own automation and scheduling. Is that kind of the idea?
Chris Churilo: 00:46:43.540 Yeah, it’s very, very simple to use. I think either one will work, Katherine. I think - what I always appreciate is that, as a development platform, there’s many options for you to bring data into InfluxDB. So if you want to use Telegraf, that’s really easy to set up. There’s over 250 plugins, so you don’t have to create one. There’s probably already one available. Or if you want to do HTTP right directly into InfluxDB, these are all just some alternatives that can be using - and your own application may have reasons why one may be more advantageous than the other. Okay, let’s get - we have plenty of questions still so Katherine, hopefully that answers that. Jen Lin asked, “What’s the difference between PowerShell Universal or Windows, the - oh, between the MSI download and the Microsoft zip download?”
Adam Driscoll: 00:47:40.945 The zip download does not install the service automatically for you. So MSI, mostly installs in Program files, creates a service that starts up [inaudible] starts. The zip is just the binaries, so then you can kind of run it from anywhere. It’s just similar to InfluxDB. It’s just an XCU-run.
Chris Churilo: 00:48:01.859 Katherine, I think your second question - oh, okay, I see. So Katherine’s second question is, what’s the difference between the dashboards that you were showing today and Grafana?
Adam Driscoll: 00:48:16.636 So the dashboards that I’m showing today are - obviously, the technology is a little bit different. Grafana is kind of built for more reporting, and this is - you can achieve similar functionality with Universal as you can with Grafana. But I think the thing that Universal is a little different in terms of is that you can make it more interactive. So we support not only the charts, but we also support interactive buttons and forms so you can actually input data and have it execute PowerShell on the back end. And you can also do some stuff around actually creating kind of data manipulation via Universal by - maybe the user selects different queries or that kind of thing and it would actually filter the data that’s on the screen based on that. So I think it’s a little more interactive than some of the things you’ll see with Grafana.
Chris Churilo: 00:49:20.164 One question that we always hear whenever we do a webinar with Grafana or even in the InfluxDB UI is, “Can I bring some of those little panels into my application?” And I think with what we saw today, you can, and that’s one of the differences and maybe the advantage of this PowerShell Universal.
Adam Driscoll: 00:49:40.308 Yep.
Chris Churilo: 00:49:42.229 Okay. So Eduardo asks, “I noticed a problem with the dashboard page refresh returning to the top every five seconds. Can it be avoided?”
Adam Driscoll: 00:49:51.110 Yes, probably. I think it’s just kind of a bug on our end here that we’re going to look into.
Chris Churilo: 00:49:57.194 You know live demos.
Adam Driscoll: 00:49:58.585 Yep. I know. I knew there’d be something. [laughter]
Chris Churilo: 00:50:01.600 Krishna asks, “Can we get sample PowerShell Universal dashboard code so that I can build the practice?” And yes, we’ll make sure we get all those details to you, Krishna. We’ll put that in the email as well as in the page where the recording will live. Let’s see. So Reed asks, “Is there any schedule for integrating InfluxDB with Visual Studio webinar?” Yeah, you’re right, we probably should do something like that. If you want to volunteer, always happy to have you do that. So we still have a couple of minutes left, so if there any other questions, please pop them into the Q&A or the chat panel. And while we’re waiting for other questions, so Adam, how did you find out about InfluxDB?
Adam Driscoll: 00:50:51.323 In a previous life, I was working for a company that was storing time-series data, and we were storing it in a different database, and we were kind of looking for alternatives, so that’s how we started playing with InfluxDB. And we’re kind of using a relational database to store that time-series data, and that’s why when I started playing with InfluxDB, it was pretty cool to see the difference it makes when something is built for time-series data.
Chris Churilo: 00:51:19.799 Cool. So if you - yes, it’s easy to get started, but what were some of the things that were just challenging with InfluxDB when you first started, if you can remember?
Adam Driscoll: 00:51:31.335 I think some of the concept around the tagging and fields and some of the query language being slightly different was a little hard for me to grasp, and then I think the documentation is pretty good, so I was able to find it eventually. It’s just the differences - I come from a very relational database background, Microsoft SQL and PostgreSQL, that kind of thing, so I think you guys have done a good job at kind of translating that to InfluxDB in terms of people coming from that world, but still, it’s a little challenging for me to kind of jump over some of those mental hoops to -
Chris Churilo: 00:52:07.800 Yeah, yeah, I mean, at the end of the day, who wants to learn another language, right?
Adam Driscoll: 00:52:12.424 That’s right, exactly.
Chris Churilo: 00:52:13.150 The brain is already full with a bunch of stuff. So I totally get it. Cool. So what is the number - maybe one of the top three use cases that you see people using the technologies that you presented today?
Adam Driscoll: 00:52:28.934 I think the big one here that I was showing was reporting, that kind of thing. I could also see more auditing-based stuff. So the two differences there I see, they’re what’s the reporting, and you might want to look at your performance statistics, that kind of thing over time, kind of how we were looking in this ch
art, but in terms of auditing, it’d be really nice to kind of set up the schedule and that kind of thing, and then you could have an alert or something like that if something is not right in the regular kind of median values that you would expect, that kind of thing. And then finally, I think there’s some remediation stuff you could do here with a dashboard, not only making it kind of data-driven, but you could also make it interactive, so like maybe if you did get that alert, you could go to the same dashboard and remediate that somehow, either restart the service or notify the right people, that kind of thing.
Chris Churilo: 00:53:33.028 Cool. We’re almost at the top of the hour. I just want to remind everybody we’ll post the recording later on today. We’ll send all the links that I had promised so that - it sounds like, I mean, there’s a lot of people that would like to re-watch this and follow along and be able to actually play around with what you demonstrated today. So if anybody does have any questions, I saw that there was a Read Me in that GitHub repo. But if you do have any questions that Read Me doesn’t answer, I’d be more than happy to forward your information to Adam so you can get your questions answered. I think it looks like everyone’s pretty excited, Adam. So thank you so much for joining us today. And I actually -
Adam Driscoll: 00:54:18.218 Yeah, thanks for having me. It was a lot of fun.
Chris Churilo: 00:54:20.092 I actually look forward to seeing some updates from you. So we’ll definitely invite Adam to come join us again. And you’ve gotten some really nice kudos in the chat, “Thank you very much,” from Eduardo, from Frank, from Jen Lin, so thank you very, very much, Adam. This was very informative.
Adam Driscoll: 00:54:39.688 Yeah. Thanks again for having me. And thanks, everybody, for attending.
Chris Churilo: 00:54:42.902 Awesome. Thanks, bye. Everybody, Bye-bye.
Adam Driscoll: 00:54:44.812 All right, bye.
Founder, Ironman Software
Adam Driscoll is the founder and lead developer at Ironman Software. His business develops PowerShell Tools for Visual Studio, PowerShell Pro Tools and PowerShell Universal. He is an 8-time Microsoft MVP in Cloud and Datacenter and very involved in the Microsoft communities through videos, blogging, tool building and speaking. He's based out of Hailey, ID where he spends his free time adventuring in the mountains.