Zabbix - cgi and mysql: Difference between revisions

From Alpine Linux
(Initial draft version - not complete)
 
(Updated documentation)
Line 1: Line 1:
{{Draft}}
[[Category:monitoring]]
Install Zabbix and prerequisites
 
  apk add zabbix lighttpd php php-sqlite
 
Add php support to lighttpd (uncomment this line in /etc/lighttpd/lighttpd.conf):
== Zabbix Monitoring Solution ==
include "mod_fastcgi.conf"
 
Save and exit editor.
The purpose of this document is to assist in installing the Zabbix server software and Zabbix agent on the Alpine Linux operating system. Instructions on how to configure and use Zabbix - as well as many useful tutorials - can be found at http://www.zabbix.com.
Create a softlink for the Zabbix web files:
 
{{Note|Currently, Zabbix will only work as expected when running on an Alpine Linux system updated from the latest snapshots of the Edge repository. It will be properly supported with the next major version stable release (Alpine 2.2).}}
 
== Install Lighttpd, and PHP ==
 
{{:Setting Up Lighttpd With FastCGI}}
 
== Configure PostgreSQL ==
 
Setup and configure PostgreSQL:
 
apk add postgresql postgresql-client
/etc/init.d/postgresql setup
/etc/init.d/postgresql start
rc-update add postgresql
 
== Install Zabbix ==
 
  apk add zabbix
 
Now we need to set up the zabbix database. Substitute '*********' in the example below for a real password:
 
<pre>
psql –U postgres
postgres=# create user zabbix with password '*********';
postgres=# create database zabbix owner zabbix;
postgres=# \q
cd /usr/share/zabbix/dbms/create/
cat postgresql.sql | psql -U zabbix zabbix
cd data/
cat data.sql | psql -U zabbix zabbix
cat images_pgsql.sql | psql -U zabbix zabbix
</pre>
 
Create a softlink for the Zabbix web-frontend files:
 
  ln -s /usr/share/webapps/zabbix /var/www/localhost/htdocs/zabbix
  ln -s /usr/share/webapps/zabbix /var/www/localhost/htdocs/zabbix
Configure /etc/zabbix/zabbix_server.conf.<br />
Set permissions on /etc/zabbix/zabbix_zabbix.conf:
chmod a+r /etc/zabbix/zabbix_server.conf
Start Zabbix server.


TO BE CONTINUED
Edit PHP configuration to satisfy some zabbix requirements. Edit /etc/php/php.ini and configure the following values at least:
 
<pre>
Max_execution_time = 600
Expose_php = off
Date.timezone = <insert your timezone here>
post_max_size = 32M
upload_max_filesize = 16M
max input time = 600
memory limit = 256M
</pre>
 
Configure the following entries in /etc/zabbix/zabbix_server.conf, where DBPassword is the password chosen for the database above:
 
<pre>
DBName=zabbix
 
# Database user
 
DBUser=zabbix
 
# Database password
# Comment this line if no password used
 
DBPassword=*********
</pre>
 
Start Zabbix server:
 
rc-update add zabbix-server
/etc/init.d/zabbix-server start
 
You should now be able to browse to the Zabbix frontend: http://yourservername/zabbix.
 
Follow the setup instructions to configure Zabbix, supplying the database information used above.
 
== Install Zabbix Agent on Monitored Servers ==
 
Zabbix can monitor almost any operating system, including Alpine Linux hosts. Complete the following steps to install the Zabbix agent on Alpine Linux.
 
Install the agent package:
 
apk add zabbix-agent
 
Edit the /etc/zabbix/zabbix_agentd.conf file and configure at least the following option:
 
Server=<ip or hostname of zabbix server>


A few things to fix so far (either in apk or this page):
Start the zabbix-agent:


Add a default path to sqlite db in /etc/zabbix/zabbix_server.conf
rc-update add zabbix-agentd
Fix paths in /usr/share/webapps/zabbix/config.php, especially in the includes.
/etc/init.d/zabbix-agentd start

Revision as of 03:35, 9 December 2010


Zabbix Monitoring Solution

The purpose of this document is to assist in installing the Zabbix server software and Zabbix agent on the Alpine Linux operating system. Instructions on how to configure and use Zabbix - as well as many useful tutorials - can be found at http://www.zabbix.com.

Note: Currently, Zabbix will only work as expected when running on an Alpine Linux system updated from the latest snapshots of the Edge repository. It will be properly supported with the next major version stable release (Alpine 2.2).

Install Lighttpd, and PHP

Basic Installation

For installing the additional packages first activate community packages and update the package index

Install the required packages:

# apk add lighttpd php82 fcgi php82-cgi

Configure Lighttpd

Edit lighttpd.conf (/etc/lighttpd/lighttpd.conf) and uncomment the line:

Contents of /etc/lighttpd/lighttpd.conf

... include "mod_fastcgi.conf" ...

Edit mod_fastcgi.conf (/etc/lighttpd/mod_fastcgi.conf), find and change /usr/bin/php-cgi to /usr/bin/php-cgi82.

Contents of /etc/lighttpd/mod_fastcgi.conf

... "bin-path" => "/usr/bin/php-cgi82" # php-cgi ...

Start lighttpd service and add it to default runlevel

# rc-service lighttpd start # rc-update add lighttpd default

Configure PostgreSQL

Setup and configure PostgreSQL:

apk add postgresql postgresql-client 
/etc/init.d/postgresql setup
/etc/init.d/postgresql start
rc-update add postgresql

Install Zabbix

apk add zabbix

Now we need to set up the zabbix database. Substitute '*********' in the example below for a real password:

psql –U postgres
postgres=# create user zabbix with password '*********';
postgres=# create database zabbix owner zabbix;
postgres=# \q
cd /usr/share/zabbix/dbms/create/
cat postgresql.sql | psql -U zabbix zabbix
cd data/
cat data.sql | psql -U zabbix zabbix
cat images_pgsql.sql | psql -U zabbix zabbix

Create a softlink for the Zabbix web-frontend files:

ln -s /usr/share/webapps/zabbix /var/www/localhost/htdocs/zabbix

Edit PHP configuration to satisfy some zabbix requirements. Edit /etc/php/php.ini and configure the following values at least:

Max_execution_time = 600
Expose_php = off
Date.timezone = <insert your timezone here>
post_max_size = 32M
upload_max_filesize = 16M
max input time = 600
memory limit = 256M

Configure the following entries in /etc/zabbix/zabbix_server.conf, where DBPassword is the password chosen for the database above:

DBName=zabbix

# Database user

DBUser=zabbix

# Database password
# Comment this line if no password used

DBPassword=*********

Start Zabbix server:

rc-update add zabbix-server
/etc/init.d/zabbix-server start

You should now be able to browse to the Zabbix frontend: http://yourservername/zabbix.

Follow the setup instructions to configure Zabbix, supplying the database information used above.

Install Zabbix Agent on Monitored Servers

Zabbix can monitor almost any operating system, including Alpine Linux hosts. Complete the following steps to install the Zabbix agent on Alpine Linux.

Install the agent package:

apk add zabbix-agent

Edit the /etc/zabbix/zabbix_agentd.conf file and configure at least the following option:

Server=<ip or hostname of zabbix server>

Start the zabbix-agent:

rc-update add zabbix-agentd
/etc/init.d/zabbix-agentd start