Apache-stats Failing

Hi,

I have modified apache-stats.py (slightly), to point to the correct “site” (with server-status working … confirmed). And, the output from apache-stats.py seems to exist, it’s as follows,

56386
476047360
.00180684
1116869
.0504858
426.234
8442.65
1
9
9
0
0
1
0
0
0
0
0
0
140

But, I can see when I try to capture the poller output,

Traceback (most recent call last):
File "/usr/bin/apache-stats.py", line 43, in
os.rename ( CACHEFILE+‘.TMP.’+os.getpid(), CACHEFILE )
OSError: [Errno 1] Operation not permitted

Any thoughts? BTW, here is my validate.php output (it should be current),

====================================

Component Version
LibreNMS 1.46-76-gaa25b2b47
DB Schema 274
PHP 7.2.10-0ubuntu1
MySQL 5.7.24-0ubuntu0.18.10.1
RRDTool 1.7.0
SNMP NET-SNMP 5.7.3
====================================

[OK] Composer Version: 1.8.0
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX]:
You can fix this with ./scripts/github-remove
Modified Files:
html/.htaccess

Your snmpd service cannot execute the script. Try an snmpwalk to see.

1 Like

And if snmpwalk fails as it will probably will, have a look at permissions of the script, and any subcommands of it. Had the same kind of issues while playing with bind Application monitoring.

1 Like

Yep, this is definitely the issue. Did a sudo su to Debian-snmp (snmp user, as you note), and running the script I get the same error message. What is odd are the permissions in /tmp … seems from below like it should be working. Hmmm - still digging. Thanks!

-rw-r–r-- 1 Debian-snmp Debian-snmp 1157 Dec 20 15:00 apache-snmp.TMP.10008
-rw-r–r-- 1 Debian-snmp Debian-snmp 1155 Dec 20 02:15 apache-snmp.TMP.10154

OK, got it working - thanks for the pointers! Let me capture it here, in case others have the same issue (trying to save folks some grief).

If you run apache-stats.py as a user other than the snmp user (Debian-snmp in this case), it creates the file /tmp/apache-snmp with permissions that then block the snmp user. Rather, run as below to check it (deleting the existing /tmp/apache-snmp file first if needed),

sudo -H -u Debian-snmp bash -c ‘apache-stats.py’

Hopefully that’s clear. And again, thanks!