get nginx_status via stub_status


Recommended Posts

Hi

for my Monitoring with zabbix I want to call the stub_status of nginx. I saw that the stub_status module is already installed but no location is set.

Therefore I have to add this location to the nginx config.

#nginx_status
location /nginx_status {
	stub_status;
	
    allow 10.0.0.111;
	deny all;
    }

Does anyone know a way how to do this safely and persists after reboot?

 

Thanks for any idea

Link to comment
26 minutes ago, Squid said:

You would make the appropriate changes via a script in the /config/go file on the flash drive

thanks for your reply. I am aware of the go file.

My question is more how to safely do it.

I tried manually to add the location part to the emhttp-server.conf of nginx but my customization does not even survive a nginx reload.

So I need to solve this problem first, how to add this part to the server block of the nginx conf. 

Next step would then be to keep the change to persist on unraid reboot via go file.

 

Link to comment
  • 3 years later...

Old thread but also an issue for me right now. `/etc/nginx/conf.d/servers.conf` and `/etc/nginx/conf.d/locations.conf` are dynamically rewritten each time nginx is loaded (as programmed in `/etc/rc.d/rc.nginx`). Other files in `conf.d` are ignored. Editing `nginx.conf` directly on every boot could create problems later on with future updates. 

 

Not sure what's the best approach to this. Also curious why the nginx_status was disabled, as there are traces here in the forums and elsewhere in Unraid that this might have been enabled in the past. Performance issue?

Link to comment
On 9/15/2020 at 6:45 AM, UnKwicks said:

no idea anyone?

Got it working. Whether it's worth the hassle or not depends on what you are trying to do... monitoring the nginx status webpage from Unraid isn't particularly useful outside of academic purposes.

 

If you look at /etc/rc.d/rc.nginx, it overwrites /etc/nginx/conf.d/locations.conf and /etc/nginx/conf.d/servers.conf on every reload. locations.conf is where you want to add the status page, so you need to edit build_locations(). I suggest adding the entry after nchan_stub_status to make it look like that:

        location /nchan_stub_status {
            nchan_stub_status;
        }
        location /nginx_status {
            stub_status;
        }

Now, this might get overwritten after an update or a reboot (haven't really tested yet), so you might want to add a user script that runs on first start of your array to edit rc.nginx and reload it.

Edited by dnLL
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.