A
A
Andrey San2016-01-06 12:36:22
Zabbix
Andrey San, 2016-01-06 12:36:22

How to add zabbix-agentd to autoload?

Good afternoon, I collected the actions in a script,
as if trying to start the agent from precompiled files from the site

#!/bin/bash
echo "********"
echo "Runing....."
useradd zabbix
mkdir /var/log/zabbix
mkdir /etc/zabbix
mkdir /usr/src/zabbix
cd /usr/src/zabbix
cp /tmp/zabb* /usr/src/zabbix
tar zxvf zabb*
cp /usr/src/zabbix/sbin/zabbix_agentd /usr/local/bin
touch /usr/local/etc/zabbix_agentd.conf
echo "Server=192.168.1.1" >> /usr/local/etc/zabbix_agentd.conf
echo "ServerActive=192.168.1.1" >> /usr/local/etc/zabbix_agentd.conf
echo "Hostname=comp1" >> /usr/local/etc/zabbix_agentd.conf
echo "ListenPort=10050" >> /usr/local/etc/zabbix_agentd.conf
echo "LogFile=/var/log/zabbix/zabbix_agentd.log" >> /usr/local/etc/zabbix_agentd.conf
echo "LogFileSize=10" >> /usr/local/etc/zabbix_agentd.conf
echo "StartAgents=3" >> /usr/local/etc/zabbix_agentd.conf
chown -R zabbix:zabbix /var/log/zabbix
chown -R zabbix:zabbix /etc/zabbix
chown -R zabbix:zabbix /usr/local/etc/zabbix_agentd.conf
sudo -u zabbix /usr/local/bin/zabbix_agentd
echo "we must edit this file /usr/local/etc/zabbix_agentd.conf and restart service: sudo -u zabbix /usr/local/bin/zabbix_agentd restart"

Now the question is,
1. how to add to startup (Linux comp1 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux)?
2. how to restart the daemon? noticed that sudo -u zabbix /usr/local/bin/zabbix_agentd restart does not affect anything.
3. Am I doing everything right?
ps aux | grep zabbix
shows the following:

zabbix 1475 0.0 0.1 15496 700 ? S 02:12 0:00 /usr/local/bin/zabbix_agentd
zabbix 1476 0.0 0.1 15496 720 ? S 02:12 0:00 /usr/local/bin/zabbix_agentd: collector [idle 1 sec]
zabbix 1477 0.0 0.1 15496 564 ? S 02:12 0:00 /usr/local/bin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 1478 0.0 0.1 15496 564 ? S 02:12 0:00 /usr/local/bin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 1479 0.0 0.1 15496 564 ? S 02:12 0:00 /usr/local/bin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 1480 0.0 0.1 15516 756 ? S 02:12 0:00 /usr/local/bin/zabbix_agentd: active checks #1 [idle 1 sec]
root 1522 0.0 0.1 103236 852 pts/0 S+ 03:36 0:00 grep zabbix
packages seem to be coming:
15: 31:21.055145 IP comp1.49905 > zabbixsrv.zabbix-trapper: Flags [P.], seq 6:56, ack 1, win 457, options [nop,nop,TS val 14033175 ecr 1756148478], length 50
15:31:21.055181 IP zabbixsrv.zabbix-trapper > comp1.49905: Flags [.], ack 56, win 114, options [nop,nop,TS val 1756148479 ecr 14033175], length 0
But nothing is visible through the web:
Zabbix agent on comp1 is unreachable for 5 minutes

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Adam_West, 2017-02-07
@Adam_West

Add
systemctl enable zabbix-agent to autoload.
Testing, as for me, is better locally
zabbix_agentd -t agent.version
, before rebooting the daemon, then from a remote host added to the SourceIP of the agent under test

V
Vladimir Olohtonov, 2016-01-06
@sgjurano

1) Why not a package?
2) Autostart must be done through the initialization system adopted in the distribution, do not complicate your life.
3) Try testing via zabbix_get, it's much more convenient.

P
Puma Thailand, 2016-01-06
@opium

Put everything from the repo there are all the packages for the sixth centos and everything is installed in a minute and there are all the scripts for restart and autostart

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question