ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Install Zabbix on CentOS 7

    IT Discussion
    how to zabbix zabbix 3.0 zabbix server centos 7 centos
    13
    51
    12.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • JaredBuschJ
      JaredBusch
      last edited by JaredBusch

      Install CentOS 7

      yum -y update
      yum -y install epel-release
      

      Install things you will need (my ISO is based on 1511 which did not have firewalld install by default).

      yum -y install wget nano mariadb mariadb-server firewalld setroubleshoot setools
      

      Turn SELinux off for the install. This is specifically not permanent.

      setenforce 0
      

      Change SELinux to allow Zabbix to connect to the network

      setsebool -P httpd_can_connect_zabbix on
      setsebool -P zabbix_can_network on
      

      Start and enable the firewall. Allow HTTP/S and Zabbix ports.

      systemctl enable firewalld
      systemctl start firewalld
      firewall-cmd --zone=public --add-port=http/tcp --permanent
      firewall-cmd --zone=public --add-port=https/tcp --permanent
      firewall-cmd --zone=public --add-port=10050/tcp --permanent
      firewall-cmd --zone=public --add-port=10051/tcp --permanent
      firewall-cmd --reload
      

      Start the database and then run the initial configuration

      systemctl enable mariadb
      systemctl start mariadb
      mysql_secure_installation
      

      This will start a wizard to enable typical security measure for the database. The capitalized letter is the default, and is the choice you want to make, so you can simply hit enter through all of these except for setting the new password, obviously.

      Enter current password for root (enter for none):
      Set root password? [Y/n]
      New password: databaserootpassword
      Re-enter new password: databaserootpassword
      Remove anonymous users? [Y/n]
      Disallow root login remotely? [Y/n]
      Remove test database and access to it? [Y/n]
      Reload privilege tables now? [Y/n]
      

      Sign in to the database and create the ownCloud instance and user.
      You will be prompted to enter your database root password.

      mysql -uroot -p
      

      Now you will run 4 SQL commands, please note the ; at the end of each. It is a required part of the SQL syntax . These are simplified defaults, I would generally recommend you set them to something a little less obvious just to help with security.

      create database zabbixdb;
      create user 'zabbixuser'@'localhost' identified by 'zabbixuserpassword'; 
      grant all on zabbixdb.* to 'zabbixuser'@'localhost';
      flush privileges;
      quit
      

      Install the Zabbix repository

      # Zabbix 3.0
      #rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
      # Zabbix 3.2
      rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm
      

      Install Zabbix Server

      yum install zabbix-server-mysql zabbix-web-mysql
      

      From here you can now pick up with the main Zabbix instructions from this point.

      I'll retype those later or something.

      After your system is up and running, reboot. You should hopefully have a problem with SELinux blocking a couple of things.

      [root@zabbix ~]# sealert -a /var/log/audit/audit.log | grep zabbix
      SELinux is preventing /usr/sbin/zabbix_server_mysql from using the setrlimit access on a process.
      <snip lots of text>
      SELinux is preventing /usr/sbin/zabbix_agentd from using the setrlimit access on a process.
      

      Now that these errors are in the audit log, we can set up SELinux to allow it.

      If anyone knows SELinux well enough to create the policies needed without waiting for a fail, just let me know. I will be happy to update these instructions.

      ausearch -c 'zabbix_server' --raw | audit2allow -M my-zabbixserver
      semodule -i my-zabbixserver.pp
      ausearch -c 'zabbix_agentd' --raw | audit2allow -M my-zabbixagentd
      semodule -i my-zabbixagentd.pp
      
      1 Reply Last reply Reply Quote 6
      • DustinB3403D
        DustinB3403
        last edited by

        Nice concise guide.

        Should be scriptable easily enough as well.

        1 Reply Last reply Reply Quote 0
        • S
          Sparkum
          last edited by

          Awesome thanks!
          I'll be following this tonight

          1 Reply Last reply Reply Quote 0
          • StrongBadS
            StrongBad
            last edited by

            Very nice, thank you!

            1 Reply Last reply Reply Quote 0
            • wirestyle22W
              wirestyle22
              last edited by

              This is great. Thanks!

              1 Reply Last reply Reply Quote 0
              • hobbit666H
                hobbit666
                last edited by

                Now just need to write a guide to unlock it's power, like getting IOPS and other stuff from VM's and ESXi hosts 😄

                dafyreD 1 Reply Last reply Reply Quote 0
                • dafyreD
                  dafyre @hobbit666
                  last edited by

                  @hobbit666 said in Install Zabbix on CentOS 7:

                  Now just need to write a guide to unlock it's power, like getting IOPS and other stuff from VM's and ESXi hosts 😄

                  For the individual VMs, you can push the agent to them. I know it can do some stuff in VMware, but I've not had a VMware host to set that up on.

                  1 Reply Last reply Reply Quote 0
                  • AmbarishrhA
                    Ambarishrh
                    last edited by

                    I wrote a post about this on my blog recently. planning the second part on the monitoring part but got deviated to a new project that i am working on.
                    https://www.ambarishrh.com/2016/08/create-an-awesome-server-monitoring-dashboard-with-zabbix-and-grafana/

                    S 1 Reply Last reply Reply Quote 3
                    • S
                      Sparkum @Ambarishrh
                      last edited by

                      @Ambarishrh

                      I think its worth noting that its with a capital "A"
                      As I definitely typed it wrong alot before realizing

                      0_1471639643395_Zabbix.PNG

                      AmbarishrhA 1 Reply Last reply Reply Quote 0
                      • AmbarishrhA
                        Ambarishrh @Sparkum
                        last edited by

                        @Sparkum said in Install Zabbix on CentOS 7:

                        @Ambarishrh

                        I think its worth noting that its with a capital "A"
                        As I definitely typed it wrong alot before realizing

                        0_1471639643395_Zabbix.PNG

                        Thanks @Sparkum will check and update 🙂

                        1 Reply Last reply Reply Quote 0
                        • RomoR
                          Romo
                          last edited by

                          Just finished setting up a Zabbix vm following the guide =).

                          JaredBuschJ 1 Reply Last reply Reply Quote 2
                          • JaredBuschJ
                            JaredBusch @Romo
                            last edited by

                            @Romo said in Install Zabbix on CentOS 7:

                            Just finished setting up a Zabbix vm following the guide =).

                            I need to finish the guide and figure out the SELinux issues.

                            RomoR 1 Reply Last reply Reply Quote 0
                            • RomoR
                              Romo @JaredBusch
                              last edited by

                              @JaredBusch It's true, totally forgot we used setenforce 0 in the guide, so I am not actually finished just yet then =P

                              1 Reply Last reply Reply Quote 1
                              • RomoR
                                Romo
                                last edited by

                                Using setsebool -P httpd_can_connect_zabbix=1 everything appears to be working.

                                1 Reply Last reply Reply Quote 1
                                • S
                                  Sparkum
                                  last edited by

                                  So I've got this installed, I've got the agent installed on my windows box, but just cant get any data to send.

                                  I can telnet from Zabbix to windows box on 10050 but not the other way around.

                                  Would that be my issue or no?

                                  Thanks

                                  RomoR 1 Reply Last reply Reply Quote 0
                                  • RomoR
                                    Romo @Sparkum
                                    last edited by

                                    @Sparkum Agents listen on port 10050 and apparently the server listens on port 10051;

                                    so runnning the following on the server:
                                    firewall-cmd --permanent --add-port=10051/tcp
                                    systemctl restart firewalld

                                    Should get the agents connecting properly to the server, I haven't tested it because I have not set any agents to monitor yet in the lab, but from reading the documentation is should work.

                                    S 1 Reply Last reply Reply Quote 1
                                    • S
                                      Sparkum @Romo
                                      last edited by

                                      @Romo
                                      Hmm still no, silly Z doesnt wanna turn green.

                                      I assume if I added a linux box I would be up in second.

                                      RomoR 1 Reply Last reply Reply Quote 0
                                      • RomoR
                                        Romo @Sparkum
                                        last edited by

                                        @Sparkum Can you post your dashboard please =). Did you activate the host, Configuration>hosts>yourhost>enable?

                                        S 1 Reply Last reply Reply Quote 0
                                        • S
                                          Sparkum @Romo
                                          last edited by Sparkum

                                          @Romo

                                          Sorry just a screenshot of my dashboard?

                                          Yep, host is enabled.

                                          I'm getting stats from the Zabbix agent, just now windows agent.

                                          0_1472064751862_Zabbix.PNG

                                          RomoR 1 Reply Last reply Reply Quote 0
                                          • RomoR
                                            Romo @Sparkum
                                            last edited by Romo

                                            @Sparkum So its working now, right?

                                            S 1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 1 / 3
                                            • First post
                                              Last post