Can Foglight Monitor a Port on a Host?

I was recently asked by a colleague if Foglight had any ability to tell if a specified port is open on a host.

I dug through my archives of custom agents that have been developed over the years, and I found one called PortMonitor (attached version 1.1.1). I decided to test it against the latest (as of November 2016) versions of the Foglight Management Server and Agent Manager, and it worked as expected. It checks that a specified port or set of ports on a host can be connected to. There are 2 rules to alert on availability and response time.

Here is the end result:



To get to that point, you can do the following after installing an Agent Manager to the host you wish to monitor and downloading the .car file attached:

1- Load the cartridge into the FMS via Administration -> Cartridges -> Cartridge Inventory -> Install Cartridge.

2- Deploy the agent package via Administration -> Agent Status -> Deploy Agent Package. 

3- Create a PortMonitor agent via Administration -> Agent Status -> Create Agent.

4- Edit the agent properties via Administration -> Agent Status -> Edit -> Edit Properties. This step should be considered carefully based on what needs to be done. If you only have a single host to check ports on, you can modify the agent properties as needed. Specify the script name (.sh for *nix / .bat for Windows) and edit the port list. If you have multiple hosts, I would step back to the Agent Properties dashboard, and setup a "global" port list. Then, for each host that you create an agent on, clone the list and give it an identifiable name to use on that host. That list can then be modified as needed for a specific host.


5- Activate the agent via Administration -> Agent Status -> Activate. Give it a few minutes to collect and then the dashboard above can be found under the "Custom" node in the Dashboards tree. 

The rules can be found under Administration -> Rules & Notifications -> Rules by selecting the PortMonitor cartridge from the dropdown.

The inverse use case of the default rule is fairly simple to setup as well. If you want the behaviour to be "check if a port that should be closed is open" you could modify the existing rule or create a new rule to check if availability is > 0.


Note: Use of custom or script agents on a host requires that the host has a corresponding "Foglight for OS Management" license.
About the Author
Darren Mallette
I am a senior systems consultant specializing in performance monitoring for virtualization, databases, applications and end user experience. I've been in the IT world for over 20 years, with experience...