File: enable_cgi_strategy.inc

package info (click to toggle)
munin 2.0.76-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,064 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (44 lines) | stat: -rw-r--r-- 1,096 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# reconfigure munin-master for the CGI strategy
#
# Include this snippet in any test requiring the CGI strategy.


CONF_DIR="/etc/munin/munin-conf.d"
CONF_FILE_PATTERN="munin-cron-test-XXXXXX.conf"
CONF_FILE_GLOB="munin-cron-test-*.conf"


# delete potential stale configuration fragments
find "$CONF_DIR" -type f -name "$CONF_FILE_GLOB" -delete


configure_munin_for_strategy() {
    # create configuration file for cron strategy
    temp_conf_file=$(mktemp -p /etc/munin/munin-conf.d "$CONF_FILE_PATTERN")
    cat >"$temp_conf_file" <<EOF
graph_strategy cgi
html_strategy  cgi
EOF
    chmod 0644 "$temp_conf_file"
}


configure_apache2_for_strategy() {
    # do nothing if apache is not installed
    [ -x /usr/sbin/apache2 ] || return 0

    local apache2_conf="/etc/apache2/conf-enabled/munin.conf"

    sed -i 's/^#\(ScriptAlias \/munin \)/\1/' "$apache2_conf"
    sed -i 's/^Alias \/munin /#\0/' "$apache2_conf"
    a2enmod cgid
    service apache2 restart
}


configure_munin_for_strategy
configure_apache2_for_strategy


# set flag for the following tests
export MUNIN_TEST_CGI_ENABLED=1