| a | b | |
|---|
| 14 | 14 | | ... will monitor http response times to http://192.168.0.10/ |
|---|
| 15 | 15 | | |
|---|
| 16 | 16 | | If you wish to monitor the http response time to a particular page, use the |
|---|
| ... | |
|---|
| 17 | | - | /etc/munin/plugin-conf.d/munin-node configuration file and add the following |
|---|
| 17 | + | /etc/munin/plugin-conf.d/munin-node CONFIGuration file and add the following |
|---|
| ... | |
|---|
| 18 | 18 | | section: |
|---|
| 19 | 19 | | |
|---|
| 20 | 20 | | [response_time_http*] |
|---|
| ... | |
|---|
| 33 | 33 | | from timeit import Timer |
|---|
| 34 | 34 | | |
|---|
| 35 | 35 | | |
|---|
| ... | |
|---|
| 36 | | - | usage = """\ |
|---|
| 36 | + | USAGE = """\ |
|---|
| ... | |
|---|
| 37 | 37 | | To use this plugin, you must create a symbolic link to it, |
|---|
| 38 | 38 | | with the ip address or fqdn of the web server to monitor. |
|---|
| 39 | 39 | | |
|---|
| ... | |
|---|
| 42 | 42 | | ln -s /usr/share/node/node/plugins-auto/response_time_http_ \ |
|---|
| 43 | 43 | | /etc/munin/node.d/response_time_http_192.168.0.10""" |
|---|
| 44 | 44 | | |
|---|
| ... | |
|---|
| 45 | | - | config = """\ |
|---|
| 45 | + | CONFIG = """\ |
|---|
| ... | |
|---|
| 46 | 46 | | graph_title HTTP GET response time for %s |
|---|
| 47 | 47 | | graph_vlabel seconds |
|---|
| 48 | 48 | | ping_http.label response time |
|---|
| ... | |
|---|
| 64 | 64 | | address = os.path.basename(argv[0]).replace('response_time_http_', '') |
|---|
| 65 | 65 | | |
|---|
| 66 | 66 | | if not address: |
|---|
| ... | |
|---|
| 67 | | - | print(usage) |
|---|
| 67 | + | print(USAGE) |
|---|
| ... | |
|---|
| 68 | 68 | | return 1 |
|---|
| 69 | 69 | | |
|---|
| 70 | 70 | | if 'config' in sys.argv: |
|---|
| ... | |
|---|
| 71 | | - | print(config % address) |
|---|
| 71 | + | print(CONFIG % address) |
|---|
| ... | |
|---|
| 72 | 72 | | else: |
|---|
| 73 | 73 | | runs = 10 |
|---|
| 74 | 74 | | if 'runs' in os.environ: |
|---|
| ... | |
|---|
| 75 | | - | pings = os.environ['runs'] |
|---|
| 75 | + | runs = os.environ['runs'] |
|---|
| 75 | + | runs = int(runs) |
|---|
| ... | |
|---|
| 76 | 76 | | |
|---|
| 77 | 77 | | timeout = 5 |
|---|
| 78 | 78 | | if 'timeout' in os.environ: |
|---|
| ... | |
|---|