How To Install Prometheus Alertmanager and Grafana on Windows Server 2022 with Let's Encrypt SSL

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone welcome to Tech biology this is shubham and in today's video I am going to show you how to install Prometheus alert manager and grafana on Windows Server 2022 machine the same steps can be followed for 2019 and 2016 version of Windows server okay and let's first discuss about what exactly these tools are so Prometheus is a Time series database uh which lets you store The Matrix of a system in the form of time alert manager is a part of Prometheus which you can download as a separate binary and this will help you in sending the alerts on different channels like team slack your mobile phone message calls and etc etc there are many things that you can do on the other hand grafana is a visualization tool which uses the databases like Prometheus to create a visualization and this will help you in debugging your system performances and many different issues okay so let's say uh we our CPU is 80 for last five minutes and we want to send an alert so in that case we can create a rule in Prometheus and alert manager which will help us in sending an alert to A team's Channel and our IIT team can you know fix the issue so uh before I continue I have already created one script uh in Powershell which can help you in installing these tools automatically so if you have any project in your company which wants to automate this installation process then you can directly use this Powershell script and I have also listed all the switches that you can use with it I hope this will help you and I have also created a machine in Azure with the adns already applied and I have already whitelisted four ports into that machine first one is Port 80 that will be used by cert board to generate let's encrypt certificates next is Port 443 which will be used by grafana for https communication next one is 9090 which will be used by Prometheus and the last one is 9093 which will be used by alert manager okay so these are the ports that I've already whitelisted so let's get started with the Prometheus first okay so you just need to go to this URL from ets.io download and you you need to go for the windows right click on this link and then just copy the link uh I have already started the RDP to my as your machine Let's just expand it and open Edge I'm just pasting the link here press enter let's wait for it to download and it is downloaded okay so now let's go to downloads copy this file okay and then just go to C drive and create a new folder I've already created a folder named PGA it is short form for prom it is grafana and alert manager okay and then just extract it to this directory right okay so extraction is done now let's just rename this by folder so that you can call it easily so in this folder just open a CMD and then just call promises.exe okay so I think promises has started if we just go to Edge again and call localhost caller 9090 then you should be able to see prominent here okay so so this is very easy to install Prometheus uh the only thing which is missing is the authentication and let's encrypt SSL okay um well I mean in your production environment or in your company's environment you cannot let Prometheus open in public so you need to add authentication here okay so uh let's first uh start with SSL configuration I have just pressed Ctrl C to stop Prometheus for SSL I need to have one more uh tool to install which has been Acme let's just go to Google okay and type in Acme in the search bar it should shoot you to a URL which is the netmail.com in the download just download the latest version okay and let's just go to download downloads and then just copy this ZIP file again to the same directory that we have already created and extract this file okay I'm just going to rename this folder as wax all right now uh as I have already told you I have already created one DNS for for this website okay and I have already pasted some commands in my notepad plus plus so I'm just going to copy these commands which will help me in making Windows 10 easier okay so uh let's open a CMD again and I'm going to paste this command in this command what I have done is like I have called wacs.exe which is in the same folder that we have just extracted and then I have uh named it source as manual because we are not going to install any certificate on a tool which is is or something was CS or wax comes with some functionality which lets you install certificates directly to IIs so you can use it if you are using IIs website then we have hyphen hyphen host parameter where you will supply your DNS that you have created then The Hyphen iPhone store is Spam files because we are going to generate pem files for the certificates that bam files path is a path where I will install my certificates then accept us is acceptance and conditions and email address is mandatory so I have supplied my email address I am going to go to my PGA folder and I am going to create a new folder with name SSL here I will uh store all my certificates so if everything goes fine this will help me in generating the certificate okay so press enter it is trying to fetch these certificates okay so everything looks fine it has created the certificates let's go to SSL folder and you can see there are four files and two of them we need to use which is the second last one and the last one sort and key all right so uh yeah let's go to the Prometheus and let's create a new fold new file with name web hyphen concrete okay and uh the extension is yaml all right so uh let's open this file and I need to copy one uh configuration here which is TLS server config okay so guys all the commands that are listed here I'll copy them into the medium blog which I have already created you can go to medium and search for my blog the link is also in the description if you are having difficulties in following this video tutorial just go to the medium blog there all the commands are listed as well okay all right so I have created the web.config file I have pasted the TLs server config so TLS server config has two parameters which assert file and key file search file is the file uh which is having hyphen CRT at the end and the key file is the file which is a hyphen key at the end so in the SSL folder we have both the files I have given the same path here all right so I need to just save this command go back to my CMD where I initially ran Prometheus just to start again Prometheus and give one more uh switch here which is web config dot file and you need to supply the path for the web hyphen config.file which is my C PGA and then from it yes and the config okay so it should run now so I have started this file and uh now I need to access parameters with the DNS that I have supplied so this is my DNS and let's go to my Chrome part and let's call it with https and 99 sorry okay so as you can see from it has started loading and there is a icon which says it is https secure and if I go to this certificate it is showing the date from which to which state it is valid okay so this is what Prometheus has installed with https the last thing that we need is the Authentication okay so which is missing uh for authentication we need to generate a password in decrypt format so this is the website called pre-crypt hyphen generator.com here you can type any of your string so let's say I am typing hello as my password let's encrypt and then I can just copy this uh you know string there is one more configuration that we need to add which is basic authors into our web python config.aml file let's go back to our file and then enter this config here and the encryption encrypted string that we just copied uh we can paste it in place of the string that we already have okay so I am going to go to here and then I'm going to paste this here all right the first part of this parameter is the admin or you can say any username that you want I'm just going with the admin username and the password is hello which is encrypted here all right okay so I have saved this file again I need to go to the place where my parameters was initially running and I need to just run the same command again okay no change is required with web.config and if I go back to the Prometheus URL again and reload this page it is asking me for a username and password so I am going to type the same that I have just added and Promises started loading with https and authentication so here is how you secure Prometheus with https and Authentication uh you can just try adding some of the target servers for now okay so okay so this is what promise is installed the next step is to install the alert manager okay so alert manager is a part of promises but it doesn't come with its binary folder so you need to download it separately okay so if I go back to the same page where we downloaded Prometheus uh just installed on and you will find this alert manager for Windows copy the link for Windows and paste it into the edge inside the machine okay and it is downloading and download is complete go back to the downloads folder go to downloads folder and copy the alert manager chip file to the same folder where we were initially working on so I am going to paste it here extract the file okay and extraction is done let's rename it to alert manager that's also done and we can do one thing like just we created a web.config file in Prometheus the same file works with alert manager for authentication okay an SSL as well so I'm going to just call CMD inside this alert manager folder type alert manager and the same uh switch that we give for promises we need to give here which is web dot config dot file and that is our c PGA and let's give it alert manager and welcome config.tml and it's it looks like it is started now let's go to our Chrome and then call again the same URL sorry one bad promoters and the 9093 this is the code for alert manager and you can see it is again asking me for the same username and password and it is installed so the last thing which is remaining is the grafana so let's go back to my Chrome and I have already opened a link which is grafana.com download and platform is Windows uh there are two ways that you can install grafana with it is a Windows installer or a standalone Windows binary file I'm going to go with the download the zip file because I feel this is the easier way of installing rifana I am just going to copy the link for this ZIP file go back to my Edge and again I will paste the link inside the machine it should start downloading and it is downloaded go back to the downloads folder copy the graphana folder grafana zip file back to the PGA folder paste it here and then just extract all the contents okay so grafana is also extracted just rename the folder with gray funnel name all right okay so uh for grafana first we need to configure the config file for it okay so if I go to the gray final folder and then con folder there are some default files and Sample files which they say we should not use okay so what we are going to do is we are going to copy the sample file and just and then just we are going to give it a name with grafana DOT ini okay so I'm just going to edit this file now so I have opened this file which wherever you see column hash these are commands not used okay so what we can do is like we can just uncomment the data part and then why we need to uncomment it because as you can see the default path is a Linux path and when we run it it might create errors okay so what I'm going to do I'm going to just rename this uh path with the actual paths the log uh so data path there is no data path I need to create a new folder inside graph on a with name data and else also I need to create a new folder with name logs or log whatever you want I will create a new folder with name logs and the next two which is plugins and provisioning are a part of it which you can even omit that's fine but if you want you can just provisioning you can give this path which is provisioning okay so uh let's just uh apply these paths here I'm just popping here from here to there data is done next is our logs and logs are all done all right then now the plugins you can give a path for the plugins if you have already installed some plugins you can give them as well the same part okay let's go here again I am going to just give this plugin bundle path that's fine okay and then last one is provisioning provisioning is Con slash provisioning so we're going to go here on and then you want to go with this part okay let's just do one more thing instead of plugins bundle we are just going to give the plugins path and create a new folder with the plugins name okay here you can paste on the plugins that you have downloaded from somewhere and you want to use all right so let's save it and then we have a protocol which is https that you want to use so I'm going to just rename it with https HTTP address we we need to give a new address here which is 0.0.0.0 this will help us bind our IP public IP to grafana all right HTTP Port is 443 because we want to run it on https so I'm going to give it 4.3 domain is your DNS so we have already created one DNS I am going to go to my notepad plus plus I'm going to copy this uh DNS into the machine uh this is my rdb is the RDP and I'm going to paste it here all right so these are the parameters that we need to change and the last one is this third key and third file we need to give we have the paths in SSL folder we can go to this SSL path all right so let's just copy this and cpgssl and we will see GGA slash SSL slash our certificate file and then we can just open paste the same with key file all right so this is done and uh we can just try now with the graph 100. yes let's go to Griffon and then bin file we have this great Finance server.exe just let's open this script Panna uh CMD all right and hyphen iPhone config equal to C PGA and then we have con and then we have graph final dot ini so let's run it so it is loading might take time to start for the first time because it is applies some of the migrations and I think it is done uh let's see country dashboard providing files remix fine treat alerting provisioning that's fine continue notification okay some of the things that it commented but that's fine let's see if our server is running what we need to do we need to go back to this URL and without any port this time so from it yes let's move this port let's see if it is running so as you can see it is running and it is pointing to the login URL you can see it is https connection is secured with the same certificate okay the default are admin and admin then let's just log in and you can just skip forward now okay no skip it and then griffana is live so as you can see three twos have been installed and these are not a hard installation I say uh but you can install it on your own with this video and I think it will help you the last thing which is remaining it is the services that we can install on Windows because we cannot uh always come and run these cmds for all of these tools so let's just Ctrl C for all these CMD that we have opened all right what the system is really hanging now because I think three tools are too much for the same okay so let's just do the final thing let's install the services for that we what we need to do we need to download one more tool which is called nssum non-sucking Windows sorry no setting service manager I mean you may know because how to use sccsc.exe to install Services might be sucking so let's leave it for a different discussion let's download this latest release which was back in 2014 don't worry this software works well till now so let's go to the downloads folder again copy the nssm binary to the same folder so let's extract this nssm binary so let's click on extract and then just remove this and SSM is also extracted let's now rename this to nssm only okay so I have renamed it so inside a system we can go to win64 and then we have an annual system.exe let's just open CMD here and we will install three services I have already copied the commands for all the services so first we will install a prom it is okay so let's let's open Powershell now you can use any of the things that's fine all right so I'm just opening Powershell space the command uh why have open Powershell because I have created this command for Powershell but you can use the same commands inside CMD it is easy to read this command in Powers also that's why okay so uh in this inside Powershell you can see I have this nssm.exe we have this install parameter and then the service name okay after that we need to supply the parameters that we want to run with okay so our first service is Prometheus and I have given the path for the promises.exe and there are a number of parameters that I have given first one is the config.pile and then I have given the promise.aml path which is the configuration file for parameters like where you will mention all the targets that you want to monitor okay next is storage.psdb.path where you want to store the data web.config.file we know where we have authentication in SSL templates uh you can omit these two parameter templates and libraries these are all the console libraries and consoles uh the next one is web.listen as address it is zero zero zero zero colon nine zero nine zero so zero zero zero zero this kind of Ip helps you connecting your uh softwares to the public IP for Azure machines I wasn't able to face any challenges uh with the even I give this or not that's not a problem but for some of the clouds that we have I was facing some challenges uh binding the DNS to my Prometheus software or any software that I was installing so giving this uh listen address was able I was able to solve this problem okay so if you have any issues of the same kind you can just give this listen address or else you can augment it the external URL is our URL okay or the DNS web enable lifecycle is a switch where you can enable the promoters lifecycle to automatically delete the old data and the next option is storage.tsdb dot retention dot size will help it determine what kind of data we want to delete so whenever it reaches 10 GB it will delete the older data okay so I am going to press enter and it will create a service which is installed successfully it is not yet started next is our grafana service grafana service is the same I am going to uh just paste it here and then you can see install graphana service and the binary of credit financial.exe and The Hyphen iPhone config the config file all right so this is also installed the last one is the alert manager let manager has the same type of parameters that Prometheus has to be able to install alert manager alert manager.exe config.file our alert manager.tml file cabinet config file over SSL and https file and over SSL and authentication file web listen is zero zero zero and external URL is https so keep in mind that for Prometheus we have this external URL without https but for alert manager we have external URL with https okay so press enter and let's just go to the services let's see where services are installed so uh the first service is alert manager let's start this so restart next one is the grafana let's start this restart now last one is Prometheus now let's start this as well so it is also started now let's go back to our Chrome and then try to reload these Pages see if these are actually installed or not okay so all Advantage is working Griffin also working now let's see our parameters I promises is also working okay so uh these three tools are now installed with https and authentication and I hope you like this video and if you like this then don't forget to rate comment share and subscribe my YouTube channel also please go to medium and uh please try to follow me there as well okay so I hope uh this will help you and I'll see you in my next video thanks for watching have a nice day
Info
Channel: TechGOELogy
Views: 6,297
Rating: undefined out of 5
Keywords: Techgoelogy, How to install prometheus, How to install grafana, How to install alertmanager, How To Install Prometheus Alertmanager and Grafana on Windows Server 2022 with Let's Encrypt SSL, How to install Prometheus Alertmanager and Grafana on Windows Server 2019 with Let's Encrypt SSL, How to install Prometheus on Windows Server 2022, How to install Grafana on Windows Server 2022, Install prometheus and alertmanager with authentication, How to install Grafana with Let's Encrypt
Id: NlmArL07Vgc
Channel Id: undefined
Length: 26min 34sec (1594 seconds)
Published: Thu Aug 25 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.