Monitoring Gas Prices Using Capacity Planning in Nagios XI

Nagios XI is the most powerful IT infrastructure monitoring solution on the market.  You can use it to monitor virtually anything.  Although Nagios XI is typically meant for more “serious” work, you can have some fun with it as well!  I guess I have been somewhat nostalgic lately…  Do you remember when a gallon of gas used to cost less than a dollar? 🙂

In this article I will show you how to install the check_gas_price.py plugin, set up a dummy host, and add multiple services to it.  This will allow you to check the gas prices in the USA.  Then you may use the Capacity Planning component in Nagios XI Enterprise Edition to view the trends of gas prices in the USA.

First, download the check_gas_price.py plugin from this URL:

http://assets.nagios.com/downloads/nagiosxi/scripts/check_gas_price.py

Next, install the plugin from the Nagios XI web interface by going to: Admin –-> Manage Plugins –-> Choose File, then select the check_gas_price.py file and click Upload Plugin.

If you would like, you can view the plugins’ usage by typing in terminal:

Your output should look like this:

Monitoring gas prices with Nagios XI - check_gas_price.py

Create a new command by going to: Core Config Manager –-> Commands –> Add New.  I named my command “check_gas_price” but you can use whatever name you like.

Add command name with Core Config Manager in Nagios XI

Next, create a dummy host and add some services to it for checking gas prices in the USA by selecting check_dummy from the Check Command dropdown.

Host Management in Nagios XI

The values necessary to create a successful gas price monitor are as follows:

Config Name = The name of your “host”  (Note: in this case it is purely organizational, thus the name GasPricesUS)

Description = The name of the service as displayed by Nagios XI

$ARG1$ = Location (Note: This is limited to the list of cities and states found in the -h Help call for the plugin)

$ARG2$ = At what price would you like to receive a Warning notification?

$ARG3$ = At what price would you like to receive a Critical notification?

Service Management in Nagios XI

Note: Don’t forget to wrap the location in $ARG1$ in single quotes in case there is a space in the name.  If you don’t use single quotes, you will get syntax errors.

GasPricesUS Service Status in Nagios XI

After monitoring gas prices for a good length of time, you can take the historical data that has gathered and use the Capacity Planning component to observe trends and forecast future gas prices.

Monitoring gas prices using Capacity Planning in Nagios XI

Here I used an 8 week period and extrapolated out 32 weeks.  I don’t believe the gas prices in California will ever reach $1/gallon (at least not any time soon), but I sure do like the trend that is shown on the graph. 🙂

If you want to learn more about the Capacity Planning component, view the documentation at the following link:

http://assets.nagios.com/downloads/nagiosxi/docs/How_To_Use_Capacity_Planning.pdf

If you want to see what other cool features are present in Nagios XI Enterprise Edition, please visit the URL below:

http://www.nagios.com/products/nagiosxi/whatsnew

Happy monitoring!

1 Response to “Monitoring Gas Prices Using Capacity Planning in Nagios XI”


  • Hah, this is great! Its almost as if you’d want to reverse your ranges though. Critical for low prices so you get an alert, time to get GAS!:)

Comments are currently closed.