ソースを参照

Fix monit monitoring for apache

Add a status vhost to apache, so that monit's http monitoring will work.
It doesn't particularly matter to the monit check what this vhost does
as long as it returns 200, but I thought it would be nice to use
apache's builtin status functionality.  Ideas cribbed from [1].  It
might also be possible to use monit's apache-status functionality to
alert on more sophisticated criteria, but this will do for now.

Open question: does collectd support apache-status? Might it also be
interested in this vhost?

Fixes #299.

[1] http://mmonit.com/wiki/Monit/MonitorApacheStatus
Philip Potter 10年前
コミット
ca1d595b07

+ 10
- 0
roles/monitoring/files/etc_apache2_sites-available_00-status.conf ファイルの表示

@@ -0,0 +1,10 @@
1
+# This needs to be the first configured virtualhost on port 80 so that
2
+# requests to http://localhost hit this rather than any other vhost
3
+<VirtualHost *:80>
4
+  <Location />
5
+    SetHandler server-status
6
+    Order deny,allow
7
+    Deny from all
8
+    Allow from 127.0.0.1
9
+  </Location>
10
+</VirtualHost>

+ 7
- 0
roles/monitoring/tasks/monit.yml ファイルの表示

@@ -1,3 +1,10 @@
1
+- name: Add monitoring vhost to apache
2
+  copy: src=etc_apache2_sites-available_00-status.conf dest=/etc/apache2/sites-available/00-status.conf
3
+
4
+- name: Enable the status vhost
5
+  command: a2ensite 00-status.conf creates=/etc/apache2/sites-enabled/00-status.conf
6
+  notify: restart apache
7
+
1 8
 - name: Install monit
2 9
   apt: pkg=monit state=installed
3 10
 

読み込み中…
キャンセル
保存