summaryrefslogtreecommitdiff
path: root/src/pmdas/oracle/Install
blob: a64aac0c8afd754ad9c312da1c9f6f818b39b872 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/sh
#
# Copyright (c) 2009,2012 Aconex.  All Rights Reserved.
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# Install the Oracle PMDA
#

. $PCP_DIR/etc/pcp.env
. $PCP_SHARE_DIR/lib/pmdaproc.sh

iam=oracle
user=$iam
domain=32
perl_opt=true
daemon_opt=false
forced_restart=true

perl -e "use DBI" 2>/dev/null
if test $? -ne 0; then
    echo "Perl database interface (DBI) is not installed"
    exit 1
fi

perl -e "use DBD::Oracle" 2>/dev/null
if test $? -ne 0; then
    echo "Oracle database driver (DBD::Oracle) is not installed"
    exit 1
fi

su -c id $user >/dev/null 2>&1
if test $? -ne 0; then
    echo "Cannot change user to $user, sorry this is fatal"
    exit 1
fi

su -c mkdir -p "$PCP_VAR_DIR/config/pmda" 2>/dev/null
indoms="0 1 2 3 4 5 6 7 8 9 10"
for indom in $indoms
do
    touch "$PCP_VAR_DIR/config/pmda/$domain.$indom" >/dev/null 2>&1
    if test $? -ne 0; then
        echo "Cannot create indom persistance files as user $user"
        echo "Failed on:  $PCP_VAR_DIR/config/pmda/$domain.$indom"
        exit 1
    fi
done

# TODO: need to ask for user/pass and SIDs, write $PCP_VAR_DIR/config/oracle/oracle.conf
# (unless it exists)

pmdaSetup
pmdaInstall
exit 0