Wednesday, July 8, 2020
Nagios Tutorial For IT Monitoring
Nagios Tutorial For IT Monitoring Nagios Tutorial Continuous Monitoring With Nagios Back Home Categories Online Courses Mock Interviews Webinars NEW Community Write for Us Categories Artificial Intelligence AI vs Machine Learning vs Deep LearningMachine Learning AlgorithmsArtificial Intelligence TutorialWhat is Deep LearningDeep Learning TutorialInstall TensorFlowDeep Learning with PythonBackpropagationTensorFlow TutorialConvolutional Neural Network TutorialVIEW ALL BI and Visualization What is TableauTableau TutorialTableau Interview QuestionsWhat is InformaticaInformatica Interview QuestionsPower BI TutorialPower BI Interview QuestionsOLTP vs OLAPQlikView TutorialAdvanced Excel Formulas TutorialVIEW ALL Big Data What is HadoopHadoop ArchitectureHadoop TutorialHadoop Interview QuestionsHadoop EcosystemData Science vs Big Data vs Data AnalyticsWhat is Big DataMapReduce TutorialPig TutorialSpark TutorialSpark Interview QuestionsBig Data TutorialHive TutorialVIEW ALL Blockchain Blockchain TutorialWhat is BlockchainHyperledger FabricWhat Is EthereumEthereum TutorialB lockchain ApplicationsSolidity TutorialBlockchain ProgrammingHow Blockchain WorksVIEW ALL Cloud Computing What is AWSAWS TutorialAWS CertificationAzure Interview QuestionsAzure TutorialWhat Is Cloud ComputingWhat Is SalesforceIoT TutorialSalesforce TutorialSalesforce Interview QuestionsVIEW ALL Cyber Security Cloud SecurityWhat is CryptographyNmap TutorialSQL Injection AttacksHow To Install Kali LinuxHow to become an Ethical Hacker?Footprinting in Ethical HackingNetwork Scanning for Ethical HackingARP SpoofingApplication SecurityVIEW ALL Data Science Python Pandas TutorialWhat is Machine LearningMachine Learning TutorialMachine Learning ProjectsMachine Learning Interview QuestionsWhat Is Data ScienceSAS TutorialR TutorialData Science ProjectsHow to become a data scientistData Science Interview QuestionsData Scientist SalaryVIEW ALL Data Warehousing and ETL What is Data WarehouseDimension Table in Data WarehousingData Warehousing Interview QuestionsData warehouse architectureTalend T utorialTalend ETL ToolTalend Interview QuestionsFact Table and its TypesInformatica TransformationsInformatica TutorialVIEW ALL Databases What is MySQLMySQL Data TypesSQL JoinsSQL Data TypesWhat is MongoDBMongoDB Interview QuestionsMySQL TutorialSQL Interview QuestionsSQL CommandsMySQL Interview QuestionsVIEW ALL DevOps What is DevOpsDevOps vs AgileDevOps ToolsDevOps TutorialHow To Become A DevOps EngineerDevOps Interview QuestionsWhat Is DockerDocker TutorialDocker Interview QuestionsWhat Is ChefWhat Is KubernetesKubernetes TutorialVIEW ALL Front End Web Development What is JavaScript â" All You Need To Know About JavaScriptJavaScript TutorialJavaScript Interview QuestionsJavaScript FrameworksAngular TutorialAngular Interview QuestionsWhat is REST API?React TutorialReact vs AngularjQuery TutorialNode TutorialReact Interview QuestionsVIEW ALL Mobile Development Android TutorialAndroid Interview QuestionsAndroid ArchitectureAndroid SQLite DatabaseProgramming Contin... DevOps (84 B logs) Become a Certified Professional AWS Global Infrastructure Introduction To DevOps What is DevOps? A Beginner's Guide To Understanding DevOps And Its EvolutionWhat Are Important Pre-Requisites For DevOps Professionals?DevOps in various domains â" How DevOps solves the problem?DevOps Real Time Scenarios â" Know What Happens Real TimeWaterfall vs Agile: Which Is Better For You And Why?DevOps vs Agile! Everything You Need To KnowMystery of DevOpsInfrastructure as Code â" What is it and Why is it it important?Linux commands in DevOps: Must Know For Every DevOps ProfessionalDevOps Tutorial : Introduction To DevOpsTop 10 DevOps Tools You Must Know In 2020Understanding DevOps Tools Development, Testing Deployment Technologies Involved In DevOps Git Continuous Monitoring With Nagios Last updated on May 22,2019 43.4K Views Saurabh Saurabh is a technology enthusiast working as a Research Analyst at Edureka.... Saurabh is a technology enthusiast working as a Research Analyst at Edureka. His areas of interest are - DevOps, Artificial Intelligence, Big Data and...1 Comments Bookmark 7 / 7 Blog from DevOps Lifecycle Become a Certified Professional Nagios Tutorial:I believe there are very few posts on Nagios, and not much relevant information available over the internet. So, I think this post will give you a good clarity on this Monitoring tool. Nagios monitors your entire IT infrastructure to ensure systems, applications, services, and business processes are functioning properly. It is integral to the DevOps lifecycle and is a must for DevOps Certification. In this Nagios tutorial, I will be covering the below topics:Why We Need Continuous Monitoring?What Is Continuous Monitoring?What Is Nagios?How To Install Nagios?How To Add A Remote Server Using NRPE (Nagios Remote Plugin Executor).Lets begin this Nagios tutorial, by understanding why we need Continuous Monitoring because everything exists for a reason. So, lets try to find out that reason.Why We Ne ed Continuous Monitoring?Continuous Monitoring Tools resolve any system errors ( low memory, unreachable server etc. ) before they have any negative impact on your business productivity.Important reasons to use a monitoring tool are:It detects any network or server problemsIt determines the root cause of any issuesIt maintains the security and availability of the serviceIt monitors and troubleshoot server performance issuesIt allows us to plan for infrastructure upgrades before outdated systems cause failuresIt can respond to issues at the first sign of a problemIt can be used to automatically fix problems when they are detectedIt ensures IT infrastructure outages have a minimal effect on your organizations bottom lineIt can monitor your entire infrastructure and business processesYeah, it does a lot of cool work, but what is it?What is Continuous Monitoring?Let me first tell you where Continuous Monitoring lies in the DevOps life-cycle, consider the diagram below:Looking at the dia gram you must be thinking this is the last stage in the DevOps lifecycle, but this is not the case. There is no end to a DevOps life cycle, and that is the reason for the infinity symbol. Continuous Monitoring comes into the picture, once the application is deployed on the production servers.Continuous Monitoring is all about the ability of an organization to detect, report, respond, contain and mitigate the attacks that occur, in its infrastructure.Continuous Monitoring is actually not new, its been around for some time. For years our security professionals are performing static analysis from system log, firewall logs, IDS logs, IPS logs etc. But, it did not provide proper analysis and response. Todays Continuous Monitoring approachegives us the ability to aggregate all of the events that I discussed above, co-relate them, compare them and then estimate the organizations risk posture.If we take all these pieces and ensure the interlinking between them. This is the crux of Continuo us Monitoring.Let me explain this with a use-case.Consider the diagram below:Now, let me explain you the above diagram:We have various security tools, like Firewall, IDS, End Point Protection etc. they are connected with a Security Information and Event Management system.In order to achieve Continuous Monitoring, we need to have all the parts talking to each other, let me explain that to you.So we have security tools and series of End Points, this can include client and servers, routers, switches, mobile devices and so on.These two groups can then talk to a Security Information and Event Management system (SIEM), through a common language and in more automated fashion.Connected to this SIEM there are two important components, first one is a Data Warehouse. Now to this Data Warehouse, we will connect Analytics and Security Intelligence.Security intelligence(SI) is the information relevant to protecting an organization from external and insider threats as well as the processes, polici es and tools designed to gather and analyze that information.This SIEM is also connected to a Governance Risk and Compliance System it basically provides dashboarding.To this Governance Risk and Compliance System we attach a risk database. This gives us Actionable Intelligence.Actionable Intelligence is nothing butinformation that can be acted upon, with the further implication that actionsshouldbe taken.So here, we are Monitoring the events on the on going basis and determining what level of risk we are experiencing. With this, we can correlate the events at the SIEM. We can perform Network Behavior and Anomaly Detection at the Analytics Engine. This is what Continuous Monitoring is all about: The integration of an organizationsecurity tools, the aggregation, normalization and correlation of the data that is produced by the security tools.The analysis of that data, based on the organizations risk goals and threat knowledge, and near real-time response to the risks identified.If you cant measure it you cant manage it. I hope you know what I am talking about.Next up in this Nagios tutorial, I will be introducing you to one of the most famous monitoring tool Nagios.What is Nagios?Nagios is used for Continuous monitoring of systems, applications, services, and business processes etc in a DevOps culture.In the event of a failure, Nagios can alert technical staff of the problem, allowing them to begin remediation processes before outages affect business processes, end-users, or customers. With Nagios, you dont haveto explain why an unseen infrastructure outage affectyour organizations bottom line.Let me explain to you how Nagios works.Consider the diagram below:Nagios runs on a server, usually as a daemon or a service. It periodically runs plugins residing on the same server, they contact hosts or servers on your network or on the internet. One can view the status information using the web interface. You can also receive email or SMS notifications if something happ ens. The Nagios daemon behaves like a scheduler that runs certain scripts at certain moments. It stores the results of those scripts and will run other scripts if these results change.Plugins:These are compiled executables or scripts (Perl scripts, shell scripts, etc.) that can be run from a command line to check the status or a host or service.Nagiosuses the results from thepluginsto determine the current status of the hosts and services on your network.Lets now discuss its architecture.Nagios Architecture:Nagios is built on a server/agents architecture.Usually, on a network, a Nagios server is running on a host, and Plugins interact with local and all the remote hosts that need to be monitored.These plugins will send information to the Scheduler, which displays that in a GUI.I also need to explain you NRPE (Nagios Remote Plugin Executor).The NRPE addon is designed to allow you to execute Nagios plugins on remote Linux/Unix machines. The main reason for doing this is to allow Nagio s to monitor local resources (like CPU load, memory usage, etc.) on remote machines. Since these public resources are not usually exposed to external machines, an agent like NRPE must be installed on the remote Linux/Unix machines.Consider the diagram below:The check_nrpe plugin, resides on the local monitoring machine.The NRPE daemon, runs on the remote Linux/Unix machine.There is a SSL (Secure Socket Layer) connection between monitoring host and remote host as shown in the diagram above.Now in this Nagios tutorial, it is time for some Hands-on.Lets start by installing Nagios CoreInstall Nagios Core:The completeprocess to install Nagios can be summarized in four steps:Install Required Packages In The Monitoring ServerInstall Nagios Core, Nagios Plugins And NRPE (Nagios Remote Plugin Executor)Set Nagios Password To Access The Web InterfaceInstall NRPE In ClientStep 1: Install Required Packages On The Monitoring Server:Visit the website:http://dl.fedoraproject.org/pub/epel/6/Click o n i386, and then you will be redirected to a page.Since I am using CentOS 6, so I will right click and copy the link location of epel-release-6-8.noarch.rpm, as shown in the above screenshot.Open the terminal and use rpm -Uvhcommand and paste the link.We need to download one more repository, for that visit the website http://rpms.famillecollet.com/enterprise/Right-click and copy the link location for remi-release-6.rpmAgain open the terminal and use rpm -Uvh command and paste the link.Fine, so we are done with the pre-requisites. Lets proceed to the next step.Step 2:Install Nagios Core, Nagios Plugins And NRPE (Nagios Remote Plugin Executor):Execute the below command in the terminal:yum -y install nagios nagios-plugins-all nagios-plugins-nrpe nrpe httpd phpThis will install Nagios, Nagios Plugins, Plugins for NRPE, NRPE, Apache and PHPApache web server is required to monitor the current web server status.Php is used to process dynamic content of the site date.Next, we need to enabl e Apache and Nagios service:chkconfig httpd on chkconfig nagios onOur next step is to start Nagios and Apache:service httpd start service nagios startNow, I will enable swap memory of at least 1GB.Its time to create the swap file itself using the dd command:dd if=/dev/zero of=/swap bs=1024 count=2097152Swap is basically used to free some, not so frequently accessed information from RAM, and move it to a specific partition on our hard drive.Now that you have created the swap partition, use the commandmkswapto setup the swap partition. Thisis going to prepare the swap file by creating a linux swap area.mkswap /swapTo prevent the file from being world-readable, you should set up the correct permissions on the swap file:chown root. /swap chmod 0600 /swapIf you see no errors, your swap space is ready to use. To activate it immediately, type:swapon /swapThis file will last on the virtual private server until the machine reboots. You can ensure that the swap is permanent by adding it to the fstab file.echo /swap swap swap defaults 0 0 /etc/fstabThe operating system kernel can adjust how often it relies on swap through a configuration parameter known asswappiness.To find the current swappiness settings, type:cat /proc/sys/vm/swappiness Swapiness can be a value from 0 to 100. Swappiness near 100 means that the operating system will swap often and usually, too soon. Although swap provides extra resources, RAM is much faster than swap space. Anytime something is moved from RAM to swap, it slows down.A swappiness value of 0 means that the operating will only rely on swap when it absolutely needs to. We can adjust the swappiness with the sysctl command.To make your VPS automatically apply this setting every time it boots up, you can add the setting to the /etc/sysctl.conffile:echo vm.swappiness = 0 /etc/sysctl.conf sysctl -pFinally, we are done with the second step.Lets proceed further and set Nagios password to access the web interface.Step 3:Set Nagios Password To Access The Web Interface:Set the password to access the web interface, use the below command:htpasswd -c /etc/nagios/passwd nagiosadminType the password and confirm it by retyping it.Now, open the browser. Here, type your public IP or hostname/nagios. Con sider the example below:Here, give the user name and password. By default, the user name is nagiosadmin,and password is what you have set in the previous step. Finally, press OK.After this, you will directed to Nagios Core dashboard.You can click on hosts and see the what all hosts your Nagios Core is currently monitoring.You can notice it is only monitoring one host, i.e. localhost. If I want my Nagios Core to monitor a remote host, I need to install NRPE in that remote host. This brings us to the next step,install NRPE In client/machine that you want Nagios to monitor.Step 4: Install NRPE In Client:Alrighty then, lets install NRPE in the client machine.Firstly, you need to install the required packages like I did on my Nagios server machine. So, just execute the same commands, consider the below screenshots:Now install Nagios, Nagios Plugins and NRPE in client:yum -y install nagios nagios-plugins-all nrpeOnce it is installed, enable the NRPE service:chkconfig nrpe on Our next ste p is to edit the, nrpe.cfg file. I will be using the vieditor, you can choose any other editor also:You need to add the IP address of your monitoring server, in the allowed host line, consider the below screenshot:Here, the IP address of my monitoring server is 192.168.56.101.Now, we need to setup firewall rules to allow connection between monitoring server and client.iptables -N NRPE-A option is used to append the new rule to the end of a chain. If you want to put it somewhere else in the chain, you can use the -I option which allows you to specify the position of the new rule.The below commandaccepts tcp requests on ports 5666.iptables -I INPUT -s 0/0 -p tcp --dport 5666 -j NRPE iptables -I NRPE -s 192.168.56.101 -j ACCEPT iptables -A NRPE -s 0/0 -j DROPThis will basically configure iptables to accept packets from a particular host, in my case 192.168.56.101, and drops the packets from other hosts.Now, I will save these configurations:/etc/init.d/iptables saveStart NRPE service now.service nrpe startNow go back to the Monitoring server.Here, I need to edit nagios.cfg file.vi /etc/nagios/nagios.cfgUncomment the the line cfg_dir = etc/nagios/serversMake server directory, for that use mkdir command.mkdir /etc/nagios/servers/Change your working directory to servers.cd /etc/nagios/serversCreate a new file in this directory with .cfg extension and edit it. I will name it as client.cfg, and I will be using vi editor.vi /etc/nagios/servers/client.cfgHere add the below lines: This basically includes the kind of services I want to monitor. Give the hostname of the machine and its ip address which you want Nagios to monitor.Similarly, you can add number of services that you want to monitor. The same configurati ons can be used to add n number of clients.Last step guys, set the folder permissions correctly and restart Nagios.chown -R nagios. /etc/nagios/Now, restart Nagiosservice nagios restartOpen the browser and again type the host name or public ip/nagios/.In my case it is localhost/nagios/.Click on hosts to see all the machines Nagios is currently monitoring.Here you can notice, it is currently monitoring the client machine (hostname of the machine that I want Nagios to monitor). Basically, we have added a remote host using NRPE.I hope you have enjoyed reading this Nagios tutorial, I will be coming up with more blogs on Nagios soon.If you found this Nagios tutorial relevant, check out theDevOps trainingby Edureka,a trusted online learning companywith a network of more than250,000satisfied learnersspread acrossthe globe. The Edureka DevOps Certification Training coursehelps learners gain expertise in various DevOps processes and tools such as Puppet, Jenkins, Nagios, Ansible, Chef, Salts tack and GIT for automating multiple steps in SDLC.Got a question for me? Please mention it in the comments section and I will get back to you.Recommended videos for you What is Jenkins? Continuous Integration With Jenkins Watch Now Puppet Tutorial DevOps Tool For Configuration Management Watch Now Continuous Integration With Jenkins Watch Now Top DevOps Interview Questions And Answers Watch Now What is Docker DevOps Tool For Containerization Watch Now 5 Best Practices In DevOps Culture Watch Now DevOps-Redefining your IT Strategy Watch Now Ansible Tutorial For Beginners Ansible Playbook Watch Now DevOps Tutorial For Beginners Watch Now What is DevOps A Beginners Guide To DevOps Watch Now DevOps is Going to Replace SDLC! Learn Why Watch Now What is Git A Complete Git Tutorial For Beginners Watch Now Devops : Automate Your Infrastructure With Puppet Watch NowRecommended blogs for you All You Need To Know About Continuous Integration With Jenkins Read Article Install Jenkins In 5 Simple Steps | Jenkins Installation | Edureka Read Article Azure Boards: How To Get Started With Agile Planning on Azure? Read Article Git vs Github Demystifying The Differences Read Article What are the common Git mistakes and how to fix them? Read Article What Are Important Pre-Requisites For DevOps Professionals? Read Article Docker For Windows | Setting Up Docker On Windows Read Article Top 10 DevOps Tools You Must Know In 2020 Read Article Linux commands in DevOps: Must Know For Every DevOps Professional Read Article Kubernetes Tutorial A Comprehensive Guide For Kubernetes Read Article Docker Tutorial Introduction To Docker Containerization Read Article Docker Architecture: Why is it important? Read Article Continuous Delivery vs Continuous Deployment Read Article Infrastructure as Code What is it and Why is it it important? Read Article Secure Your Secrets With Ansible Vault Read Article What Is Ansible? Configuration Management And Automation With Ansible Read Article What Is Docker Docker Container ? A Deep Dive Into Docker ! Read Article Install Git Git Installation On Windows And CentOS Read Article AWS CodeDeploy: How To Automate Code Deployment? Read Article Why DevOps? 3 Ways In Which DevOps Improves Organizational Performance Read Article Comments 1 Comment Trending Courses in DevOps DevOps Certification Training72k Enrolled LearnersWeekend/WeekdayLive Class Reviews 5 (28700)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.