Você está na página 1de 5

utilizar ubuntu server 14.

04 lts, para a instalao do


2.4.5

zabbix

criar script no Linux

#!/bin/bash
set -x
########add Zabbix 2.4.5 repository
echo deb http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise
main >> /etc/apt/sources.list
echo deb-src http://ppa.launchpad.net/tbfr/zabbix/ubuntu precise
main >> /etc/apt/sources.list

########Install the public key of the repository and update your


package index
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys
C407E17D5F76A32B

########INSTALL ZABBIX & COMPONENTS


apt-get update
sleep 5
apt-get install -y zabbix-server-pgsql zabbix-frontend-php
php5-pgsql libapache2-mod-php5 zabbix-agent
sleep 5
###SET ACCESS TO DB
sed -i 's/peer/trust/gi' /etc/postgresql/9.3/main/pg_hba.conf
sed -i 's/md5/trust/gi' /etc/postgresql/9.3/main/pg_hba.conf

service postgresql restart

sleep 5

####Create new user and create new DB 'zabbix'


su - postgres -c "echo \"create user zabbix with password
'zabbix';\" | psql"

su - postgres -c "echo \"create database zabbix owner zabbix;\"


| psql"
sleep 5
#####add data to zabbix db
pushd /usr/share/zabbix-server-pgsql/
gunzip *.gz
psql -U zabbix zabbix < schema.sql
psql -U zabbix zabbix < images.sql
psql -U zabbix zabbix < data.sql
popd
sleep 5
######Zabbix server is set startup
sed -i 's/START=no/START=yes/gi' /etc/default/zabbix-server

######start zabbix service


/etc/init.d/zabbix-server restart

######Configure the Zabbix webinterface


sed -i 's/post_max_size = 8M/post_max_size = 16M/gi'
/etc/php5/apache2/php.ini
sed -i 's/max_execution_time = 30/max_execution_time =
300/gi' /etc/php5/apache2/php.ini
sed -i 's/max_input_time = 60/max_input_time = 300/gi'
/etc/php5/apache2/php.ini
sed -i 's/;date.timezone =/date.timezone = America\/New_York/gi'
/etc/php5/apache2/php.ini

#####Copy the sample Apache configuration file into the Apache


directory,
#####make sure the Apache alias module is enabled and restart
Apache
##
cp -f /usr/share/doc/zabbix-frontend-php/examples/apache.conf
/etc/apache2/conf.d/zabbix.conf
a2enmod alias
/etc/init.d/apache2 restart

#####Copy the sample php configuration file to the Zabbix folder


cp -f /usr/share/doc/zabbix-frontend-

php/examples/zabbix.conf.php.example /etc/zabbix/zabbix.conf.php

pushd /etc/apache2/conf.d/
sed -i -e '1 s/^/Listen 8080\n/;' zabbix.conf
popd
service apache2 restart

####update your database details in /etc/zabbix/zabbix.conf.php


echo "<?php
// Zabbix GUI configuration file
global \$DB;
\$DB['"TYPE"']
= 'POSTGRESQL';
\$DB['"SERVER"']
= 'localhost';
\$DB['"PORT"']
= '0';
\$DB['"DATABASE"']
= 'zabbix';
\$DB['"USER"']
= 'zabbix';
\$DB['"PASSWORD"']
= 'zabbix';
// SCHEMA is relevant only for IBM_DB2 database
\$DB['"SCHEMA"']
= '';
\$ZBX_SERVER
= 'localhost';
\$ZBX_SERVER_PORT
= '10051';
\$ZBX_SERVER_NAME
= '';
\$IMAGE_FORMAT_DEFAULT
= IMAGE_FORMAT_PNG;
?>" > /etc/zabbix/zabbix.conf.php

service zabbix-server restart

echo zabbix-server installed!

aps instalao acessar setup pelo browser

Você também pode gostar