|
|
(7 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| [[Category:Linux]] | | [[Category:Linux]] |
| | | |
| + | This page describe the server requirements to install Zabbix monitoring. |
| | | |
− | =System installation=
| + | You can skip that part if you already have a running server. |
| | | |
− | ==Requirements==
| |
| | | |
− | You should already have: | + | |
| + | =Requirements= |
| + | |
| + | |
| + | You '''network''' must contain | provide: |
| * [[DNS server]] | | * [[DNS server]] |
| * [[DHCP server]] | | * [[DHCP server]] |
Line 12: |
Line 16: |
| | | |
| | | |
− | ==O.S installation==
| + | |
| + | The '''server''' must have: |
| + | * [[Apache 2]] web server |
| + | * [[MySQL server]] |
| + | * [[Firewall]] with allowance for INPUT TCP 10051 |
| + | * [[SNMP client]] |
| + | |
| + | |
| + | |
| + | |
| + | =O.S installation= |
| | | |
| On dedicated hardware you need to install '''Ubuntu Server 14.04 LTS''' using an USB key. | | On dedicated hardware you need to install '''Ubuntu Server 14.04 LTS''' using an USB key. |
− |
| |
| | | |
| | | |
Line 110: |
Line 123: |
| vim /root/.bashrc | | vim /root/.bashrc |
| </syntaxhighlight> | | </syntaxhighlight> |
− |
| |
− |
| |
− |
| |
− | ==Firewall script==
| |
− |
| |
− | See [[Firewall]] to get more details.
| |
− |
| |
− |
| |
− | ==SNMP client==
| |
− |
| |
− | See [[SNMP client]]
| |
− |
| |
| | | |
| | | |
Line 150: |
Line 151: |
| iface em1 inet dhcp | | iface em1 inet dhcp |
| </syntaxhighlight> | | </syntaxhighlight> |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =Zabbix server # installation=
| |
− |
| |
− |
| |
− | Source: https://www.zabbix.com/documentation/2.2/manual/installation/install_from_packages
| |
− |
| |
− |
| |
− |
| |
− | ==Add Zabbix repository==
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | wget http://repo.zabbix.com/zabbix/2.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_2.2-1+trusty_all.deb
| |
− | dpkg -i zabbix-release_2.2-1+trusty_all.deb
| |
− | apt-get update
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | ==Install Zabbix server==
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | apt-get install zabbix-server-mysql zabbix-frontend-php
| |
− |
| |
− | # install Java Gateway too
| |
− | apt-get install zabbix-java-gateway
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | During installation you have to set:
| |
− | * MySQL administrator password
| |
− | * Allow the automatic DB configuration: reply '''yes'' to "Configure DB for zabbix-server-mysql with dbconfig-common?"
| |
− | * Enter your administrator password
| |
− | * Set the MySQL zabbix password. As this will only be used inside a LAN (in my case) I put '''zabbix''' as password
| |
− |
| |
− |
| |
− | The ''Zabbix server'' application will now use the MySQL login: '''zabbix''' and the password I set earlier ('''zabbix''').
| |
− |
| |
− |
| |
− | -NOTE-
| |
− |
| |
− | Zabbix server also required some specific SNMP libraries:
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | apt-get install libnet-snmp-perl python-netsnmp
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | ==Install zabbix-agent on zabbix-server==
| |
− |
| |
− | It's recommended to monitor your zabbix-server as well with the other servers. Therefore you should install a local ''zabbix-agent''.
| |
− |
| |
− |
| |
− | See installation notes: [[Zabbix agent setup]]
| |
− |
| |
− |
| |
− |
| |
− | ==Allow remote connections to MySQL==
| |
− |
| |
− | See [[MySQL server]]
| |
− |
| |
− |
| |
− |
| |
− | ==Set timezone and PHP settings==
| |
− |
| |
− | Edit the configuration file
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | vim /etc/apache2/conf.d/zabbix
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− | Find the following lines and edit them as follows. If the lines doesn’t exists, add them.
| |
− | <syntaxhighlight lang="bash">
| |
− | [...]
| |
− | php_value max_execution_time 300
| |
− | php_value memory_limit 128M
| |
− | php_value post_max_size 16M
| |
− | php_value upload_max_filesize 2M
| |
− | php_value max_input_time 300
| |
− | php_value date.timezone Asia/Kolkata
| |
− | [...]
| |
− | </syntaxhighlight>
| |
− |
| |
− | Adjust your timezone !! To get the right value see: http://www.php.net//manual/en/timezones.php
| |
− |
| |
− | Save and close the file.
| |
− |
| |
− |
| |
− | ==Set Apache2 V.Host==
| |
− |
| |
− | Last step: you have to copy this configuration to your local Apache2 server [zabbix has installed one for you].
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | cp /etc/apache2/apache.conf /etc/apache2/conf-available/zabbix.conf
| |
− | a2enconf zabbix.conf
| |
− | service apache2 reload
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− |
| |
− | ==Restart zabbix server==
| |
− |
| |
− | To restart zabbix you have to restart 2 processes:
| |
− | * BACKEND: Zabbix-server
| |
− | * FRONTEND: Apache2
| |
− |
| |
− |
| |
− | <syntaxhighlight lang="bash">
| |
− | service apache2 restart
| |
− | service zabbix-server restart
| |
− | </syntaxhighlight>
| |
− |
| |
− |
| |
− |
| |
− | =Zabbix server # Web installer=
| |
− |
| |
− | Now you can, at least, run the web-installer.
| |
− |
| |
− |
| |
− | Go to http://yourserver/'''zabbix'''
| |
− |
| |
− |
| |
− | ==Installation==
| |
− |
| |
− |
| |
− | Welcome screen:
| |
− |
| |
− | [[File:zabbix_installation_01.png|none|Zabbix server installation 01]]
| |
− |
| |
− |
| |
− | Installation check:
| |
− |
| |
− | [[File:zabbix_installation_02.png|none|Zabbix server installation 02]]
| |
− |
| |
− |
| |
− |
| |
− | Database configuration:
| |
− |
| |
− | [[File:zabbix_installation_03.png|none|Zabbix server installation 03]]
| |
− |
| |
− | During the installation Zabbix already setup a database for us! :)
| |
− | * '''Db host''': localhost
| |
− | * '''Db Port''': 3306 (default)
| |
− | * '''Db name''': zabbix
| |
− | * '''Db user''': zabbix
| |
− | * '''Db password''': ''your password'' (mine is ''zabbix'')
| |
− |
| |
− |
| |
− |
| |
− | Zabbix server details
| |
− |
| |
− | [[File:zabbix_installation_04.png|none|Zabbix server installation 04]]
| |
− |
| |
− | You can, if you want, name your installation. In my case I will not have any proxy or other zabbix server so I didn't used that option.
| |
− |
| |
− |
| |
− | Confirmation
| |
− |
| |
− | [[File:zabbix_installation_05.png|none|Zabbix server installation 05]]
| |
− |
| |
− |
| |
− |
| |
− | ==First login==
| |
− |
| |
− | [[File:zabbix_installation_06.png|none|Zabbix server installation 06]]
| |
− |
| |
− | Default credentials are:
| |
− | * Username = Admin
| |
− | * Password = zabbix
| |
− |
| |
− | Notice the big 'A' for ''Admin''.
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =Zabbix agents=
| |
− |
| |
− | Now you should configure your zabbix agents to use the current server. See [[Zabbix agent setup]]
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =Zabbix server configuration=
| |
− |
| |
− |
| |
− | Login to your zabbix server: http://myServer/zabbix
| |
− |
| |
− |
| |
− | ==Add host==
| |
− |
| |
− | You have to had a host (= machine with a zabbix agent) on the server side in order to monitor it.
| |
− |
| |
− |
| |
− | 1. Go to the Configuration > "Add host" menu
| |
− |
| |
− | [[File:add-zabbix-host-1.png|none|Zabbix add host - step 01]]
| |
− |
| |
− | * Click on Configuration Menu
| |
− | * Click on Hosts submenu
| |
− | * Click on Create Host button at right side
| |
− |
| |
− |
| |
− |
| |
− | 2. Now fill the following details of remote host
| |
− |
| |
− | [[File:add-zabbix-host-2.png|none|Zabbix add host - step 02]]
| |
− |
| |
− | * '''Hostname''': Hostname of Remote system
| |
− | * '''Visible''' name: Name to be display in zabbix
| |
− | * '''Group''': Select the desired group for you host
| |
− | ** You should use ''Linux'' at least
| |
− | ** You can create your own groups and classification as well
| |
− | * Agent interface: Fill the info of Zabbix agent running on host
| |
− | ** Select the '''DNS''' option instead of IP. So if we move the client for any reason that will NOT impact the monitoring. :)
| |
− | * Status: Select initial status
| |
− |
| |
− |
| |
− | '''IMPORTANT !!''' The name of the ''hostname'' must match the real hostname - as return by the `hostname` command !!
| |
− |
| |
− |
| |
− | 3. Set some ''monitoring templates'' to apply
| |
− |
| |
− | Click on the "Templates" tab
| |
− |
| |
− | [[File:add-zabbix-host-3.png|none|Zabbix add host - step 03]]
| |
− |
| |
− | To get the list of templates, just type '''template''' in the search area. Select, at least:
| |
− | * Template OS Linux
| |
− | * (if your client is NOT a Linux) Template Zabbix agent
| |
− |
| |
− | ''Don't forget to click the "ADD" button!''
| |
− |
| |
− |
| |
− | The ''Linux OS'' includes the Zabbix agent template. :)
| |
− |
| |
− |
| |
− |
| |
− | 4. Automatic host inventory
| |
− |
| |
− | Click on the "host inventory" tab
| |
− |
| |
− | [[File:add-zabbix-host-4.png|none|Zabbix add host - step 04]]
| |
− |
| |
− | Enable the '''Automatic''' option.
| |
− | Click "save" at the bottom of the page.
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | ==Setup host discovery==
| |
− |
| |
− |
| |
− | ===Discovery settings===
| |
− |
| |
− | Go to menu '''Configuration > Discovery''', then click on "Local Network". Fill the form:
| |
− |
| |
− | [[File:add-zabbix-discovery-1.png|none|Zabbix discovery - step 01]]
| |
− |
| |
− | * Set the correct '''LAN settings'''
| |
− | * Adjust the time from ''3600'' to ''900'' (check every 15 minutes)
| |
− | * Enable the following Checks:
| |
− | ** '''ICMP ping'''
| |
− | ** '''zabbix agent'''
| |
− | ** '''SSH'''
| |
− | ** '''SNMP''' with the following params:
| |
− | *** version: ''SNMPv2''
| |
− | *** port range: ''161'' (default)
| |
− | *** community: ''vehco''
| |
− | *** SNMP OID: ''SNMPv2-MIB::sysName.0''
| |
− | * Use a search by '''IP @''' filter
| |
− | * '''Enable discovery'''
| |
− |
| |
− | ===Create actions===
| |
− |
| |
− | Go to menu '''Configuration > Actions'''
| |
− |
| |
− |
| |
− | 1. Select the actions' group '''Discovery''':
| |
− |
| |
− | [[File:zabbix-actions-discovery.png|none|Zabbix discovery actions]]
| |
− |
| |
− |
| |
− |
| |
− | 2. Edit the ''Auto discovery. Linux server'' action:
| |
− |
| |
− | [[File:zabbix-actions-discovery-linux-01.png|none|Zabbix discovery action - Linux server step 01]]
| |
− |
| |
− | * Enable the action
| |
− |
| |
− |
| |
− | On the "configuration" tab...
| |
− |
| |
− | Add a "Host IP" filter with your correct LAN as a 4th filter
| |
− |
| |
− | [[File:zabbix-actions-discovery-linux-02.png|none|Zabbix discovery action - Linux server step 02]]
| |
− |
| |
− |
| |
− |
| |
− | =View Graph in Zabbix=
| |
− |
| |
− | Graphs are always attracted the new users, Below screenshot will help you to how to view graphs in zabbix. If you have just added the host, you need to wait for few time, so that zabbix can collect some data from remote host to show on graph.
| |
− |
| |
− | graph-network
| |
− |
| |
− | Thank You for using this article, if this tutorial helps please do forgot to share it with your friends
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =Increase history=
| |
− |
| |
− | Follow the excellent Zabbix documentation: https://www.zabbix.com/documentation/2.2/manual/web_interface/frontend_sections/administration/general#housekeeper
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =Custom templates=
| |
− |
| |
− | Go to Configuration > Templates
| |
− |
| |
− | Search for the template you want to work with and click on "Items" or "triggers" to adjust the monitoring options.
| |
− |
| |
− | [[File:zabbix-template-conf-01.png|none|Zabbix template configuration - 01]]
| |
− |
| |
− |
| |
− |
| |
− | ==Template OS Linux==
| |
− |
| |
− | Search for "Template OS Linux" on the templates list and click on "items".
| |
− |
| |
− |
| |
− | ===Items settings===
| |
− |
| |
− | Disable the following filters (by clicking on "enabled" option - on the right):
| |
− | * Checksum of /etc/password
| |
− | * Free swap size
| |
− | * Free swap size in %
| |
− | * Host local time
| |
− | * Total swap size
| |
− |
| |
− |
| |
− | - - - -Notes- - - -
| |
− |
| |
− | NetBoot specifics:
| |
− | * All NetBoot clients share the same /etc/password. So modifications can occurred
| |
− | * There is NO swap in NetBoot clients.
| |
− | * No need of local time since they all use NTP
| |
− |
| |
− |
| |
− | ===Triggers===
| |
− |
| |
− | Disable the following triggers:
| |
− | * /etc/passwd has been changed
| |
− | * Lack of free swap space
| |
− |
| |
− |
| |
− | ===Graphs===
| |
− |
| |
− | You can create a new graph to display both the memory usage + process of the server:
| |
− |
| |
− | [[File:zabbix-template-graph-01.png|none|Zabbix template graph - 01]]
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | ==Zabbix server configuration files==
| |
− |
| |
− | Main zabbix server configuration file is available in: "/etc/zabbix/zabbix_server.conf"
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− |
| |
− | =References=
| |
− |
| |
− | Zabbix official documentation (very good): https://www.zabbix.com/documentation/
| |
− |
| |
− |
| |
− | Digitial Ocean community - Zabbix tutorial: https://www.digitalocean.com/community/tutorials/389
| |
− |
| |
− |
| |
− | Tecadmin tutorial:
| |
− | * step 1 : zabbix-server installation: http://tecadmin.net/install-zabbix-on-ubuntu/
| |
− |
| |
− | * step 2 : zabbix-agent installation: http://tecadmin.net/install-zabbix-agent-centos-rhel-and-ubuntu/
| |
− |
| |
− | * step 3 : host configuration on server side: http://tecadmin.net/add-host-zabbix-server-monitor/
| |
− |
| |
− |
| |
− |
| |
− | Zabbix SNMP configuration:
| |
− | * Official documentation: https://www.zabbix.com/documentation/2.2/manual/config/items/itemtypes/snmptrap
| |
− | * Nice setup tutorial for basic discovery: http://projectdaenney.org/blog/2012/10/14/zabbix-baby-steps-part-1/
| |
− | * Nice tutorial for advanced stuff: http://www.zabbix.org/wiki/Start_with_SNMP_traps_in_Zabbix
| |