Parsing the HTML Pages with Beautiful Soup

Once the contents are loaded into the BeautifulSoup object, we can start dissecting the BBC front web page. To give you an idea of what we need to find on the page, Figure 8-1 illustrates a sample screenshot of the front page, where you can clearly see the position of the top story. The top story on the BBC News UK when I captured the screen was titled Cameron and Clegg We are united. The title obviously changes from article to article, but the layout of the web site rarely changes, and the top...

Calculating the Mean and Standard Deviation

Standard Deviation

Since we are going to build a reporting system that produces statistical reports about the behavior of our system, let's look at some of the statistical functions that we will be using. Quite possibly, the most commonly used function is for calculating the average value of a series of elements. The NumPy library provides two functions to calculate the average of all numbers in an array mean and average . The mean function calculates a simple mathematical mean of any given set of numbers. gt gt...

Nagios PlugIn Architecture

The power of Nagios NMS is in its plug-in architecture. All check commands are external utilities that can be written in any language C, Python, Ruby, Perl and so on. The plug-ins communicate with the Nagios system by means of OS return codes and the standard input output mechanism. In other words, Nagios has a predefined set of return codes that the check scripts must return. The return code dictates what the new service state should be set to. All return codes and the corresponding service...

Representing the Information in an ER Diagram

Diagram For Admin System

I now have defined all the tables that I will be using on the monitoring server. Each field is defined, along with the relations between the tables. Even though I have only a few tables, it is still sometimes confusing to find and visualize the relation between different tables. To make things easier, especially when writing SQL queries, it is a good idea to draw an entity relationship ER diagram, a concept introduced in Chapter 5. Figure 9-2 is the ER diagram I drew for the tables defined...

Finding the Trend Line of a Dataset

The sample application we'll build in this chapter should report on and help us visualize the trends of various readings. For example, let's say that we're collecting data about the CPU load. How can we find out if the load is gradually increasing over time An obvious way is to look at the graph of the readings, and the really pronounced trends will be visible immediately. But we don't want to need to look at all the possible graphs ourselves and try to spot a trend. If the increase in load is...

Creating Web Pages with the Jinja Templating System

Django Template System

In the last section of this chapter we are going to create another script, this one generating a simple structure of web pages containing the graphs. The main entry page lists all available checks grouped by the system and links to the check details page. When a user navigates to that page, she will see the graph generated by RRDTool and some details about the check itself such as the check description and OID . Now, this looks relatively easy to implement, and most people would simply start...

Introduction to SNMP

Snmp Architecture

SNMP Simple Network Management Protocol is a UDP-based protocol used mostly for managing network-attached devices, such as routers, switches, computers, printers, video cameras, and so on. Some applications also allow access to internal counters via the SNMP protocol. SNMP not only allows you to read performance statistics from the devices, it can also send control messages to instruct a device to perform some action for example, you can restart a router remotely by using SNMP commands. There...