# Plugin NGINX Enterprise monitoring

# Introduction

Ver. 140521

With this plug-in you can monitor nginx or nginx plus.  
It takes the required ip status data and generates the necessary modules.

Type: Agent plug-in

# Compatibility matrix

<table border="1" id="bkmrk-sistemas-donde-se-ha" style="border-collapse: collapse; width: 100%; height: 84px;"><tbody><tr style="height: 28px;"><td style="width: 50%; height: 28px;">**Systems where it has been tested**</td><td style="width: 50%; height: 28px;">CentOS 7

</td></tr><tr style="height: 28px;"><td style="width: 50%; height: 28px;">**Systems where it should work**</td><td style="width: 50%; height: 28px;">Any linux system

</td></tr></tbody></table>

# Prerequisites

Required :

ngx\_http\_stub\_status\_module  
Pandora FMS agent installation

  
You need to have enabled the module "ngx\_http\_stub\_status\_module" of nginx, that is where the plugin is going to get the data from.

# Configuration

Depending on whether you have manually compiled NGINX or the precompiled package you are using, the module "ngx\_http\_stub\_status\_module" may or may not be installed, to check if it is or not you can use the following command:

```
nginx -V | grep -o with-http_stub_status_module
with-http_stub_status_module
```

In this example we see that it is installed so we can use it, otherwise we must compile NGINX by adding the module:

```
./configure \
  --prefix=/opt/nginx \
 --sbin-path=/opt/nginx/sbin \
 --conf-path=/opt/nginx/nginx.conf \
 --pid-path=/opt/nginx/run/nginx.pid \
 --with-http_ssl_module \
 --with-http_gzip_static_module \
 --with-http_stub_status_module
```

**Status configuration in NGINX**

Let's declare status in the nginx.conf file located in /etc/nginx.

[![image-1621330017300.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330017300.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330017300.png)

Add /status to the right of location, as shown in the image.

# General plugin parameters

```
./nginx_monitor_enterprise <ip> /status
```

To make the plugin work, it will be executed followed by the ip to monitor (must include the nginx port) and followed by /status, as seen in configuration it is declared in "location", by default it is status, so if you put this name it won't be necessary to include it in the command.

# Plugin-specific parameters

This plugin does not contain any specific parameters, we can see an example of use by running it without any parameters.

[![image-1621330241584.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330241584.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330241584.png)

# Manual execution

We can test the plugin from the terminal to see if it works, to check it, we run the plugin according to the parameters seen before, it will return data in XML format.

[![image-1621330322630.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330322630.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330322630.png)

To check if the `.exe` for Ms Windows® EndPoint works, we will do it like this, making a call to the path where it is with inverted commas:

[![image-1621498776440.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621498776440.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621498776440.png)

# Troubleshooting

By default collections have a limit of 1000000 bytes, so when we upload the plugin using collections we will get this error:

[![image-1621499020232.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499020232.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499020232.png)

This has an easy solution, we will have to increase the limit of the collections, to do so we will go to configuration&gt;configuration&gt;enterprise :

[![image-1621499058437.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499058437.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499058437.png)

And we changed this:

[![image-1621499097207.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499097207.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499097207.png)

In this case I have set 7000000 bytes, which is more than enough for the use of this plugin.

# Configuration in Pandora

**Without remote configuration enabled**

We must pass the plugin to the virtual machine, this can be done through pscp. We run pscp and open the windows terminal, inside to pass it to us we will use this code:

```
pscp -P 22 <path-plugin> root@<ip-machine>:<path-target>
```

Example:

[![image-1621353633120.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621353633120.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621353633120.png)

The recommendation is to put the agent plugins in the path /etc/pandora/plugins for a more comfortable use.

To use it, we will open pandora\_agent.conf

```
vim /etc/pandora/pandora_agent.conf
```

And at the bottom of the file, we will load the plugin that we have passed to the machine by adding :

```
module_plugin <plugin path> <ip to monitor with nginx port> <url for status>.
```

[![image-1621353772402.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621353772402.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621353772402.png)

**With remote configuration enabled**

To enable the remote configuration we have to open the pandora\_agent.conf file:

```
vim /etc/pandora/pandora_agent.conf
```

Inside we look for the remote\_config line, to enable it we set it to 1.

[![image-1621353862091.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621353862091.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621353862091.png)

That done, to install the plugin with remote configuration enabled there are two options, the first is :

Perform the process of sending the plugin to the virtual machine as it is defined in the way to install the plugin without remote configuration enabled described above, only instead of entering the line :

```
module_plugin <plugin path> <ip to monitor with nginx port> <url for status>.
```

in pandora\_agent.conf from the machine, we will do it from the console, in the agents menu, click on remote configuration:

[![image-1621354017674.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621354017674.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621354017674.png)

And enter the line, then click on update:

[![image-1621354049118.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621354049118.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621354049118.png)

The second option is through collections.

Go to configuration &gt; collections:

[![image-1621330391566.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330391566.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330391566.png)

Click on create :

[![image-1621330426341.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330426341.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330426341.png)

Enter name and short name and click on create again:

[![image-1621330463007.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330463007.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330463007.png)

When it is created, go to :

[![image-1621330493998.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330493998.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330493998.png)

Click on "Upload":

[![image-1621330533196.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330533196.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330533196.png)

Upload the plugin and click "go":

[![image-1621330562858.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330562858.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330562858.png)

Click on "recreate file" :

[![image-1621330601187.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330601187.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330601187.png)

Go to the agent plugins menu:

[![image-1621330637972.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330637972.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330637972.png)

Enter the path to the plugin with the ip address to monitor, followed by /status:

[![image-1621330668984.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330668984.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330668984.png)

You will see below that the plugin has been loaded (in this image you can see how to enter the IP, remember that there is a space between the IP and /status.

[![image-1621330706289.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330706289.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330706289.png)

Then, we restart the agent with :

```
/etc/init.d/pandora_agent_daemon restart
```

And if everything went well, the modules should appear in the agent.

**Install plugin in zip version for windows devices**

The first thing to do is to install the MS Windows® EndPoint, you can download it from :

[https://pandorafms.com/en/downloads/](https://pandorafms.com/en/downloads/ "Downloads")

we will look for the version of Pandora FMS we are using, and click on windows :

[![image-1621499587036.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499587036.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499587036.png)

<div id="bkmrk-here-we-will-downloa">Here we will download the windows agent, in this case I will download the 64 bit version: <div>  
</div></div>[![image-1621499661279.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499661279.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499661279.png)

We will start the installation of the file, we put the path where we want it to be installed ("C:\\Program Files" by default) and when the process is completed, we put the ip of the server where the agent is going to be installed.

[![image-1621499705066.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499705066.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499705066.png)

In the next window, check the remote configuration tab so that it is directly enabled.

[![image-1621499746352.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499746352.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499746352.png)

When it is installed, we will create a collection in the console, go to configuration &gt; collections :

[![image-1621499772435.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499772435.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499772435.png)

Upload the .zip file and click on the tab that says "unzip":

[![image-1621499797130.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499797130.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499797130.png)

Once this is done, click on "recreate file" to save it.

Then go to resources&gt;manage agents&gt;modules (of the windows EndPoint) and go to collections:

[![image-1621499938758.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499938758.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499938758.png)

Click on the "add" icon in the previously created collection:

[![image-1621499970928.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621499970928.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621499970928.png)

<div id="bkmrk-here-we-will-downloa-0"><div><div>  
</div><div>Here we will download the windows agent, in this case I will download the 64 bit version:</div><div>  
</div></div></div>[![image-1621500012657.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621500012657.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621500012657.png)

We will see that the collection has been created in "collections", in the folder where the agent was installed:

[![image-1621500053102.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621500053102.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621500053102.png)

Then we go to "agent plugins" and make the call to the plugin of the collection we have created by putting "Program Files "agent plugins" &lt;ip ngins with the port&gt; :

[![image-1621500088140.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621500088140.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621500088140.png)

We will see what has appeared below:

[![image-1621500133494.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621500133494.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621500133494.png)

Go to agents, click on windows agent remote configuration:

[![image-1621500162362.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621500162362.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621500162362.png)

And below we will see how this line has been created for us:

[![image-1621500211203.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621500211203.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621500211203.png)

Once this is done, we restart the EndPoint again from services, and the modules will have been created.

# Modules generated by the plugin

The standard execution of this plugin will return the following modules by default (with all optional blocks enabled):

Monitoring:

<table border="1" id="bkmrk-active-connections-e" style="border-collapse: collapse; width: 100%;"><tbody><tr><td style="width: 50%;">- <span style="font-weight: 400;">Active connections</span>

</td><td style="width: 50%;">The *current* number of active (accepted) connections from clients.</td></tr><tr><td style="width: 50%;">- <span style="font-weight: 400;">Accepted connections</span>

</td><td style="width: 50%;">The *total* number of accepted connections from clients since the nginx master process started.</td></tr><tr><td style="width: 50%;">- <span style="font-weight: 400;">Handled connections</span>

</td><td style="width: 50%;">The *total* number of handled connections from clients since the nginx master process started.</td></tr><tr><td style="width: 50%;">- <span style="font-weight: 400;">Handled request</span>

</td><td style="width: 50%;">The *total* number of client requests since the nginx master process started.</td></tr><tr><td style="width: 50%;">- <span style="font-weight: 400;">Keep-alive connections</span>

</td><td style="width: 50%;">Number of keep-alive connections</td></tr><tr><td style="width: 50%;">- <span style="font-weight: 400;">Nginx plugin execution</span>

</td><td style="width: 50%;">If the plugin is running, 1 if so, 0 otherwise</td></tr><tr><td style="width: 50%;">- <span style="font-weight: 400;">Nginx plugin info</span>

</td><td style="width: 50%;">Exception if the above modules are not generated.</td></tr></tbody></table>

This is what it would look like on the module screen:

[![image-1621330869091.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621330869091.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621330869091.png)

And this is an example of how it collects data in the agent view:

[![image-1621342415036.png](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/image-1621342415036.png)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/image-1621342415036.png)

[![2.JPG](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/scaled-1680-/2.JPG)](https://pandorafms.com/guides/public/uploads/images/gallery/2021-05/2.JPG)