PHP Weathermap is an open-source, web-based network monitoring and graphing tool used to take data from your network devices and use it to provide a single-page overview of the current state of network to produce it’s maps of network. It help Network Administrator to identify the uplink congestion in the network because of network interface port bandwidth limitation or DDoS attack on the WAN link interface. So, we can optimize our network for a better performance or make any incident respond on time.
In this article will show how to install PHP Weathermap on CentOS 7 or RHEL 7 in the same server with Cacti network monitoring tools server. At the time of writing this document, the latest stable release of PHP Weathermap version that available to download is 0.98.
In this tutorial, it is supposed that:
a. You have already install RHEL/CentOS 7 Linux server up and running. In case that you don’t, you would probably like to read this link. Minimal RHEL/CentOS 7 Installation With Logical Volume Manager (LVM).
b. You have already done the initial server setup. Please refer to this link Minimal RHEL/CentOS 7 Initial Server Setup.
c. You already done installing Cacti web-based network monitoring tools, Please refer to this link Installing Cacti Web-based Network Monitoring on RHEL/CentOS 7
3. Install and Configure PHP Weathermap Editor Web Interface
Login to Cacti network monitor server, navigate to directory /var/www and execute the following command to download PHP Weathermap software packet.
# cd /var/www # wget https://github.com/howardjones/network-weathermap/releases/download/version-0.98/php-weathermap-0.98.zip
Unzip the file of PHP Weathermap software packet and change the ownership of director “weathermap” as the following.
# unzip php-weathermap-0.98.zip # chown -R apache:apache /var/www/weathermap
Now we need to create the VHost file for PHP Weathermap editor as the following. In below VHost configuration we only allow IP 192.168.0.145.1 to access to PHP Weathermap editor.
# vim /etc/httpd/conf.d/weathermap.conf <VirtualHost *:80> ServerAdmin firstname.lastname@example.org ServerName nmap.techspacekh.com DocumentRoot /var/www/weathermap Alias /nmap /var/www/weathermap <Directory /var/www/weathermap> <Files editor.php> Order Deny,Allow Deny from all Allow from 127.0.0.1, 192.168.145.1 </Files> </Directory> ErrorLog "/var/log/httpd/nmap.techspacekh.com.log" CustomLog "/var/log/httpd/nmap.techspacekh.com.log" combined </VirtualHost>
Then, edit the following file to enable PHP Weathermap editor web page after that restart Apache web services.
# vim /var/www/weathermap/editor.php //$ENABLED=false; $ENABLED=true; # systemctl restart httpd # systemctl status httpd
4. Create Network Weathermap With Web Interface Editor
Open any of your favorite browser and access URL “http:///nmap.techspacekh.com/editor.php” to create a Network Weathermap from existing template. In the following picture we can create a new Network Weathermap named “techspacekh.conf” from template “simple.conf”.
To make an easy example in this article let delete one link and keep only one link as the following.
Next, we need to create a cron job to update this Network Weathermap every one minute as the following.
# cd /etc/cron.d # vim weathermap * * * * * root cd /var/www/weathermap/; /var/www/weathermap/weathermap --config configs/techspacekh.conf --output techspacekh.png --htmloutput techspacekh.html
To view the Network Weathermap created, we need to access to URL “http://nmap.techspacekh.com/techspacekh.html“. Check the time of Network Weathermap as below and make sure that it is update every one minute.
Now, let go back to the editor of PHP Weathermap with the URL “http:///nmap.techspacekh.com/editor.php” and click on the link to edit the link properties value.
There are three boxes that we need to file in.
1. Data Source: we can find it on Cacti web interface by going to “Console” then click the device that you need its graph, click on “Data Source List“, click on one of the data source that you need, and then click on “Turn on Data Source Info Mode“. In the RRD File Information section, you should see the data source for that particular graph as the following.
2. Info URL: info URL is http://cacti.techspacekh.com/cacti/graph.php?rra_id=all&local_graph_id=XX where XX is the ID of the graph. We can find this on Cacti web interface by going to “Console” then click the device that you need its graph, click on “Graph List“, then you should see the list of graph with its each ID for that particular device as the following.
3. Hover Graph URL: Hover Graph URL is http://cacti.techspacekh.com/cacti/graph_image.php?local_graph_id=XX&rra_id=0&graph_nolegend=true&graph_height=150&graph_width=500 where XX is the ID of the graph.
Now we have all the data that need to be input into link properties of Network Weathermap. Let input this value as the following.
Go back the view interface of the new Network Weathermap created, by enter the following URL “http://nmap.techspacekh.com/techspacekh.html” in the web browser. Now we link comes up with bandwidth value as the following and if we roll mouse on the link, we will see the graph for this link as the following.
If we click on the link, it will redirect to Cacti URL for that particular graph as the following.
That’s all about installing standalone PHP Weathermap application for network monitoring on RHEL/CentOS 7 from Tech Space KH. Hopefully, you can find this guide informative. If you have any questions or suggestions you can always leave your comments below. I will try all of my best to review and reply them.