SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Nrpe.cfg




/etc/nrpe.d/custom.cfg
Default.rb




             Hosts.cfg.erb
Services.cfg.erb
hosts.cfg




            services.cfg
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite
Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite

Weitere ähnliche Inhalte

Andere mochten auch

Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentationMurat Çakal
 
6 Dean Google
6 Dean Google6 Dean Google
6 Dean GoogleFrank Cai
 
Cassandra
CassandraCassandra
Cassandrapcmanus
 
Pregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph ProcessingPregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph ProcessingChris Bunch
 
Writing and testing high frequency trading engines in java
Writing and testing high frequency trading engines in javaWriting and testing high frequency trading engines in java
Writing and testing high frequency trading engines in javaPeter Lawrey
 
Understanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache CassandraUnderstanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache CassandraDataStax
 
SQL, NoSQL, BigData in Data Architecture
SQL, NoSQL, BigData in Data ArchitectureSQL, NoSQL, BigData in Data Architecture
SQL, NoSQL, BigData in Data ArchitectureVenu Anuganti
 

Andere mochten auch (7)

Scaling web applications with cassandra presentation
Scaling web applications with cassandra presentationScaling web applications with cassandra presentation
Scaling web applications with cassandra presentation
 
6 Dean Google
6 Dean Google6 Dean Google
6 Dean Google
 
Cassandra
CassandraCassandra
Cassandra
 
Pregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph ProcessingPregel: A System for Large-Scale Graph Processing
Pregel: A System for Large-Scale Graph Processing
 
Writing and testing high frequency trading engines in java
Writing and testing high frequency trading engines in javaWriting and testing high frequency trading engines in java
Writing and testing high frequency trading engines in java
 
Understanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache CassandraUnderstanding Data Consistency in Apache Cassandra
Understanding Data Consistency in Apache Cassandra
 
SQL, NoSQL, BigData in Data Architecture
SQL, NoSQL, BigData in Data ArchitectureSQL, NoSQL, BigData in Data Architecture
SQL, NoSQL, BigData in Data Architecture
 

Kürzlich hochgeladen

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 

Kürzlich hochgeladen (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 

Automated and Adaptive Infrastructure Monitoring using Chef, Nagios and Graphite

Hinweis der Redaktion

  1. Monitoring…. The title of my talk lays emphasis on two words…. Automated and Adaptive….Automated?In general context an Automated task would mean a task that is controlled by code or control systems in a manner to reduce manual effortsAutomating a monitoring solution would in all essence of the word mean the same. Once your scripts are configured, yours systems are monitored…So why did I add the word Adaptive??? Automation does the trick right?? Imagine a scenario where you have an infrastructure solution that is scalable, a cloud solution per say, how do you reduce the effort of manually planting the monitoring scripts into the new boxes that are spawned up??The adaptive part comes into effect when your solution can accommodate the probability of application specific monitoring. Say a web server running passenger would be configured with scripts that are configured fetch passenger service related status or say a Go agent (Consider Go as the default CI from here on) would be configured with scripts monitoring the agent service and not passenger.So basically all custom services would be adaptive-ly monitored and this would happen automatically when they are spawned…
  2. The automated and adaptive monitoring can be achieved in one way by using Chef as the configuration management tool, Nagios as the monitoring tool and Graphite as the graphing/ plotting tool.
  3. For any sort of automation in infrastructure, the first and foremost requirement is a Configuration Management tool, Chef in this case.Chef works on a client server setup where the all chef-clients, known as Nodes in Chef Terminology, are registered to the Chef Server.Chef has its own DSL in which all the code used to monitor the nodes is written in. The code so written is called a Cookbook.Chef also enables you to perform specific searches to gather information of the entire infrastructure.It allows you to scale your infrastructure, each new node created has a client configuration file where the chef server url can be set to point to chef server configured for your environment.There is a misconception about chef that I heard in one of the previous talks is that Chef can only be used to configure servers. Well that’s not the case… chef can configure a system.. The system’s functionality is decided by the cookbooks we assign to it.Another doubt that is raised is when I change a cookbook and upload it to the chef server, do my chef nodes get a trigger to compile and execute cookbooks. The answer is NO. You can write up script to enforce it.
  4. Starting with the most important component of a chef configuration management system… The chef-serverCentral distribution point for cookbooksManagement and authentication of nodesEnabling searchComponentsAPI Service : chef-server, chef-server-api running on port 4000Management Webui : chef-server-webui running on port 4040Indexer : chef-solr-indexer running on 8983Queuing server : RabbitMQ-server. Whenever data needs to be indexed, the server sends a message and the data to the queue and the indexer picks it upDatastore : Couchdb running on 5984. It stores data of nodes, roles etc as a JSON object
  5. Coming to the chef client…. A chef client is a node registered with a chef-server.It is the node where all the cookbooks are compiled and executed.How does the client know which server to talk to?? This is set up in the client.rb file which is the configuration file for the client set up.In essence all properties that are searchable are stored as keys in the json with values that are set when the cookbook is compiled in the node i.e. during runtime.
  6. Cookbooks are fundamental units of dictribution in chef… basically, all the magic is configured in them…A cookbook can containAttributes : These are values on the node that can be set default values and used through the cookbook.Libraries : Can be written to add helpers with the codeFiles : This directory contains static content files that can be distributed in the nodes using the cookbook file resourceTemplates: These are rendered on chef-clients and values within the templates are dynamically set during the execution of the cookbook on the client nodeRecipes : These are Ruby scripts that are executed on the client and they specify the resources to manage and the order of their executionMetadata : contains information of the recipes in the cookbook, version constraints, supported platforms, dependencies included etc.Definitions : Allows you to create re-usable collections of one or more resources.
  7. Roles enable the admin in setting up nodes based on functionality and consist of attributes and run_list. A run_list includes cookbooks required to achieve the functionality we want the node to have.When chef-client runs it merges its own attributes and run_list with those of any roles assigned to it.For Example : If is have a list of recipes that I require to set up a CentOS node and another set of recipes that I require to set up a web_server. I can easily club the recipes and create two roles CentOS_node and web_server.Roles can be created in four ways but the simplest way is to create from a ruby script.If you have set up environment specific recipes then you could also define environment run_list as env_run_lists "prod" => ["recipe[apache2]"], "staging" => ["recipe[apache2::staging]"]
  8. Nagios is a very effective monitoring tool which provides, among other featuresThe ability to monitor your scalable infrastructureIt provides a dashboard to enable a consolidated and centralized visibilityOutage detection based on custom warning and critical levels.Outage alerts via emails, sms, pager etc.Problem acknowledgement for known issues or the problems where the work is still going on.And alert Escalations.
  9. Nagios reads its configuration data from text files.These files are located in /etc/nagios directory.The primary config file is the nagios.cfg file.Specific configuration files are located under /etc/nagios/objects which includecommands.cfgcontacts.cfghosts.cfglocalhost.cfgservices.cfgtimeperiods.cfgtemplates.cfg
  10. Nagios templates are exceptionally useful in case you plan to customise each host.These are some sample templates which are used widely in the nagios configuration files.A generic-host, service and contact. For an infrastructure where one has a mixture of hosts say windows and linux we can create host templates accordingly and finally “use” them in the hosts and services configuration files. This will be seen in the coming slides where we’ll discuss a small automated nagios set up
  11. After setting up the nagios server we need to understand how would it monitor the remote infrastructure. This is enabled by a plugin called the NRPE pluginIt retrieves the status of remote services.Consists of chef_nrpe plugin and NRPE daemon.The config fileis stored at /etc/nrpeWhen Nagios needs to monitor a resource of service from a remote Linux/Unix machine:Nagios will execute the check_nrpe plugin and tell it what service needs to be checkedThe check_nrpe plugin contacts the NRPE daemon on the remote host over an (optionally) SSL-protected connectionThe NRPE daemon runs the appropriate Nagios plugin to check the service or resourceThe results from the service check are passed from the NRPE daemon back to the check_nrpe plugin, which then returns the check results to the Nagios process.
  12. Consider I write a plugin where I want to query my nodes and retrieve the status of their memory… A custom plugin can be defined as above.. It is generally planted in the plugins directory for the nagios set up… Nagios identifies four exit values for each plugin so written, built in or custom…Exit Value 0 implies Warning and the display on the dashboard stays greenExit Value 1 implies Warning and the display on the dashboard changes to yellowExit Value 2 implies Warning and the display on the dashboard changes to redExit Value 4 implies Warning and the display on the dashboard changes to orange
  13. Well we can’t just write a plugin and leave the rest to the nagios and nrpe to figure out… we need to show them where we are putting in the plugin and where to pick the plugin file fromor what command to run to enable retrieval of data.The essential settings required for custom plugins is that the command that will use the custom plugin we create. In the nrpeconfig file we can add a list of directories where we would define the commands we create with the plugins we write.
  14. So we set up our NRPE to point to the right command and showed the config file where to pick up the plugin from. Now we go one level up, we show the nagios server what it needs to do to monitor our nodes. For nagios server to run the same plugin, we need to specify two things… The command that the nagios server will runThe service definition that it will query.
  15. So finally, when we talk of a custom nagios server, there are quite a few settings that an admin can do….Like adding hosts, defining timeperiods, defining contacts, contactgroups, services and commands that the plugins would query on the local or a remote host that the nagios server is monitoring
  16. So we now understand nagios and nrpe working together… how do we make our infrastructure scalable, automated and adaptive? Here comes chef….While setting up a nagios server the first task is to fetch all the nodes registered with the chef-server. A simple search can be written in the recipe to achieve this and the variables are then passed to the templates we covered in the earlier slides.The approach used here is template-izing all nagios server config files in the /etc/nagios/objects directory. During the compilation and execution of the recipe the nodes_from_solr collection is iterated over and individual host definitions are populated in the hosts config. Also here you can see a small chunk of code that sets up a host group by searching over a role.
  17. Similar to our hosts config file, the services config file is populated and updated in later chef runs in case there are any new nodes added.
  18. This is how the config files would look in the nagios server. You can see how the ruby code has been replaced with the actual entries of the nodes in the infrastructure.
  19. And finally we st up our Graphite for plotting….Real-time graphing server.Frontend : Webapp.Backend : Storage application (Carbon).Carbon-agent.pyCarbon-cache.pyCarbon-persister.pyAgents connect to carbon and send their data and it is then Carbon’s job to make the data available for real-time graphing.Carbon is made up of three processes… The primary process is carbon-agent.py which starts up the other two processes in a pipeline. When agents connect to the carbon server the carbon-agent accepts the connection and receives the formatted data, the data is then forwarded to the carbon cache for caching where data points are grouped by their associated metric. Carbon-cache then feeds these data point to the persister that reads them and and writes them to the disk using Whisper, that’s a fixed size db similar in design to an RRD.
  20. We have seen how chef and nagios can be integrated to set up a monitoring solution. Now we come to the plotting part… It is made fairly simple by using an open source project called Graphios made by Shawn Sterling. Graphios is a script that puts the nagiosperf data into the graphite server, all you need is a running nagios server and a running carbon server.Add this code segment to your nagios.cfg file which will set up how the nagiosperfdata is sent to the graphite server…. Then we need to define the graphite specific commands to the commands config file in the nagios objects directory.In the chef cookbook, we would add a graphite prefix to the hosts config template file
  21. And the services config template would have a postfix attached to it. So basically the node data would be read by the graphite server as graphiteprefix.nodename.graphitepostfix.So now, we have our graphite commands in place, graphite configuration in place and prefixes and postfixes set up… The only thing we’ll do next is pick up the graphios.py and the graphios.init from shawn sterling’s github account and drop the init file in thheinit.d and the python file in /opt/nagios/bin… it can be anywhere but the directory structure should be nagios/bin/graphios.pyHe has an elaborate readme which will take you through the configuration steps in detail…
  22. Ultimately our nagios would look like this
  23. And our graphite would look like this