Requirements

Let's talk a bit about what we want from our end product before we start writing up some code. As mentioned before, we're looking to create a server monitoring solution. What exactly will it do? How can we implement the required functionality?

As our inspiration for Djagios is Nagios, let's look at how Nagios works. While Nagios is a huge application with understandably complex programming, it is in the end a client-server application. The server, which is just another computer, contains the Nagios installation. The clients, which are the systems that you want to monitor, run small plugin scripts that gather data and push it to the server. The server takes these data points and, based on how it's configured, sends out alerts if required. It also stores these data points and can show them in a simple tabular layout, giving you an instant overview of all the computer systems in your infrastructure.

We'll be creating something similar. Our server will be a Django application that will accept data points using an HTTP endpoint. The application will also include a web page where all these data points will be shown next to the client they came from. Our clients will be simple shell scripts that upload the data to our server.

Note

For the rest of the chapter, I will call the Django application, the server, and the systems that you want to monitor, the node. These are common terms used in many other projects that you will encounter in your programming career and they often mean similar things in those other projects.

Instead of developing all of these things at once, we'll take an incremental approach. We'll first create the models to store our data points. Next, instead of moving directly to creating the HTTP endpoint to accept the data points and client-side plugin scripts, we'll take a simpler approach and come up with a way to generate some fake data to test. An finally, we will create the web page to show our users the latest status of the client nodes and the triggered alerts.

With fake data to test, we can be confident that our status page and alerting system are working correctly. We can then move forward to the next step, which will be creating the HTTP endpoint to gather data points from clients and client-side plugin scripts.

In real-world projects, this incremental approach to building software systems is often the best way to complete projects. Create simple features and test them extensively to make sure that they work. Once you are confident of their correctness, add more functionality and repeat the testing phase. This way is analogous to how a tall building is constructed. If you are confident that the foundation is strong, you can build one floor at a time without worrying if the whole thing will fall down on your head.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.232.239