Closed wbollock closed 4 years ago
I found a workaround. Absolutely related to running a Word-press multi-site, and possibly my wildcard SSL cert.
sudo vim /etc/snmp/apache-stats.py
Replace edit data = urlread ( 'http://localhost/server-status?auto'
with:
https://your-site-here/server-status?auto
curl that URL. It won't work by default (produce the stats). To fix the server-status redirects, edit /var/www/html/.htaccess:
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
# added rule here
RewriteCond %{REQUEST_URI} !=/server-status
RewriteRule . index.php [L]
The rule we added is RewriteCond %{REQUEST_URI} !=/server-status
, and I found it has to be nested between those other two rules.
sudo systemctl restart apache2
# verify it works
sudo python /etc/snmp/apache-stats.py
sudo systemctl restart snmpd
I'm not sure if this is an issue that can be solved by "fixing" the python script. Please close this issue if it's just related to my setup.
with changing url to:
https://your-site-here/server-status?auto
i think you've also opened up server-status
mod.
It work's but it's an security issue, because now it's possibly world open.
possible not open on localhost for getting stats
No Apache stats populate on a handful of servers, but apache-stats.py works on most.
However, on the handful of servers not working:
The SSL cert is a wildcard on these servers, but other servers with the same cert work. Running Wordpress on Ubuntu 16.04.
Edit: python-urlgrabber package is installed, and the configuration was sent via Ansible to all servers, so it's the same across the board.