centreon-poller-centreon-engine.postinst 1.54 KB
Newer Older
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
#!/bin/sh

if [ "$1" = "configure" ]; then

    if [ "$(getent group nagios)" ]; then
        /usr/sbin/usermod -a -G centreon,nagios,centreon-broker centreon-engine
        /usr/sbin/usermod -a -G centreon,nagios centreon-broker
        /usr/sbin/usermod -a -G centreon-engine nagios
    fi

    /usr/sbin/usermod -a -G centreon-engine,centreon-broker centreon
    /usr/sbin/usermod -a -G centreon-engine centreon-gorgone
    /usr/sbin/usermod -a -G centreon-broker centreon-gorgone

    # Change right for Centreon Engine and Centreon Broker
    if [ -d /etc/centreon-broker ]; then
        chown -R centreon-broker: /etc/centreon-broker
        chmod -R g+w /etc/centreon-broker
    fi
    if [ -d /etc/centreon-engine ]; then
        chown -R centreon-engine: /etc/centreon-engine
        chmod -R g+w /etc/centreon-engine
    fi

    chmod -v +x /usr/share/centreon/bin/centreontrapd

    # snmpd.conf file
    if [ -f "/etc/snmpd/snmpd.conf" ]; then
        # Add right in SNMP
        sed -i \
            -e "/^view.*\.1\.3\.6\.1\.2\.1\.1$/i\
view centreon included .1.3.6.1" \
            -e "/^access.*$/i\
access notConfigGroup \"\" any noauth exact centreon none none" \
        /etc/snmp/snmpd.conf
    fi
Luiz Costa's avatar
Luiz Costa committed
37
38
39
40
41
42
43
44
45
46
47
48

    # Fix centreon configuration permissions
    chmod -v 0775 /etc/centreon
    chmod -v 0664 \
        /etc/centreon/centreon.conf.php \
        /etc/centreon/centreontrapd.pm \
        /etc/centreon/config.yaml \
        /etc/centreon/conf.pm
    chown -v centreon:centreon \
        /etc/centreon/centreontrapd.pm \
        /etc/centreon/conf.pm

49
50
fi
exit 0