Meet Uptime Kuma, a Fancy Open Source Uptime Monitor for all your HomeLab Monitoring Needs

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this week i was looking for a fancy self-hosted option to monitor all of my services in my home lab i was looking for something that was open source self-hosted and well fancy at the same time at least a little more fancy than the old tool nagios i used to run a while back now don't get me wrong nagios is a great tool and great at what it does but i need something a little bit lighter and i'm tired of hearing that buzz every time something goes down i'd rather switch to something that's a little more and less that's when i discovered uptime kuma uptinekuma is an open source self-hosted option like the popular service uptime robot it helps you monitor all of your services running in your home lab or anywhere it can monitor http services looking for specific http codes or it could even scrape websites looking for specific keywords it can monitor tcp services so if you want to check to make sure that your ssh connection is up you can it can even do a traditional ping to make sure a system is up and it can even do dns record checking it's built on top of fancy frameworks like vue and bootstrap which will give us a fast and responsive and good looking ui it also supports fancy notifications that can be delivered via telegram slack discord email and 70 other services you can configure to deliver notifications just the way you like it also has a fancy status page just like some of the status pages you see on public-facing sites to report their service up time and you even get a fancy dashboard with history states and a list of all of your services that you're monitoring it supports fancy two-factor authentication two to help keep your dashboard safe and did i mention it's pretty fancy it really is gotta see it so if you're tired of and and want some more of join me as we set up and configure obtain kuma it really is fancy so today we'll get uptime kuma up and running then we'll configure a monitor of each type we'll configure an http and http with keywords a tcp a ping and even dns then we'll set up some alerts to make sure that we know when services go down and then we'll set up two factor auth to keep our dashboard safe and if any of this sounds good to you don't forget to give this video a thumbs up and subscribe if you haven't already i should mention that because it's a container you're gonna need some kind of containerization engine to run this on we'll cover plain old docker and docker compose but feel free to set this up using docker rancher kubernetes openmediavault or any other containerization platform that has docker or container d because it should work there as it will on my machine as it will on a server a desktop or a raspberry pi also all the documentation and configuration that we covered today will be on my documentation site and you can find that in the description below and so for us today we're going to use docker in docker compose we're going to use docker compose because it's pretty easy it's pretty common and it allows me to share my configuration with you so you can copy and paste it open up a terminal and run docker dash b and you should see an output then you should be able to run docker compose dash v and see an output there too if you do great if you don't see my documentation and it'll show you how to set it up next you'll want to run mkdir uptime-kuma to make a directory to keep some of the files that we're going to mount from docker they won't want a cd into that directory then you'll want to create a file called docker-compose.yaml and then we'll want to edit that file with an editor in our docker compose file we'll want to paste some configuration in there in this configuration file we'll want to paste the contents here and this is a simple typical docker compose file so first we have a version so this is the docker compose api version i'm using version 3.1 next we're going to define a service i'm naming that service kuma and then i'm going to use the image luis lam or luis lamb or louis lamb uptime dash kuma and then with a tag of one now you can use the latest tag or you can use any tag that's on docker hub but it seems like this one tag is what they want you to use and looking through the logs it looks like they just always update the one tag with the latest version of one next we're going to specify a container name and i'm just going to name this uptime-kuma next we're going to specify our volumes so these are volumes that will be mounted from the container to the file system on the host machine so on the left side is the path on our host system and on the right side is the path inside of the container on the left side i'm going to mount mine to my home directory to the user server admin to underscore docker files to uptime dash cooma and then a folder called data we need to make that folder data still but we'll get to that in a second and next we're going to expose some ports and so 3001 is the port that they expose internally so on the right side it's the inside of the containers 3001 and on the right side is the outside and i'm also going to expose 3001. now you can change this left side to be whatever you'd like but you can't change the right side and our restart policy i typically say unless stops so it's going to keep restarting itself if it crashes until we stop it ourselves and then security options one i typically use is no new privileges equals true and this is for permissions and it'll just make sure that nothing within the container can elevate itself and this is a pretty straightforward configuration so let's copy this and let's paste this inside of that docker-compose yaml file on our server or wherever it is and let's save this let's close out now remember in our config we were mapping to a data folder within this folder so we need to make a data folder so make a data directory then let's do an ls to see what's in here so we should have a data directory and then our docker compose yml file and this is all we need to spin it up so i run docker dash compose up dash d dash dash force dash recreate and i know i don't need to run the force recreate on the first time launching it but i do it every time because it always works we can run that now it's pulling down this image and it's created so if we run a docker ps we should see this here in the list and here it is it's starting and it was created 12 seconds ago and it's been up for five then we can do a docker logs uptime kuma to make sure it's running and we can see it's up and going and then we should be able to see our website if we go to the ip address on port 3001 and here it is so let's create our account create and here it goes it does look pretty fancy before we add some monitors let's go into settings really quick i didn't have to put it in light mode which is a good thing but if you wanted to be in light mode you would click light mode and then immediately go back to dark mode and if you set auto it'll auto switch depending on your device's light or dark setting so in here you can change the language you can change the time zone and if you're hosting this publicly you can choose whether or not search engine should be able to index this site and then you can choose your default entry page which is either dashboard or status and we'll see both of those here in a second here you can change your password and here you can set up two-factor auth so let's do that real quick while we're here so if we click on two-factor auth we can enable to factor off we can scan a barcode then we can enter a code verify our token it's valid save confirm we want it on and it's enabled that easy and then next we can export our backups for this machine now remember we're writing this data already to the docker volume that we created that data folder so you don't need to back this up but you could back this up through the ui now it says here it's going to have some sensitive information in that backup so to keep it safe and that history won't be included i couldn't see myself using this at all because i'm actually going to back up that data directory on disk so that it backs up everything including history but cool that it's here and then if you did use the web to export data you can use the web to import that data here as well and then we have options to disable auth log out and clear out statistics so pretty cool okay so let's set up our first monitor so our first monitor we're going to set up the type is http and don't be confused with https we'll set that up here in a little bit but we're going to set it up with http and so the way you would typically use this is you would hit a health check endpoint now you could put in a website like google.com and make sure google.com is up but that puts some additional load on google.com not like they really care but if it was your website every 60 seconds or so you would be loading that whole entire web page just for a health check so most of the time you want to have a dedicated health check endpoint and those health check endpoints are really simple they're usually like slash health and they'll respond with the 200 okay something very very simple so for example this is exactly what i'm talking about a health check endpoint so i have a health check endpoint set up on that raspberry pi back there sounds odd but i have it up there so that my other services can check to make sure that it's up it's not up then i cycle the power in that thing i know i've gone pretty far but i really do have a health check endpoint on there and this is the health check endpoint this is what i was saying like you don't want to hit the web page and load the whole entire web page it's a lot cleaner to hit a health check endpoint but if you don't have a health check endpoint we'll set up something a little bit better than this so don't use this one but i'll copy this health check endpoint from my raspberry pi i'll paste it into here and the friendly name is raspberry pi led okay the heartbeat interval is how often it's going to check that's totally fine 60 seconds retries i'll set it to zero and then how often the retries will happen since i have it to zero it doesn't matter so i'm going to keep it there and then you have options to ignore certificate errors this is great if you have self-signed certificates at home and then you have the option to upside down mode but it's kind of confusing but basically you're saying that hey if this service does respond then consider it down now there are a few edge cases where this makes sense but in most cases you're going to say hey if the service is up consider the service to be a next is max redirect so this is how many times you can get redirected 10 should be good it tends a lot of redirects but this would be if you set up a redirect on a public webpage to redirect to somewhere else let's say you had www.example.com which redirects to example.com that would be one redirect and then you had more so on and so forth you could set the limit here but 10 should be good and now our status codes are accepted status codes so really anything in the http 200 range for a status code is good it's considered good and this is typically what you want to choose but if you wanted to select other status codes in different ranges in the 300s you're typically going to get redirects 400 means you made a mistake and 500 generally means the server made some kind of mistake that's how i've always remembered it 200 is you're good 300 is go away 400 is i messed up 500 is you messed up which would be the server okay so we'll leave that in the 200 range next is tags and and this is just basically tags and we can add tags just to kind of group and color code some things so i'll call this one home and i'm gonna color it indigo and add it and then we'll save it so right away it's been added and right away it's actually down and i know why it's down i didn't check this beforehand but this server is on a vlan that can't contact that raspberry pi it means my firewall rules are working but those are the things you'll have to think about when you set this up so what we'll do is go to this cool site httpstat.us i use this a lot for development to test different status codes that are kind of hard to generate sometimes on a server but i'm going to grab a 200 okay so if we do http stat dot us 200 we should get a 200 okay and let's just edit this real quick plug that in there and then we'll save and we're back up cool so that's working and now we can see a percentage in some historical data if we click on it we can see all of the checks so we had two that fail and one that's up we can see our response time average response time the up time the up time and ah certificate expiration pretty cool yeah it's pretty handy didn't notice it that's actually really awesome and then we can see some data or some charts so some response time data and then the last couple of status or the last couple of queries down here so pretty cool let's add another one let's add another monitor type let's add a tcp port monitor type and next we'll give this a friendly name so this is one of my k3s servers so just name it k3s server the host name you can use an ip address or a domain name but i'll just use an ip address port is 22 we're going to see if ssh is open then again we have a heartbeat interval retries and retry interval so i'm going to add a new tag and i'll name the tag case or kubernetes we'll just make it red and then we'll add it and then we'll save so now i have a new monitor with tcp and here it is we can go into the details so it's hitting that ip address on port 22 which is ssh and it's making sure that it can connect on that tcp port okay so that looks good next monitor is a ping and here we're going to actually ping one of my k3s agents it's on a different ip we'll add another tag we'll select the same one see it's part of kubernetes okay and so after we save we can see them here in the list now let's add another monitor so next is http or https keyword so this is what i was talking about earlier if you don't have a health check endpoint that's going to return a 200 you can actually do something a little fancier here and you can actually hit your website and look for content on that website so that tells you two things one that your website is up and two that it's actually rendering the html i'll show you what i mean so let's check out my technotem.live website on technotim.life and then we're going to look for a keyword so on technotim.live we can actually look for a keyword on here to make sure that this page is actually rendering so let's actually look for nerd for life so let's copy that put it back here nerd for life we'll leave everything to the default and maybe we'll add a different tag we'll say that this is external and go blue and add and then save and here we go so we're getting from techno10.live we're getting a 200 ok and the keyword is found so that's pretty cool that tells us again two things it's up and it's rendering html so it's returning a page let's actually change that real quick just to make sure you understand what's going on here so what if i said random word rooster and we save it if we save it now you can see that it's considered down and let's scroll up here so if you look it's considered down so we got a 200 okay but the keyword is not found that's why i said that this is really cool that you can do this instead of just looking for http status codes because you can actually parse that page too so let's change that back just to make uptime kuma happy just look for nerd and we'll save that now let's consider back up on the next check okay so while we're waiting for that to check let's add a new monitor and our last monitor type is dns this might seem pretty obvious but we're going to check dns records so i can call this dns1 and then what's the hostname we're actually going to check for so let's check for one of my other servers so juno.local.technotim.live so that's an internal dns record and so the resolver right now is pointing at cloudflare but i want to point it internally to my internal dns server so i'm pointing it to my internal dns server and then i can choose the record type so for me it's just going to be an a record then i'll add another tag for fun home and then save then once we add it we can see our dns record is considered up so a nice easy way to make sure your dns server is up and resolving records now you can do this again too for a public one like if we change this back to cloudflare and saved it this should actually fail because this isn't a public record but if we search for something like google.com on cloudflare saved it then it will return with a status of up so now that we have these all set up we can actually go to our status page and here's our status page it's not in dark mode yet but let's edit this really quick switch to dark theme there we go okay so now let's save that and then let's edit our status page so let's add a group of services so let's add all of our monitors here and then save it and pretty cool right here we have a nice little dashboard almost like a public-facing site where we can see all of our services that we're monitoring and their status and this is really nice partially degraded service so they've automatically determined that because well because my site's down because we changed that but because one of these services are down in this group it's considering this partially integrated so super nice touch and you can even add incidents here too which is pretty awesome so if you want to create an incident say oops i did it again terrible singer but you can add a title and then add content or message to this so i'm going to say we're working hard to restore our services until then just wait longer okay so then we can choose an actual style too so we can choose info we can choose warning choose danger primary light and dark so let's let's go let's go danger let's go danger and we'll post this and here we go so we have a nice status page that shows how our services are doing this is why i said it's it's pretty fancy and it looks great too but we're not done yet we're not done yet so now that we have a services up and going we have a status page that's up we still haven't notified ourselves so we would like to know if one of these services are down and like i mentioned earlier you can configure up to 70 notification services it's super easy to do but we're going to configure one that i use a lot it's discord so we can do this in a few ways you can either do it on add a new monitor set up a notification or go into settings and set up notification we'll do that because it makes a little more sense but from here i'm going to choose discord and then we're going to give this a friendly name i'm just going to name it discord alert next we're going to add our discord webhook url so if you don't have a discord server it's totally free and it's really easy to get and if you have slack or some other notification or chat messaging system the configuration is very similar but in discord after i have my server set up we're going to create a web hook so it's pretty simple in discord we're going to go into our server settings and then in here we're going to choose integrations and then we're going to choose create a web hook so in here we're creating a web hook and so really quick web hook sounds super fancy but really all it is is a web endpoint that you can post data to all it is is a combination of a url and a payload and so that's what we're creating right here in discord is a url and then uptying kuma we'll send the payload to it so let's name this web hook i'm going to name mine just kuma and then you choose the channel you want it to post to i'm just going to post directly to general then we can give it an icon so i'm just going to give it an avatar and then we're going to copy the web hook url to our clipboard and save changes now the reason why it's not showing you this web hook is because a web hook is actually a secret too if anyone gets this web hook they could post whatever they wanted to this endpoint so treat this whole entire url like a secret too don't share it so now that we have that set up let's escape out of here let's go back to uptime kuma and we'll paste this here now i'll show you my web hook because i'm going to delete this before this video comes out but this is what i was saying is that this is actually a secret so don't share this with anyone it's basically security through obscurity because no one could guess this url so next we're actually going to name our bot so i'm just going to name akuma and then a prefix if you wanted so this is a custom message prefix and here they have the example hello everyone is dot dot dot so if you wanted to mention someone specifically or a group specifically you could in here but i'm just gonna put hello there's no need to mention anyone i'm the only one in that server but you could say mention network admins and mention the network admins for this specific alert or whatever you wanted you could mention yourself if you're the only one in there but i'm just gonna put hello for now so this is really cool you can actually enable this now for all new monitors that you set up let's do that say all new monitors and then another cool piece is you can apply it to all existing monitors you really thought of everything so rather than go back through each monitor and turn this on you can just say apply to all monitors before we do that before we save it let's actually test it so let's bring discord back up and then let's test it so test sent and here it is kumabot discord alert testing awesome so that worked so now let's save this so let's save it and our alert is set up so let's actually make this fail so let's change our dns see the hostname some mod host name like that let's save it here we go as soon as i save it it tells us hello your service dns one went down service dns one service url is https service url is https that's kind of weird service url i assume this would be a url if i had this setup on a domain the time it went down or time it triggered and then the error so query a record not found for this weird domain and today at 9 54. pretty awesome so let's change a few more of these let's go to our k3s server instead we're going to ping some ip that doesn't exist and save it and here we go again so our service k3s server went down service name is k3s server service url is the service we're monitoring on tcp port 22 so this tells me that ssh is down and then the time and then the error so here's here it could not connect to reach this host i don't know but let's see if this recovers if it actually sends a recovery alert so let's change this back to 19 and let's save it and it's up and it recovered man they did think of everything this is awesome exactly what i thought would happen but wasn't sure if it was there so this is pretty awesome we get the green check mark our service k3s server is up so k3s server service url on that port the time and actually the ping too so that's really sweet exactly what i was hoping would happen and so now that we've had all these fluctuations and services going up and down we've actually started collecting some logs and some data so we can see the stats of our services and each of the messages that triggered something so so here's that k3s server coming up here it is when it went down here was the message it had when it went down here's our dns query that it couldn't find and then the dns query it could find and so on and so forth and then we get quick stats right here so three up two down unknown and zero are paused and then if we go to our status page we can see our status message is still up and we can see a high level overview of our services they're not looking too happy so uptime kuma is really awesome not only is it very functional and we get lots of ways to configure monitors as well as notifications it also looks pretty darn good like this looks great so what do you think about taikuma are you going to use uptime kuma to monitor your services in your home lab or some of your public services are you not going to monitor anything at all or are you using something else let me know in the comments section below and remember if you found anything in this video helpful don't forget to like and subscribe thanks for watching but you spin up a media server you maybe do it on a pi or a low power device and then you're like well i might want to do some transcoding and then so you upgrade and you're like okay i'll do it on a server and maybe i need a video card in there and why not just virtualize it because then i can share all this infrastructure and then you're like okay well i need more storage than this usb attached drive maybe i'll get another drive and then well i don't want my media to go away if one drive dies so i'm going to create an array and you just go down the spiral path of you know then you end up like me with a dish shelf two three servers in a cluster and who knows what's going on or what will happen next
Info
Channel: Techno Tim
Views: 36,572
Rating: undefined out of 5
Keywords: homelab, home lab, technotim, techno tim, selfhosted, self-hosted, nagios, opensource, open source, uptime, uptime kuma, alerting, fancy, alternative to uptime robot, http, https, scrape, tcp, ping, dns, checking, uptime alerts, vue, bootstrap, monitoring your homelab, slack, discord, notifications, alerts, status page, service uptime, dashboard, 2fa, 2 factor authentication, docker, rancher, kubernetes, unraid, open media vault, omv, self hosted services, home services, containerd, monitoring, diy, container
Id: r_A5NKkAqZM
Channel Id: undefined
Length: 25min 23sec (1523 seconds)
Published: Sun Oct 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.