Archive

Posts Tagged ‘Zabbix’

Upgrading Zabbix from 2.4.x to 3.0.x on CentOS 7

April 13, 2016 Leave a comment

Before starting with the upgrade I recommend familiarising yourself with these pages.

Note! If you are upgrading from earlier versions then you need to upgrade from 1.8.x – 2.x to 2.4.x first. Have a look at my previous post about upgrading Zabbix.

Steps to upgrade

  1. If you are running Zabbix on a virtual machine take a snapshot to revert back to if something goes wrong.
  2. Clean up yum
    yum clean all
  3. Check what zabbix packages you have installed and take a note of them.
    rpm -qa | grep zabbix
  4. Stop Zabbix service.
    systemctl stop zabbix-server
  5. Backup Zabbix (you can skip these if you are using a snapshot)
    mkdir ~/etc_zabbix.bak
    cp -r -p /etc/zabbix/* ~/etc_zabbix.bak
    mkdir ~/web_zabbix.bak
    cp -r -p /usr/share/zabbix/* ~/web_zabbix.bak
    mysqldump -u zabbix -p zabbix > ~/zabbix_dump.sql
  6. Remove old zabbix repo and add the new 3.0.x repo
    rpm -e zabbix-release
    rpm -ivh
    http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
  7. Run yum update and install the new packages
    yum update
  8. Verify that new packages have been installed
    rpm -qa | grep zabbix
  9. Restart Zabbix services
    systemctl restart zabbix-agent
    systemctl restart zabbix-server
    -Eric
Categories: CentOS, Linux, Zabbix Tags: , ,

Zabbix Action to Start a Windows Service

March 21, 2016 Leave a comment

Using zabbix to restrart a service, when it unexpectedly stopped running

  1. Create a template for the custom service.
  2. Use the trigger to monitor the service and report the problem
  3. In the Zabbix Agent config allow remote commands
  4. Create an action to start the service

Create an action to start the service:

  • Click on Configuration > Actions > click Create action (top right corner) > Enter Action name and leave rest as default
  • Click on Conditions tab > Leave condition label (A) > remove any other conditions 
  • Conditions tab > add a new Trigger condition (Like so: Trigger = select the trigger created for the service (by clicking select)) > click Add to add the new condition
  • Click on Operations tab > Change Operation type to “Remote command” > Enter new Target as current host > Type equals ‘Custom script’ > Execute equals ‘Zabbix agent’ >  enter Command “sc \\{HOST.NAME} start ServiceName” > click Add to add the new reactive action and save the configuration
    To test this, turn of the service and wait for a few seconds to see if it has been started.

-Eric

Upgrading Zabbix from 1.8.x to 2.4.x

May 28, 2015 2 comments

Rough guide to get your monitoring server up to Zabbix 2.4.x on CentOS 6.x
The upgrade needs to be done in 3 stages.

Stage 1 – Upgrade from 1.8.x to 2.0.x: All steps, with 4a;5a;
Stage 2 – Upgrade from 2.0.x to 2.2.x: Only steps 1;2;3;4b;5b;7;8;
Stage 3 – Upgrade from 2.2.x to 2.4.x: Only steps 1;2;3;4c;5c;7;8;9;

  1. Stop Zabbix Services
    /etc/init.d/zabbix-server stop
    /etc/init.d/zabbix-agent stop
  2. Take a backup of zabbix configuration files (/etc/zabbix/*)
    mkdir ~/etc_zabbix.bak
    cp -r -p /etc/zabbix/* ~/etc_zabbix.bak
  3. Take a backup of Zabbix database (mysql)
    mysqldump -u zabbix -p zabbix > ~/zabbix_dump.sql
  4. Remove your existing Zabbix Installation
    a) yum erase zabbix*
    b) yum erase zabbix20* – remove zabbix 2.0 –
    c) yum erase zabbix22* – remove zabbix 2.2

    Note! For version 2.0 and 2.2 installed via epel use commands below

  5. Install Zabbix
    a) yum –enablerepo=epel install zabbix20-server-mysql zabbix20-agent zabbix20-web-mysql
    b) yum install zabbix22-server-mysql zabbix22-agent zabbix22-web-mysql
    c) Add 2.4 repo:  rpm -ivh http://repo.zabbix.com/zabbix/2.4/rhel/6/x86_64/zabbix-release-2.4-1.el6.noarch.rpm
    Install zabbix 2.4: yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent
  6. Upgrade DB Schema from 1.8.x to 2.0.x consists of 2 steps. (Only required for 1.8 to 2.0)
    a) make upgrade script executable.
    chmod +x /usr/share/zabbix-mysql/upgrades/2.0/upgrade
    b) run the script
    cd /usr/share/zabbix-mysql/upgrades/2.0/
    ./upgrade -u zabbix -p zabbix

    Note! Bear in mind that upgrade will take a while and you will get multiple DB password prompts
    Note2! for Stage2 and Stage3, mysql upgrade will happen automatically after you start Zabbix

  7. Next compare and update your configuration files. Old config files are in the zabbix folder (/etc/zabbix/) with the following extension .rpmsave
    Use the following commands to compare:
    diff /etc/zabbix/zabbix_agentd.conf.rpmsave /etc/zabbix_agentd.conf
    diff /etc/zabbix/zabbix_server.conf.rpmsave /etc/zabbix_server.conf
    Or use a tool called winmerge
  8. Start Zabbix-services
    /etc/init.d/zabbix-server start
    /etc/init.d/zabbix-agent start
  9. Enable autostart for Zabbix services
    chkconfig zabbix-server on
    chkconfig zabbix-agent on

-Eric