Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

ジュニパー Mist 自動化ビデオ

ビデオを学習ツールとして使用し、ジュニパー Mist API のさまざまな使用方法について理解を深めましょう。

便宜上、ジュニパーのMist自動化ビデオをここに配置しています。ビデオを見て、さまざまなAPIの使用例やデモを理解できます。これらのビデオは、このガイド全体の関連トピック内にもご覧いただけます。

自動化ビデオ

At MIST, we offer a multitude of webhooks designed for a wide variety of use cases, ranging from network diagnostics, location analytics, network security, and network health. In this video, I'll give a brief description of every type of webhook and some of their potential uses. Since this may be your first time exploring webhooks, I'll also give a quick summary for what webhooks are and how they're used.

So imagine you want to monitor when your access points go offline. You could do this by constantly pulling MIST API and waiting for a response that shows an offline AP. The problem is, this is a resource-intensive process on both the server and client end, and it's a huge waste of bandwidth.

Webhooks solve this problem by automatically sending a post to your endpoint when a particular event occurs. In our example, this would be when the AP goes offline. MIST webhooks send data for network security, APs, location, organization audits, clients, and network health.

Each webhook has a unique set of data, so let's quickly examine each one. First, let's start with alarms. These are security, MARVIS, or infrastructure events that a network administrator chooses to alert on so they can take action to resolve the issue as soon as they receive the alarm.

Security alerts include network security threats such as rogue APs, vSSID spoofing, and honeypot SSID detections. MARVIS alerts are based on issues the MARVIS AI engine has recognized, which include failures such as missing VLANs or DHCP failures. Infrastructure alerts include information on down APs and AP restarts.

These alarms can be checked through the API, sent to an email, or sent through a webhook. For deployments that require a high degree of security and continuous functionality, recognizing and resolving network security threats or infrastructure alerts is of utmost importance. If your deployment has these needs, streaming alarm data through webhooks is the way to go.

Now, if the webhook setup isn't feasible, you can easily send alarms to one or more emails of your choosing. We wanted to give our customers the option to analyze location data themselves in a way that can be tailored to a more specific use case. For example, if one is interested in building custom heatmaps and visualizations, then the location webhook would be a good place to start.

Location webhooks can also be used to take real-time action in response to a client's location. We've seen this used to monitor client entries into restricted areas, so a security response can be initiated as soon as the webhook is received. The audits webhook is a great way to maintain tight control over your organization.

MIST provides audit logs to record when configuration changes occur on your org, who made those changes, and what the change was. The advantage to using webhooks here is the ability to receive real-time information. The audits webhook will send a notification to your endpoint immediately after any configuration changes are made.

It can also act as another security measure to ensure only authorized changes are made to your org. If unwanted changes are made, you'll know immediately. The device events webhook sends real-time updates upon receiving changes in AP configuration, changes in RRM, AP restarts, AP inventory updates, firmware upgrades, and AP disconnects.

This is a webhook for those who are interested in closely monitoring their APs. You may consider using the device events webhook if you want as much AP-specific information as possible to quickly diagnose and resolve network issues. The client sessions webhook reports every time a client disconnects from an AP, while the client join webhook reports every time a client authenticates.

The client sessions webhook payload includes network information about each client including connected time, channel, band, SSID, and WLAN. The client join webhook provides similar information but also supplies an RSSI value. These two webhooks can be used for understanding where clients are moving throughout a deployment, but can also be used to generate real-time network analytics from the client perspective.

Lastly, the device up-down webhook is a very simple but useful webhook. First, you'll need to set a threshold time, then the webhook will send an alert every time an AP disconnects that's longer than the set threshold. This webhook also sends a payload when your APs return online, as well as when they restart.

For larger deployments, this is especially useful to use. As deployments scale, having an automatic notification for disconnects is essential. So in summary, Mist offers webhooks to immediately send notifications for many different event types.

Webhooks can be a great tool for monitoring your network, but they can also be leveraged to build analytics. Keep in mind that there are many uses for webhooks not mentioned here, so I highly recommend exploring webhook documentation to better understand all possibilities. In the next video, we'll talk about setting up webhooks using both the API and the Mist dashboard.

So, how do I do this? How do I make this happen with robots? So, this is not something that's supported, right? This is one of those things, like I said, this is kind of hacky, kind of unofficial. I just wanted to show you some, like a cool, fast way to get information in and out of the Mist dashboard. So, again, the professional, super, you know, legit way is to hit the question mark and then you look at API documentation, but we want to do just exactly what the dashboard did.

So, if I go in here, this is just Chrome, as you can use Firefox, Chrome, whatever. They have these developer tools, and I think they're for more like web developers, but we're going to use it in a kind of a different way. So, this thing records the traffic that's going to and from basically the API.

So, on this network tab, we click network tab, and then we're going to go into Postman so I can show you. I created an automation boot camp, like workflow, work site, and then I did just a couple of folders, right? So, we're going to change, we're going to add stuff to each one of these folders to do exactly what we did manually just a second ago. So, I'm going to, and I actually made an API test just so that I could see that my, I'm going to try real hard not to show you my API token, but I've got it in a global variable that I can't highlight, but it's like right there, and then it's basically a no body. I'm just doing get to API self. So, if you click on that, you can see that I get data. So, I know that my API token works, and then we're going to drive off of that because I know I'm going to accidentally show you that.

And then, so now we want to see like how, how did I make the template? How did I do the very beginning template? How did I do that? And how can I replicate that? So, what we're going to do is we'll do create template, and then I'm going to go back into this developer tools thing, and we're going to do NAC template again, and this is a little bit trial and error because it's not, you know, it's not something that's supported or documented or anything like that. It's just something that this is just the way that it works so that we can, we can take a, you know, we can just take a look in it and see how it works. So, I'm going to stop that, and when you click on these, you can see what's going on if my windows are out of the way. And so, really, we want this one. So, you can see it went to api.mist.com, blah, blah, blah. It was a post, and then all the way down at the bottom, you can see that that's the payload.

So, we're going to actually just remake this thing in Python or in Postman. So, I'm going to copy this. I'm going to go in here, and then we're going to do, because it's an org template thing, we're going to add a request, and we're going to say create org template, and we'll hit, I keep jockeying these windows around that you probably can't see, but we're going to hit make, and then get in here, paste this out, and again, we saw that it was a, that it's a post right here.

So, we go back in here, and we say we want this to be a post, and then my headers, I want authorization. Oops. And then, so, I also found out that if I copy and paste this variable, you don't actually see it. So, okay, you didn't actually see it pop up, because that's, you know, that's your super secret password to the keys of the castle. So, I'm going to save that, and then we also want a body, right? So, if I go back in here, you can see, I got to figure out how to move all this webinar stuff around. Scroll all the way down to this, and then we're going to hit view source. I like view source a little bit better, because then I can just copy and paste the whole thing. So, we're going to copy this, paste it in. We want just raw.

We'll hit paste, and so you can see that what's happening is it's going to my organization, and then it's going to network templates, and then it's going to post, it's going to make a new one, and we're going to name it NAC template. And then in here, in Postman, you can actually set this to conditional highlighting or whatever to JSON, and when you set that, it lets you, it allows you to hit this beautify button, and now you can kind of see it as a workflow rather than, you know, just all one block of payload. So, we're going to save that, and again, we'll go back over here, and we'll see that this has been created, but we don't, we want to do this with Postman, not manually, so we're just going to delete this one. And then we'll hit refresh to make sure it's actually gone. Okay, cool. So, it's gone.

Now, we'll just run what we have, and again, here's the response. We're going to end up needing this ID because this is what the rest of this stuff is based off of, and I only learned that through trial and error, right? I was just messing with this, seeing how it would work, and, you know, and just doing it this way. And again, this is, the only reason that this works is because this, the dashboard is asking the API on the back end how to interact with all the data. So, if this, if the API wasn't there, it didn't exist, then we wouldn't be able to mess with this. So, again, I think I hit the button, so I'll hit refresh on this. And like magic, it's there.

So, the one thing I didn't do, because I forgot, is added my host names. So, this is my, this is my NAC, and I need, we need that. Minus 1, 2, 3, 4, and then we'll hit okay on that, add this, get rid of that, 1.200, mist1234. Okay, so now, instead of hitting save right away, because we know this is going to save this information, we want to see how it's saving it, or what it's talking to.

So, back to developer tools, and then, now we hit save. So, now if we hit save, and then stop, we can see, this one's probably the right one, because this is our, this is our org stuff, so we see it's going to templates, blah, blah, blah. It's putting information in there, and then if we scroll down, we can see, okay, so, it's actually, this is my RADIUS config, so that's actually happening. So, let's just do that. That's, right? Like, so, we just made the thing, now let's do, we'll go in here, and then we'll do add a request. And we're going to say update org template.

And again, this could be something that you do all in one, like just in one thing. If you grabbed it when you created it, that could be something. But maybe not, who knows? So, now we got this, and then, same thing, I mean, this is like the cheaty, like, easy way to do it. I'm just copying and pasting now. Make sure that copied, and we're going to paste it in here. Looks good, maybe, I don't know, we're going to see in a second.

And then, I wish I could move this, and so, this one was a PUT, so we're going to go in here. I'm going to say PUT, and then, our header's going to be authorization, because we need that. We're going to copy this, so that you guys, again, that's so sketchy, like, I feel like you guys are going to get my API token at any moment.

But luckily, if something goes wrong, or this doesn't work, or whatever, I recorded this earlier, so we'll have a good version of it, so you can see exactly what's going on, and like, how I made it, just because this is kind of, it's a little bit all over the place, but I'm trying to show you how easy it is to just mock up whatever you might want to automate, so that that way you can say, okay, here in Postman, I'm doing, you know, the same thing that the dashboard's doing, and I don't necessarily need to super understand what the, you know, the API calls, or the JSON, or the, you know, this is kind of one of those things that, even though I'm, I guess I'm pretty advanced in the API stuff nowadays, it's nice to be able to just copy and paste, and just go from there, right?

So, again, I scroll down here, I'm going to hit view source, just so I can copy and paste this thing easier, and copy, and we're going to paste it into the body, raw, same thing, same as we did last time, paste that, turn it to JSON, and then that way we can beautify it, and again, this is exactly just what the dashboard was giving to the API, which gives to the back end, so we can see that it gave it the, you know, 192.168, and this is our password, again, same thing, blah, blah, blah, that's great, we're going to save it, and then we'll go back to it, and then close this.

So, if we delete this template, the whole thing, technically we should be able to run both of these things, and it should just work, so if I do this, and then this is the ID, we might need this, I'm not actually sure if we need this, so I'm going to copy it, and then in here, we can, oh, yep, so we'll need it, see how it says that, so this is our org, this is the org, and then it says network template, and it's going to modify this, so we just deleted that, so we're going to put in our new one that I just copied and pasted, and then we'll fire that one off, and then we'll hit refresh here, and so now it says that we made it, and then you guys can see it before I can, okay, so yeah, so that's everything that we wanted, right?

So that's pretty good for that piece, so now we want to do the same thing with the switch configuration, because we're just walking through the same thing that we just did, you know, manually, and again, manually, probably fine, it's probably something that you could just do within the constraints of, you know, out of the box operation of this, but I kind of just, same thing, right, it's just something that might be comfortable, I want to show you that it's a comfortable thing to do it in the dashboard, but then also if you just want a robot to do it, you can, so again, so we're in here now, and what we did last time was we inherited this thing, which is good, and then we did, what else did we change, so we changed this, we added a port profile.

So again, we'll do the same thing, we'll inherit this, and then we'll add one of these, .1X, and then we'll do our super secret, because I know Junos really well, hit that button, scroll through there, pretend like we know what we're doing, hit okay, and then before we hit save, we're going to do our little cheat again, and then go into developer tools, it's recording, and hit play, or go, and then, and you can see, and again, like you can see this stuff, right, so I see bundle, that's going to full story dot whatever, I don't really care about that, settings, okay, this could be interesting, this is going somewhere kind of neat, that might be something that we want, and then we'll look down here.

Yep, so we named it .1X, so that's a thing, and then right here, this is kind of interesting too, like all these numbers could be something, so that's a PUT, that's putting something in, network template ID, that could be interesting, let's just start with settings, just see what happens, so again, we're going to go into here, and now that we're kind of done with our org templates, I'm going to save it, and we don't need our API test either, and then we're going to go to site template, and we're going to say add request, I guess we want to update site template, go back in here, copy and paste, this is a little redundant, but at the end of this, hopefully we'll be able to see that I can just hit go on all these workflows, and then all these requests, and then it will make exactly what we did manually, automatically.

And same thing, where this is, this button right here, this code button is really cool, I'm not going to hit it, because you'll be able to see my API token, but this will let you export each one of these requests in Python, or I don't know, PowerShell, or whatever else is in there, so it's got a whole bunch of JavaScript, it's got a whole bunch of examples, and so again, you could copy and paste each one of these things, put them in Python, all in one thing, and then hit go on it, and it will just do everything that you want to do all in one go, rather than us building it as we go.

So we did that, and then we're going to view source, copy all this stuff, put it in the body, same thing, right, we're going to change this, I keep moving my, you can't see it, but I keep moving my webinar thing around, and again, so I hit beautify, so it's easier to see now, so I'm seeing that there's, here's my profile name, and, you know, whatever else that was changed in there, and again, this could be something that you want to change later or not, who cares, right, so save that, and then we will go back in here, and we'll see if it worked, so we're going to delete, take this off, and then we're going to take this thing off, hit save, and then we're going to do it in here, hit go, authentication credentials.

Okay, so that's probably important, right, so copy and paste this, authentication, authorization, and see, I'm just kind of, I'm just kind of building it as I go, like, I didn't really have a real, you know, super solid plan on how I'm doing this, and this is, again, it's like, it's definitely a different, like, approach to automation than, you know, Calvin and Brian were talking about, right, these guys are, like, you know, well into their journey in automation, and they're talking about, you know, connecting and integrating these applications together, and I'm just talking about seeing if I can make something talk to something else just immediately, right.

So I hit go on that, here's a whole bunch of stuff that it said, this is actually pretty important, like, you could go through here, and you could see whether or not it pass failed, what kind of thing you did, or, again, I could just go on here, hit boot camp, and then we'll see what happens, so what happened, we made .1x, but we didn't actually do this config template piece, so, like, why not, what happened, so now we're going to do, we're going to kind of sort of quasi troubleshoot it, so I'm just going to do NAC template, that's the only thing that I'm changing in this, again, we'll do developer tools, make sure it's on the network tab we're recording, hit go, and we'll stop it, I'll move my web thingy out of the way, and then we'll just look at it, so full story, don't care, that's options, don't care, it's probably this setting, maybe, we'll look in here, nope, we did that, so that's good, it's probably this guy, so let's see, no, that's a get, here's a put, let's do that, let's just see if that worked, so I'm going to say, we'll do a new one, actually, I'm going to go big brain on this one and just hit duplicate.

So, I don't have to copy and paste my password a bunch of times, okay, so instead of this, we're going to say apply org template to site template, again, you name it whatever you want, this is just kind of an easy way to sandbox this stuff, we're going to delete this, because we don't want that, we're going to delete this, because we don't want that either, kill all that stuff, and then again, back to the copy and paste game, like we're going to go in here, copy, and then go all the way to the bottom, change this to this, copy, paste here, it's already JSON beautified, so this is interesting, so you see that this thing is saying network template ID, and it's going to this site, and that means that it might be applying that to this site, so what was our, let's see, update site template, we didn't have it in here, our org template, that's probably our template ID.

So, if I hit save on that, this one might be a little easier to test, so we'll just go in here, boot camp, we'll take it off, save, go back in here, hit go, something happened, that's probably cool, we'll go back in here, hit okay, and you can already see, so that's what added that NAC template, so again, this isn't something that, like, this probably isn't in any kind of documentation anywhere, because it's just not, oh, so look this, this is actually overriding our templates here, so we don't want that to happen, so I wonder how we change that.

So again, I just, now I'm just doing the same thing all over again, it's a little bit of trial and error, it's a little bit of, you know, it's kind of scrappy and not really something that is, you know, in anywhere professionally or officially, but again, this is cool, because Calvin and I have actually done a lot of work together recently, and I like to put up a whole bunch of these things in there, and then just share this to him, so that that way, whatever he's using, whether he's putting it in Ansible or, you know, just using ServiceNow or whatever tool he's using, he can have the boiled down version of it right here, so he can see that this is, you know, this is actually what's the workflow, what's going on as far as talking to Mist, and then that way, at least, you know, there's a whole bunch of other complexities and all that stuff, so at least he's got my section down, and he doesn't have to really worry too much about it, because he knows that it works, this is really easy to share with other people, and then, you know, and then you're good to go.

So, we'll go back in here, we uncheck these, so we're going to see kind of why, like, I don't really know why those things were all overwritten, so we'll go back in here, and we'll hit save again, and it looks like it's just the same data, I mean, just kind of glancing at it, it looks the same, so I wonder if it has to do with the order in which we did that in, so let's just try that, so we're going to take this off, and then we're going to take this thing off, delete all this stuff, hit save, and then we'll go back to it to make sure that it's actually gone, yeah, so all this stuff's gone, so now let's just do it in a different order, let's do, let me put this up here, and we're going to do this one first, then we're going to do this one, and then we'll go back here, hit refresh.

See what happened, so now it applied the template, yep, it still overwrote them all, so we don't want that to happen, so let's take those off, we'll do it again, and then we'll go into here, actually, let's just make the whole thing, so that way we can just copy and paste easier, oh, we did, we did already, okay, cool, so I'm going to stop this, this is kind of how you'd like, see how it's doing some things that I don't really care about, if you stop this and then hit re-record, then you can get just what you want, so I'll hit save again, stop that, settings.

So we already know that we have that, but I'm just going to take all this and just redo it again, so copy this, put it in, this one was our, yeah, this is the body of this, delete all this stuff, you can do this with whatever workflow you want, you can do this with, I did, I've done this mostly with the wireless stuff, you know, if you want to look at the clients or whatever it is, you can just do the same thing, so now we're going to do network templates, we'll see if this changed, so that's a GET, so that's fine, this one was opposed to full story, we don't care about that, PUT, that's probably okay.

So, let's try that again, maybe that was different data, right, and again, you can actually dig into this stuff and really see what it's doing, but I'm just, you know, just firing away, delete that, hit okay, then we'll go and do it again, so we'll hit send on that, send on that, and it might actually be that I'm using the wrong work template, we can try the whole workflow again, we'll just get through it and then we'll see what happens, boot camp, so it applied that, okay, that was what it was, so we applied the template first and then it just, in that second payload that we copied and pasted, we said don't overwrite any of this stuff, and now we're good here, should be good, right, let's see, let's make sure, yeah, .1x, so now, all we want to do now is go to the switch, and again, this isn't best practice.

So, like what I would want to do is I probably would do the .1x stuff in the organizational level, because I want my whole org to be able to see where my NAC is, and then the rest of them, I would just PUT in this one here, and then I would just change, instead of going to the actual switch and applying this template to the port, I would just do it in here, and then that way I can, it'll just be in all one place, but I just wanted to show you that we can touch all of these facets of this thing, and then it's effectively the same thing, so we're going in here, and then all we have to do now, really, is apply this, apply our port configuration, right, so I'm going to say ge-0/0/2, and then I want my super expertly set up .1x.

I'll hit okay on that, and okay, that looks good, so we'll do, again, do the same thing, developer tools, hit save, stop this, it's usually at the front of this thing, usually it's, you know, something that's at the front, another cool thing is if you double click on any of these things, it'll drive you back out to the Django REST API framework, and you can see in human readable, like this is actually, this one was a get, yeah, so this one was a get, and it looks like it got a bunch of stuff, it got the devices and type switch, so this is all my switch configuration stuff, cool, not what we want, we want to actually put something, or like place something.

So, I'm thinking it's right here, yeah, so here's a PUT, and then if we scroll down, we can see, yeah, so it's changing things, this is where it's putting data, so we'll just make that, so we'll go into, we'll minimize these things, kill these things off, just for the sake of whatever, and then we'll make, add a new request, and we're going to say edit, switch config, we are going to make that a put, we're going to put our header in here of our token, hopefully this is the last time I have to show you the token part, so I don't screw that up, boom.

And then where are we going, we're going here, and what are we telling it to do, all this stuff, save that, put it over here, the body, raw, paste, again I kind of want to see what it looks like, because I'm interested, so now I can see that it's my switch, and here it is, this is the piece that we want, this is what it's changing, but again, I didn't code that, like I didn't do any part of that, I just copied and pasted, so we're going to save that, and then we'll go back over on our other side, close this out, and then we're going to take it away so that we can programmatically add it again, hopefully, save, so now we see that it is not in there anymore, and then when I hit the button, boom, stuff happened, and then scroll over here just to validate, and again this is something, like you can put this in a script all on its own, you can make it say hey, go out, validate, make sure you actually put this on, you put .1x on this section here, and you're good to go.

So now, let's put it all together, so let me delete, let me clean up the environment a little bit, so we want to delete that, that's good, we're going to go in here, because we're changing stuff all over the place, let's get rid of this, take this away, oops, take that away, take this .1x thing away, save, save, save, save, save, and then we're going to take the switch template, we're going to blow this thing away, good to go, all right, so let's just try, let's see what happens, let's go through the whole process, so let me open these things back up, so programmatically we want to create a template, that's the first thing, and then we're going to save this, because it's probably going to be useful, we figured out that that will be useful, update the org, remember we put this in here, save that, stuff happened, in here we got sites, let's see in the body real quick.

We'll see, oh, yep, so this is a network template ID, so it's probably this, again, shoot that out, make sure this doesn't have anything, yeah, this is our .1x, send that away, and then this one, same thing, we'll send this one away, and then in here, let's not even look at anything, let's just look at the end switch, see what happened, so now we see that we've got .1x assigned to this port, we've got our authentication servers have been inherited, our .1x has been inherited, and then, just to show that it did something, we will clear this screen, we'll enable this, and watch it not work, just because this is live, just kidding.

So there, that's it, so we basically just configured .1x, we learned how to walk through a manual workflow of how to mess with the dashboard, and then we put it in Postman, so that way, if we wanted to do this, if we wanted to scale this out to what Calvin and Brian and those guys are doing, that's super cool, that is the pipe dream, that's where I want to be, but I have to start somewhere, and this is how I start somewhere, this is if someone says, hey, can you get me the list of all the guest users on wireless and put it in a CSV file, I can probably ask Marvis to do that, honestly, but the cool thing about this system is that these APIs are all open on the backend, and I don't necessarily need to know the nuts and bolts of how it works to be able to use it, and use it the way that I want to use it, rather than the way that Mistis thought it would be useful for you to have it that way, so I think that's pretty much my demo.

Our mission is to create 500 sites in less than 5 minutes, onboard thousands of APs, and monitor all your users across all your sites on a single dashboard without any costly errors.

First, we create an org on the MIST dashboard. Log in, select your org. You may have a few. We're done with step one and now let's go set up templates. This org has RF profiles and three different WLAN configs as seen here. Now we have the templates, let's automate.

We asked the customer to provide a spreadsheet containing site names, site addresses, and any other required site info. The amount of sites could be in the thousands, but for this example, we did 500.

We will now automate the creation of 500 sites based on the information provided by the customer using a simple Python script. Note: it is a human-readable file and not very large. Now we run the script.

And create 500 sites in under 4 1/2 minutes. Mist's 100% API architecture allows you to fully automate this process, removing any chance of human error. Check the audit logs. Perfect. And now we can validate from the dashboard that all the sites were created correctly.