设为首页 收藏本站
查看: 1073|回复: 0

[经验分享] ubuntu下 zabbix 和 zabbix agent安装

[复制链接]

尚未签到

发表于 2019-1-26 09:21:27 | 显示全部楼层 |阅读模式

  在ubuntu部署zabbix-server

  步骤一: sudo apt-get install zabbix-server-mysql zabbix-frontend-php
       步骤二:使用 dbconfig-common 来为 zabbix-server-mysql 配置数据库,回答是。然后输入数据库管理员(DBA)的密码,再输入zabbix-server-mysql所用数据库的密码,如果留空的话则是一个随机生成的密码,重复输入一次之后就成功安装了 Zabbix


在ubuntu安装zabbix agent建议采用源码安装
  步骤一:下载zabbix源码包

  下载链接:http://www.zabbix.com/download.php

  步骤二:解压
  步骤三:./configure  --enable-agent
  make install

  步骤四:编辑配置文件 zabbix_agentd.conf
  cd /usr/local/etc/zabbix_agentd.conf

  Server=127.0.0.1
  

  步骤五:启动服务 zabbix_agentd

  

  

  另有直接通过apt-get install zabbix-agent 安装,没有成功启动

  

  









Installation from sources

Overview
  You can get the very latest version of Zabbix by compiling it from the sources.
  A step-by-step tutorial for installing Zabbix from the sources is provided here.

1 Installing Zabbix daemons

1 Download the source archive
  Go to the Zabbix download page and download the source archive. Once downloaded, extract the sources, by running:
$ tar -zxvf zabbix-2.0.0.tar.gz  

Enter the correct Zabbix version in the command. It must match the name of the downloaded archive.

2 Create user account
  For all of the Zabbix daemon processes, an unprivileged user is required. If a Zabbix daemon is started from an unprivileged user account, it will run as that user.
  However, if a daemon is started from a 'root' account, it will switch to a 'zabbix' user account, which must be present. To create such a user account (in its own group, “zabbix”) on Linux systems, run:
groupadd zabbix
useradd -g zabbix zabbix  A separate user account is not required for Zabbix frontend installation.
  If Zabbix server and agent are run on the same machine it is recommended to use a different user for running the server than for running the agent. Otherwise, if both are run as the same user, the agent can access the server configuration file and any Admin level user in Zabbix can quite easily retrieve, for example, the database password.
  

Running Zabbix as root, bin, or any other account with special rights is a security risk.

3 Create Zabbix database
  For Zabbix server and proxy daemons, as well as Zabbix frontend, a database is required. It is not needed to run Zabbix agent.
  SQLscripts are provided for creating database schema and inserting the dataset. Zabbix proxy database needs only the schema while Zabbix server database requires also the dataset on top of the schema.
  Having created a Zabbix database, proceed to the following steps of compiling Zabbix.

4 Configure the sources
  When configuring the sources for a Zabbix server or proxy, you must specify the database type to be used. Only one database type can be compiled with a server or proxy process at a time.
  To see all of the supported configuration options, inside the extracted Zabbix source directory run:
./configure --help  To configure the sources for a Zabbix server and agent, you may run something like:
./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl  To configure the sources for a Zabbix server (with PostgreSQL etc.), you may run:
./configure --enable-server --with-postgresql --with-net-snmp  To configure the sources for a Zabbix proxy (with SQLite etc.), you may run:
./configure --prefix=/usr --enable-proxy --with-net-snmp --with-sqlite3 --with-ssh2  To configure the sources for a Zabbix agent, you may run:
./configure --enable-agent  Use can add --enable-static flag to statically link libraries. If you plan to distribute compiled binaries among different servers, you must use this flag to make these binaries work without required libraries. Note that --enable-static does not work under Solaris.
  

Using --enable-static option is not recommended when building server.  In order to build the server statically you must have a static version of every external library needed. There is no strict check for that in configure script.

  

Command-line utilities zabbix_get and zabbix_sender are compiled if --enable-agent option is used.
  

Use --with-ibm-db2 flag to specify location of the CLI API.
Use --with-oracle flag to specify location of the OCI API.
  

--with-ucd-snmp flag can be used instead of --with-net-snmp. If no SNMP support is required, both --with-net-snmp and --with-ucd-snmp may be skipped.

5 Make and install everything
  

If installing from SVN, it is required to run first:  $ make dbschema

make install  This step should be run as a user with sufficient permissions (commonly 'root', or by using sudo).
  Running make install will by default install the daemon binaries (zabbix_server, zabbix_agentd, zabbix_proxy) in /usr/local/sbin and the client binaries (zabbix_get, zabbix_sender) in /usr/local/bin.
  

To specify a different location than /usr/local, use a --prefix key in the previous step of configuring sources, for example --prefix=/home/zabbix. In this case daemon binaries will be installed under /sbin, while utilities under /bin. Man pages will be installed under /share.

6 Review and edit configuration files

  • edit the Zabbix agent configuration file /usr/local/etc/zabbix_agentd.conf
  You need to configure this file for every host with zabbix_agentd installed.
  You must specify the Zabbix server IP address in the file. Connections from other hosts will be denied.

  • edit the Zabbix server configuration file /usr/local/etc/zabbix_server.conf
  You must specify the database name, user and password (if using any).
  

With SQLite the full path to database file must be specified; DB user and password are not required.
  The rest of the parameters will suit you with their defaults if you have a small installation (up to ten monitored hosts). You should change the default parameters if you want to maximize the performance of Zabbix server (or proxy) though. See the [Performance tuning] section for more details.

  • if you have installed a Zabbix proxy, edit the proxy configuration file /usr/local/etc/zabbix_proxy.conf
  You must specify the server IP address and proxy hostname (must be known to the server), as well as the database name, user and password (if using any).
  

With SQLite the full path to database file must be specified; DB user and password are not required.

7 Start up the daemons
  Run zabbix_server on the server side.
shell> zabbix_server  

Make sure that your system allows allocation of 36MB (or a bit more) of shared memory, otherwise the server may not start and you will see “Cannot allocate shared memory for .” in the server log file. This may happen on FreeBSD, Solaris 8.
See the "See also" section at the bottom of this page to find out how to configure shared memory.
  Run zabbix_agentd on all the monitored machines.
shell> zabbix_agentd  

Make sure that your system allows allocation of 2MB of shared memory, otherwise the agent may not start and you will see “Cannot allocate shared memory for collector.” in the agent log file. This may happen on Solaris 8.
  If you have installed Zabbix proxy, run zabbix_proxy.
shell> zabbix_proxy
2 Installing Zabbix web interface

Copying PHP files
  Zabbix frontend is written in PHP, so to run it a PHP supported webserver is needed. Installation is done by simply copying the PHP files from frontends/php to the webserver HTML documents directory.
  Common locations of HTML documents directories for Apache web servers include:

  • /usr/local/apache2/htdocs (default directory when installing Apache from source)
  • /srv/www/htdocs (OpenSUSE, SLES)
  • /var/www/html (Fedora, RHEL, CentOS)
  • /var/www (Debian, Ubuntu)
  It is suggested to use a subdirectory instead of the HTML root. To create a subdirectory and copy Zabbix frontend files into it, execute the following commands, replacing the actual directory:
mkdir /zabbix
cd frontends/php
cp -a . /zabbix  If installing from SVN and planning to use any other language than English, you must generate translation files. To do so, run:
locale/make_mo.sh  msgfmt utility from gettext package is required.
  

Additionally, to use any other language than English, its locale should be installed on the web server. See the "See also" section in the “User profile” page to find out how to install it if required.

Installing frontend

Step 1
  In your browser, open Zabbix URL: http:///zabbix
  You should see the first screen of the frontend installation wizard.


Step 2
  Make sure that all software prerequisites are met.

Pre-requisiteMinimum valueDescriptionPHP version5.1.6  
PHP memory_limit option128MB  In php.ini:
memory_limit = 128M  PHP post_max_size option16MB  In php.ini:
post_max_size = 16M  PHP upload_max_filesize option2MB  In php.ini:
upload_max_filesize = 2M  PHP max_execution_time option300 seconds  In php.ini:
max_execution_time = 300  PHP max_input_time option300 seconds  In php.ini:
max_input_time = 300  PHP session.auto_start optionmust be disabled  In php.ini:
session.auto_start = 0.
Required since Zabbix 2.0.4 version.  Database supportOne of: IBM DB2, MySQL, Oracle, PostgreSQL, SQLite  One of the following modules must be installed:
ibm_db2, mysql, oci8, pgsql, sqlite3  bcmath
php-bcmath  mbstring
php-mbstring  sockets
php-net-socket. Required for user script support.   gd2.0 or higher  php-gd. PHP GD extension must support PNG images (--with-png-dir), JPEG (--with-jpeg-dir) images and FreeType 2 (--with-freetype-dir). libxml2.6.15  php-xml or php5-dom  xmlwriter
php-xmlwriter  xmlreader
php-xmlreader  ctype
php-ctype  session
php-session  gettext
php-gettext  

Step 3
  Enter details for connecting to the database. Zabbix database must already be created.


Step 4
  Enter Zabbix server details.


Step 5
  Review a summary of settings.


Step 6
  Download the configuration file and place it under conf/.



Step 7
  Finish the installation.


Step 8
  Zabbix frontend is ready! The default user name is Admin, password zabbix.

  Proceed to getting started with Zabbix.

  





运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-667649-1-1.html 上篇帖子: Zabbix 监测项取不到数据问题解决20130822 下篇帖子: Zabbix 添加监控主机
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表