Révision 6efaef76
Comments update and error messages
| plugins/nginx/nginx_upstream_multi_ | ||
|---|---|---|
| 25 | 25 |
# Use it in your site configuration (/etc/nginx/sites-enabled/anything.conf): |
| 26 | 26 |
# access_log /var/log/nginx/upstream.log upstream; |
| 27 | 27 |
# |
| 28 |
# Attention! Because munin-node does not have read permission for nginx log files we need to run it as root. |
|
| 29 |
# |
|
| 28 | 30 |
# And specify some options in /etc/munin/plugin-conf.d/munin-node: |
| 29 | 31 |
# |
| 30 | 32 |
# [nginx_upstream_multi_upstream] |
| 33 |
# user root |
|
| 31 | 34 |
# env.graphs cache http time request |
| 32 | 35 |
# env.log /var/log/nginx/upstream.log |
| 33 | 36 |
# env.upstream 10.0.0.1:80 10.0.0.2:8080 unix:/tmp/upstream3 |
| ... | ... | |
| 199 | 202 |
|
| 200 | 203 |
try: |
| 201 | 204 |
logHandle = open(logPath, "r") |
| 202 |
except Exception: |
|
| 203 |
print "Log file %s not readable" % logPath
|
|
| 205 |
except Exception as e:
|
|
| 206 |
print "Log file %s not readable: %s" % (logPath, e.strerror)
|
|
| 204 | 207 |
sys.exit(1) |
| 205 | 208 |
|
| 206 | 209 |
try: |
| ... | ... | |
| 278 | 281 |
lastByteHandle = open(lastBytePath, "w") |
| 279 | 282 |
lastByteHandle.write(str(logHandle.tell())) |
| 280 | 283 |
lastByteHandle.close() |
| 281 |
except Exception: |
|
| 284 |
except Exception as e: |
|
| 285 |
print e.strerror |
|
| 282 | 286 |
sys.exit(1) |
| 283 | 287 |
|
| 284 | 288 |
logHandle.close() |
Formats disponibles : Unified diff