Network Monitoring with Nagios and Raspberry Pi

Image

This project was given to us by an external company. It was not just to do something that would be graded for the final exam, a real company was going to use it once finished. We were a team of four, and each of us had different tasks to do. The main goal of the project was monitoring network equipment, like routers and switches, with an easy to use and cheap device. It was a small company, they did not have hundreds of things to monitor. That's why we chose the Raspberry Pi. Instead of consulting the Nagios interface to get the network status, the company wanted a C++ written interface that would communicate with the Raspberry Pi to show a brief dashboard of the network status.
My role for this project was configuring the monitoring solution, and guarantee the access to the equipment status for the C++ application.

For my tests, I configured two routers and two switches we had at school. Once they were configured, I enabled SNMP on them to monitor more things than just if they were reachable. The client did not want SNMP Traps enabled, only a basic monitoring. I chose Nagios, because while searching for a monitoring solution, this one was always advised. I didn't know much about it then, and this project made me learn a lot, and made me actually really like monitoring, and also managing Linux with the Raspberry Pi.
Once the monitoring solution was configured, I had to find a way for the application to retrieve the status of the equipment. I found a utility called 'MK Livestatus" which opens a TCP socket and that can handle requests made with a language very similar to SQL. MK Livestatus was communicating with the Nagios files to retrieve the status of the equipment. Once done, we could make a request with the appropriate query to find information on whatever we wanted concerning the status of a monitored equipment.

That way, the Raspberry Pi was a plug-and-play device. With everything enabled at startup, I just had to plug it to the wall and with a network cable, and it was ready to go.