Pb zabbix

En ligne de commande sur le serveur zabbix : root@wctsrv0010:/usr/local/bin# zabbix_get -p 10050 -k agent.version -s wctsrv0041

zabbix_get [1536]: Check access restrictions in Zabbix agent configuration

Sur l’inteface web :

Received empty response from Zabbix Agent at [10.129.20.53]. Assuming that agent dropped connection because of access permissions

Server=emea_zabbix.wabtec.com

Install Zabbix Linux oracle RHEL 5

useradd -r zabbix
mkdir /etc/zabbix/

repository zabbix http://repo.zabbix.com/zabbix/3.2/

RHEL5 : rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/5/x86_64/zabbix-agent-3.2.0-1.el5.x86_64.rpm

yum install zabbix-agent

scp root@vlbid41x.ft.grp:/usr/bin/zabbix* /usr/bin/
scp root@vlbid41x.ft.grp:/usr/sbin/zabbix* /usr/sbin/
scp root@vlbid41x.ft.grp:/etc/zabbix/zabbix_agentd.conf /etc/zabbix/

cd /exploit/scripts

scp admse_efougere@wctsrv0011.wabtec.com:/exploit/scripts/zab_*.sh .

vim /etc/zabbix/zabbix_agentd.conf

Hostname=WCTSRV00XX.wabtec.com
ListenIP=10.129.32.XX
UserParameter=zab_mem_free,/exploit/scripts/zab_mem_free.sh
UserParameter=zab_proc_mem[*],/exploit/scripts/zab_proc_mem.sh $1
UserParameter=zab_proc_cpu[*],/exploit/scripts/zab_proc_cpu.sh $1
UserParameter=zab_test_port[*],/exploit/scripts/zab_test_port.sh $1 $2

service zabbix-agent start

—– log dans :
cat /exploit/logs/zabbix_agentd.log

Test the proper operation of the agent

Connect on vmoni with root account

cd /usr/local/bin

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s servername

Install zabbix UBUNTU 18

add-apt-repository universe

apt install zabbix-agent

cp /etc/zabbix/zabbix_agentd.conf /etc/zabbix/zabbix_agentd.conf.ori

vim /etc/zabbix/zabbix_agentd.conf

PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/exploit/logs/zabbix_agentd.log
LogFileSize=100
Server=CCO_PRD_ZABBIX_1.ft.grp
ServerActive=127.0.0.1
Hostname=dcdsrv0031
Include=/etc/zabbix/zabbix_agentd.conf.d/*.conf
UserParameter=zab_mem_free,/exploit/scripts/zab_mem_free.sh
UserParameter=zab_proc_mem[*],/exploit/scripts/zab_proc_mem.sh $1
UserParameter=zab_proc_cpu[*],/exploit/scripts/zab_proc_cpu.sh $1
UserParameter=zab_test_port[*],/exploit/scripts/zab_test_port.sh $1 $2

cd /exploit/scripts

scp root@vsch1.ft.grp:/exploit/scripts/zab_*.sh .

service zabbix-agent start

Install Zabbix Linux oracle RHEL 7

useradd -r zabbix
mkdir /etc/zabbix/

repository zabbix http://repo.zabbix.com/zabbix/3.2/

RHEL7 : rpm -Uvh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm

yum install zabbix-agent

scp root@vlbid41x.ft.grp:/usr/bin/zabbix* /usr/bin/
scp root@vlbid41x.ft.grp:/usr/sbin/zabbix* /usr/sbin/
scp root@vlbid41x.ft.grp:/etc/zabbix/zabbix_agentd.conf /etc/zabbix/

cd /exploit/scripts

scp admse_efougere@wctsrv0011.wabtec.com:/exploit/scripts/zab_*.sh .

vim /etc/zabbix/zabbix_agentd.conf

Hostname=WCTSRV00XX.wabtec.com
PidFile=/run/zabbix/zabbix_agentd.pid
ListenIP=10.129.32.XX
UserParameter=zab_mem_free,/exploit/scripts/zab_mem_free.sh
UserParameter=zab_proc_mem[*],/exploit/scripts/zab_proc_mem.sh $1
UserParameter=zab_proc_cpu[*],/exploit/scripts/zab_proc_cpu.sh $1
UserParameter=zab_test_port[*],/exploit/scripts/zab_test_port.sh $1 $2
ln -s "/etc/zabbix/zabbix_agentd.conf" "/usr/local/etc/zabbix_agentd.conf"

vim /lib/systemd/system/zabbix-agent.service

[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/etc/zabbix/zabbix_agentd.conf"
#EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/run/zabbix/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s

[Install]
WantedBy=multi-user.target

rm /exploit/logs/zabbix_agentd.log
systemctl stop zabbix-agent.service
systemctl start zabbix-agent.service
systemctl status zabbix-agent.service

(éventuellement refaire un stop  + start)

—– log dans :

cat /var/log/messages

Test the proper operation of the agent

Connect on vmoni with root account

cd /usr/local/bin

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s servername

 

Sonde zab_du_folder

Cette sonde permet de mesurer la taille d’un dossier.
Equivalent de :

[root@dcdsrv0016 mysql]# du /data/mysql/FT_DATAMART_EDU
238589436 /data/mysql/FT_DATAMART_EDU

[root@dcdsrv0016 mysql]# du -sh /data/mysql/FT_DATAMART_EDU
228G /data/mysql/FT_DATAMART_EDU
Créer le script

vi /exploit/scripts/zab_du_folder.sh

#!/bin/bash
w_folder=$1
cd ${w_folder}
du | tr -d [:punct:]

chmod 755 /exploit/scripts/zab_du_folder.sh

Ajouter le UserParameter au fichier conf de zabbix

vi /etc/zabbix/zabbix_agentd.conf

UserParameter=zab_du_folder[*],/exploit/scripts/zab_du_folder.sh $1

Arrêter et redémarrer l’agent zabbix

sh /etc/rc.d/init.d/zabbix_agent_stop.sh

sh /etc/rc.d/init.d/zabbix_agent_start.sh

Tester depuis le serveur zabbix vlcco19p.ft.grp

root@vlcco19p:~# zabbix_get -s dcdsrv0016.ft.grp -p 10050 -k zab_du_folder[/data/mysql/FT_DATAMART_EDU]
238589436

Ajouter la sonde dans zabbix
Si la commande retourne une liste de fichier au lieu de la taille
root@vlcco19p:~# zabbix_get -s dcdsrv0016.ft.grp -p 10050 -k zab_du_folder[/data/mysql/FT_DATAMART_EDU]
4 root
8 tmpXIMunix
4 tmpsystemdprivate208244b537644f73804a9b17dd880207vgauthdserviceeRgKpE
4 tmpX11unix
4 tmpsystemdprivate208244b537644f73804a9b17dd880207ntpdservicerMHKSt
4 tmpsystemdprivate208244b537644f73804a9b17dd880207vmtoolsdserviceWUaSS6
4 tmpfontunix
8 tmpTestunix
4 tmpICEunix
2264 tmp
16 lostfound
220 softdistribmysql575721repodata
755032 softdistribmysql575721
220 softdistribmysql57repodata
755256 softdistribmysql57
180 softdistribbackupexecmessageses
180 softdistribbackupexecmessagesfr
180 softdistribbackupexecmessagesko
...
il faut modifier les droits sur le dossier à mesurer.

755 sur le dossier
644 sur les fichiers sous le dossier

Sur le serveur dcdsrv0016.ft.grp
chmod 755 /data/mysql/FT_DATAMART_EDU

cd /data/mysql/FT_DATAMART_EDU
chmod 644 *

Install zabbix (rapide)

Sur DCDSRV0022 (cible)
mkdir /etc/zabbix/

depuis vlbid41x(source)
scp /home/zabbix/zabbix_agent_3.2.0/bin/* root@dcdsrv0014:/usr/bin/

scp root@vlbid41x.ft.grp:/usr/bin/zabbix* /usr/bin/
scp root@vlbid41x.ft.grp:/usr/sbin/zabbix* /usr/sbin/
scp root@vlbid41x.ft.grp:/etc/zabbix/zabbix_agentd.conf /etc/zabbix/

Sur DCDSRV0022 (cible)

vim /etc/zabbix/zabbix_agentd.conf

Server=CCO_PRD_ZABBIX_1.ft.grp
Hostname=DCDSRV0022 .ft.grp
ListenPort=10050
ListenIP=10.20.115.63

cd /exploit/scripts
scp root@vsch1.ft.grp:/exploit/scripts/zab_*.sh .

 

Test the proper operation of the agent

Connect on vmoni with root account

cd /usr/local/bin

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s servername

Check d’un process proc.num[]

Monitoring d’un process sous Linux avec Zabbix.

Exemple pour le process BIP.

zabbix_get -p 10050 -k proc.num[,seeasown,,/soft/BIP/runtime/jvm64/bin/java] -s vledi01p
3

ps -ef|grep BIP|grep -v grep
seeasown 30335 1 0 10:22 ? 00:00:00 /bin/sh /soft/BIP/bin/domain.sh
seeasown 30410 30335 0 10:22 ? 00:00:06 /soft/BIP/runtime/jvm64/bin/java -D[Process Controller] -server -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml -Dvm.bisas.db.ssl=false -Dorg.jboss.boot.log.file=/soft/BIP/log/BIP_VLEDI01P//process-controller.log -Dlogging.configuration=file:/soft/BIP/domain/configuration/logging.properties -jar /soft/BIP/jboss-modules.jar -mp /soft/BIP/modules org.jboss.as.process-controller -jboss-home /soft/BIP -jvm /soft/BIP/runtime/jvm64/bin/java -mp /soft/BIP/modules -- -Dorg.jboss.boot.log.file=/soft/BIP/log/BIP_VLEDI01P//host-controller.log -Dlogging.configuration=file:/soft/BIP/domain/configuration/logging.properties -server -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml -Dvm.bisas.db.ssl=false -- -default-jvm /soft/BIP/runtime/jvm64/bin/java
seeasown 30426 30410 0 10:22 ? 00:00:13 /soft/BIP/runtime/jvm64/bin/java -D[Host Controller] -Dorg.jboss.boot.log.file=/soft/BIP/log/BIP_VLEDI01P//host-controller.log -Dlogging.configuration=file:/soft/BIP/domain/configuration/logging.properties -server -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.domain.default.config=domain.xml -Djboss.host.default.config=host.xml -Dvm.bisas.db.ssl=false -jar /soft/BIP/jboss-modules.jar -mp /soft/BIP/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.host-controller -mp /soft/BIP/modules --pc-address localhost --pc-port 53430 -default-jvm /soft/BIP/runtime/jvm64/bin/java -Djboss.home.dir=/soft/BIP
seeasown 30494 30410 0 10:22 ? 00:01:12 /soft/BIP/runtime/jvm64/bin/java -D[Server:BIP_VLEDI01P] -Xms1G -Xmx2G -Xss1M -server -server -d64 -XX:+UseG1GC -XX:MaxMetaspaceSize=1G -XX:+HeapDumpOnOutOfMemoryError -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider -Xverify:none -Dsun.java2d.noddraw=true -Djco.cpic_maxconv=204 -Doracle.jdbc.J2EE13Compliant=true -Djboss.modules.safe-jdk=true -Dcom.seeburger.conf.user=BISAS -Dcom.seeburger.conf.xml.fileprovider=Database -Dbisas.home=/soft/BIP -Dbisas.data=/soft/BIP/data -Dbisas.conf=/soft/BIP/conf -Dbisas.temp=/soft/BIP/temp -Dbisas.log=/soft/BIP/log -Dbisas.software=/soft/BIP/software -Dcom.seeburger.conf.xml.basedir=/soft/BIP/conf/SeeConfig -Ddir.pl.mappings=/soft/BIP/conf/pl -Dcom.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0 -Dcom.seeburger.licensing.path=/soft/BIP/conf/license -Djava.io.tmpdir=/soft/BIP/temp -Djava.endorsed.dirs=/soft/BIP/lib/charsets -Djava.rmi.server.hostname=vledi01p.ftdmz.local -Dmail.mime.multipart.bmparse=false -Dmail.mime.cachemultipart=false -Dorg.eclipse.emf.ecore.EPackage.Registry.INSTANCE=org.eclipse.emf.ecore.impl.EPackageRegistryImpl -Dusehornetqstore=true -Dsecureedge.local.logger=seelogger -Duseinmemoryprocessing=true -Djgroups.bind_addr=vledi01p.ftdmz.local -Djgroups.use.jdk_logger=true -Dmaverick.workaroundEpollBug=true -Dsun.net.useExclusiveBind=false -Dcom.arjuna.ats.jta.xaAssumeRecoveryComplete=true -Dhibernate.dialect_resolvers=com.seeburger.hibernate.extensions.DialectResolver -Dinstance.id=BIP_VLEDI01P -Dinstance.group=Portal -Dinstance.roles=B2BPortal -Dsystem.id=vledi01p.ftdmz.local -Djboss.socket.binding.port-offset=0 -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.host.default.config=host.xml -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djboss.home.dir=/soft/BIP -Dorg.jboss.resolver.warning=true -Dorg.apache.tomcat.util.http.Parameters.MAX_COUNT=10000 -Djboss.domain.default.config=domain.xml -Dsun.rmi.dgc.client.gcInterval=3600000 -Djava.awt.headless=true -D[Host Controller]=true -Dvm.bisas.db.ssl=false -Djboss.server.log.dir=/soft/BIP/domain/servers/BIP_VLEDI01P/log -Djboss.server.temp.dir=/soft/BIP/domain/servers/BIP_VLEDI01P/tmp -Djboss.server.data.dir=/soft/BIP/domain/servers/BIP_VLEDI01P/data -Dorg.jboss.boot.log.file=/soft/BIP/domain/servers/BIP_VLEDI01P/log/boot.log -Dlogging.configuration=file:/soft/BIP/domain/configuration/logging.properties -jar /soft/BIP/jboss-modules.jar -mp /soft/BIP/modules -jaxpmodule javax.xml.jaxp-provider org.jboss.as.server

Il faut repérer le nom du process en rouge : /soft/BIP/runtime/jvm64/bin/java .
et le nom du user (facultatif) en bleu : seeasown

proc.num[,seeasown,,/soft/BIS/runtime/jvm64/bin/java] (Attention au virgules)

Type d’info : Numéric (float)

On positionne ensuite un trigger :

{VLEDI01P – DCC:proc.num[,seeasown,,/soft/BIP/runtime/jvm64/bin/java].last(0)}=0

Zabbix User Parameter

http://www.zabbix.com/documentation/1.8/manual/config/user_parameters

To create a new probe.

Create script in /exploit/script folder.

cd /exploit/script

Example : toto.sh (with passing a parameter eg)

give execution rights
chmod 755 toto.sh

Add UserParameter at the end of the file zabbix_agentd.conf

vi /etc/zabbix/zabbix_agentd.conf

Example: UserParameter=system.toto[*],/exploit/script/toto.sh $1

K99zabbix-agent

S99zabbix-agent

To use the new probe in Zabbix.

Create an Item
Description: itemname
Type: Zabbix agent
key: system.toto[param] (param = the value passed as a parameter)
Type of information: text
Interval: 30 (or other)

UserParameter up

vi /etc/zabbix/zabbix_agentd.conf

UserParameter=zab_mem_free,/exploit/scripts/zab_mem_free.sh
UserParameter=zab_proc_mem[*],/exploit/scripts/zab_proc_mem.sh $1
UserParameter=zab_proc_cpu[*],/exploit/scripts/zab_proc_cpu.sh $1

UserParameter=zab_proc[*],/exploit/scripts/zab_proc.sh $1 $2
UserParameter=zab_web_sans[*],/exploit/scripts/zab_web_sans.sh $1
UserParameter=zab_web_avec[*],/exploit/scripts/zab_web_avec.sh $1

Probes on all the Linux server :
zab_mem_free (doesn’t work on Venus)
zab_proc_mem
zab_proc_cpu

Other specifics Probes :

Probe VMONI VPALODEV1
topcpu OK
zab_web_avec OK
zab_web_sans OK

Start Stop Zabbix services

ps auxww |grep -v grep | grep zabbix_agentd

cd /etc/init.d/

Zabbix agent

vi zabbix_agent_start.sh
su -l zabbix -c /usr/sbin/zabbix_agentd start

chmod 755 zabbix_agent_start.sh

vi zabbix_agent_stop.sh
ps -ef | grep zabbix_agentd | grep -v grep | awk ‘{print $2}’ | xargs kill -9

chmod 755 zabbix_agent_stop.sh

Put in /etc/rc3.d and /etc/rc5.d

cd /etc/rc3.d/
cd /etc/rc5.d/

ln -s ../init.d/zabbix_agent_stop.sh K20zabbix-agent
ln -s ../init.d/zabbix_agent_start.sh S20zabbix-agent

Zabbix serveur (sur vmoni.ft.grp)

vi zabbix_server_start.sh
su -l zabbix -c /usr/local/sbin/zabbix_server

chmod 755 zabbix_server_start.sh

vi zabbix_server_stop.sh
ps -ef | grep zabbix_server | grep -v grep | awk ‘{print $2}’ | xargs kill -9

chmod 755 zabbix_server_stop.sh

Put in /etc/rc3.d and /etc/rc5.d

cd /etc/rc3.d/
cd /etc/rc5.d/

ln -s ../init.d/zabbix_server_stop.sh K20zabbix-server
ln -s ../init.d/zabbix_server_start.sh S20zabbix-server

Install zabbix agent Linux UBUNTU 1.8

alias ll=’ls -ltra’

Installer le module de Compatibilité 64 bits vs 32 bits. si besoin. apt-get install ia32-libs

if necessary. apt-get install ia32-libs

cat /etc/passwd

adduser zabbix

passwd zabbixadm

addgroup zabbix admin

Si addgroup: The group `admin’ does not exist. le groupe n’esiste pas faire groupadd admin

su – zabbix

cd /home/zabbix

download agent and server components, unpack:

 

scp zabbix@vlecm04p:zabbix-1.8.tar.gz .
tar zvpxf zabbix-1.8.tar.gz

——–

 

scp zabbix@vlecm04p:zabbix_agents_1.8.linux2_6.i386.tar.gz .
tar zvpxf zabbix_agents_1.8.linux2_6.i386.tar.gz

exit (pour revenir sous le compte root)

Copy agent files and create needed directories:

cd /home/zabbix/zabbix-1.8/
mkdir /etc/zabbix mkdir /var/log/zabbix
chown -R zabbix.zabbix /etc/zabbix/
chown -R zabbix.zabbix /var/log/zabbix
cp /home/zabbix/zabbix-1.8/misc/conf/zabbix_agent* /etc/zabbix/
cp /home/zabbix/zabbix-1.8/bin/zabbix_get /usr/bin/
cp /home/zabbix/zabbix-1.8/bin/zabbix_sender /usr/bin/
cp /home/zabbix/zabbix-1.8/sbin/zabbix_agent /usr/sbin/
cp /home/zabbix/zabbix-1.8/sbin/zabbix_agentd /usr/sbin/

Edit zabbix agent configuration:

vi /etc/zabbix/zabbix_agentd.conf

#make sure server ip is correct: 
LogFile=/exploit/logs/zabbix_agentd.log
LogFileSize=1
DebugLevel=3
Server=vmoni.ft.grp
Hostname=nom_du_client
DisableActive=1
UserParameter=system.topcpu[*],/exploit/scripts/topcpu.sh $1
UserParameter=zab_mem_free,/exploit/scripts/zab_mem_free.sh
UserParameter=zab_proc_mem[*],/exploit/scripts/zab_proc_mem.sh $1
UserParameter=zab_proc_cpu[*],/exploit/scripts/zab_proc_cpu.sh $1

Récupration des scripts :

scp root@vsch1.ft.grp:/exploit/scripts/zab_m*.sh .
scp root@vsch1.ft.grp:/exploit/scripts/zab_p*.sh .
scp root@vsch1.ft.grp:/exploit/scripts/topcpu.sh .

Edit Services file:

cat /etc/services|grep zabbix

vi /etc/services

#Add the following rules at the end: 
zabbix_agent 10050/tcp # Zabbix ports 
zabbix_trap 10051/tcp # Zabbix ports

Copy the init.d scripts:

cp /home/zabbix/zabbix-1.8/misc/init.d/debian/zabbix-agent /etc/init.d

Edit the script files :

vi /etc/init.d/zabbix-agent

#Change:
 #DAEMON=/home/zabbix/bin/${NAME}
 DAEMON=/usr/sbin/${NAME}

Set the correct permissions and set zabbix to start automatically:

chmod 755 /etc/init.d/zabbix-agent
update-rc.d zabbix-agent defaults

Stop / Start the agent:

cd /etc/init.d

vi zabbix_agent_start.sh

su -l zabbix -c /usr/sbin/zabbix_agentd start

vi zabbix_agent_stop.sh

ps -ef | grep zabbix_agentd | grep -v grep | awk ‘{print $2}’ | xargs kill -9

chmod 755 zabbix_agent_st*.sh

cd /etc/rc3.d/
ln -s ../init.d/zabbix_agent_stop.sh K20zabbix_agentd
ln -s ../init.d/zabbix_agent_start.sh S20zabbix_agentd

cd /etc/rc5.d/
ln -s ../init.d/zabbix_agent_stop.sh K20zabbix_agentd
ln -s ../init.d/zabbix_agent_start.sh S20zabbix_agentd

To stop zabbix agent

./K20zabbix_agentd

To start zabbix agent

./S20zabbix_agentd

Check if the Agent is running:
ps -aux | grep -v grep | grep zabbix_agentd
zabbix 10302 0.0 0.0 3368 556 ? SN 14:32 0:00 /usr/sbin/zabbix_agentd
zabbix 10303 0.4 0.0 3368 796 ? SN 14:32 0:00 /usr/sbin/zabbix_agentd
zabbix 10304 0.0 0.0 3368 440 ? SN 14:32 0:00 /usr/sbin/zabbix_agentd
zabbix 10305 0.0 0.0 3368 440 ? SN 14:32 0:00 /usr/sbin/zabbix_agentd
zabbix 10306 0.0 0.0 3368 440 ? SN 14:32 0:00 /usr/sbin/zabbix_agentd
zabbix 10307 0.0 0.0 3404 840 ? SN 14:32 0:00 /usr/sbin/zabbix_agentd
zabbix 10323 0.0 0.0 7528 892 pts/1 R+ 14:32 0:00 grep zabbix_agent

Test the proper operation of the agent

Connect on vmoni with root account

cd /usr/local/bin

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s servername

1.8

Must return the version of the zabbix agent.

Install zabbix agent Linux REDHAT

alias ll=’ls -ltra’

download agent and server components, unpack and compiles :ll /et

[ora102@hyde ERPMIG agent]$ cd /data/zabbix/agent
[ora102@hyde ERPMIG agent]$ gunzip zabbix-1.8.5.tar.gz
[ora102@hyde ERPMIG agent]$ tar -xvf zabbix-1.8.5.tar
[root@hyde ~]# sudo groupadd -g 9000 zabbix
[root@hyde ~]# sudo adduser -m -d /home/zabbix -g 9000 zabbix
[root@hyde ~]# sudo passwd zabbix
zabbix#123

[root@hyde ~]# cd /data/zabbix/agent/zabbix-1.8.5 
[root@hyde zabbix-1.8.5]# ./configure --enable-agent 

config.status: creating src/zabbix_server/proxypoller/Makefile config.status: creating src/zabbix_server/selfmon/Makefile config.status: creating src/zabbix_proxy/Makefile config.status: creating src/zabbix_proxy/heart/Makefile config.status: creating src/zabbix_proxy/housekeeper/Makefile config.status: creating src/zabbix_proxy/proxyconfig/Makefile config.status: creating src/zabbix_proxy/datasender/Makefile config.status: creating upgrades/Makefile config.status: creating man/Makefile config.status: creating include/config.h config.status: executing depfiles commands Configuration: Detected OS: linux-gnu Install path: /usr/local Compilation arch: linux Compiler: gcc Compiler flags: -g -O2 Enable server: no Enable proxy: no Enable agent: yes Agent details: Linker flags: -rdynamic Libraries: -lm -lresolv LDAP support: no IPv6 support: no *********************************************************** * Now run 'make install' * * * * Thank you for using Zabbix! * * * ***********************************************************

[root@hyde zabbix-1.8.5]# make install

Set /etc/services and agent.conf

[root@hyde zabbix-1.8.5]# vim /etc/services

#------------------------------------- # Srvices Zabbix #-------------------------- 

zabbix_agent 10050/tcp 
zabbix_trap 10051/tcp

[root@hyde sbin]# cd /usr/local/sbin
[root@hyde sbin]# ll
total 1084
-rwxr-xr-x 1 root root 492955 mai 23 14:51 zabbix_agent
-rwxr-xr-x 1 root root 594638 mai 23 14:51 zabbix_agentd

[root@hyde etc]# cd /etc
[root@hyde etc]# mkdir zabbix
[root@hyde etc]# cp /data/zabbix/agent/zabbix-1.8.5/misc/conf/zabbix_agent.conf /etc/zabbix/
[root@hyde sbin]# cp /data/zabbix/agent/zabbix-1.8.5/misc/conf/zabbix_agentd.conf /etc/zabbix/

[root@hyde sbin]# vim /etc/zabbix/zabbix_agentd.conf

# 
# Mandatory: no 
# Default: 
# LogRemoteCommands=0 
##### Passive checks related ### 
Option: Server 
# List of comma delimited IP addresses (or hostnames) of Zabbix servers. 
# No spaces allowed. First entry is used for receiving list of and sending active checks. 
# If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally. 
# 
# Mandatory: yes 
# Default: 
# Server= Server=vmoni.ft.grp ### 
Option: Hostname 
# Unique, case sensitive hostname. 
# Required for active checks and must match hostname as configured on the server. 
# System hostname is used if undefined. 
# 
# Default: 
# Hostname=system.hostname Hostname=Hyde 
### Option: ListenPort 
# Agent will listen on this port for connections from the server. # 
# Mandatory: no 
# Range: 1024-32767 
# Default: 
ListenPort=10050 
### Option: ListenIP 
# List of comma delimited IP addresses that the agent should listen on. 
# 
# 
Mandatory: no 
# 
Default: ListenIP=10.1.1.79 
### 
Option: DisablePassive

Copy and Modify zabbix_agentd_ctl file :

[root@hyde redhat]# cd /data/zabbix/agent/zabbix-1.8.5/misc/init.d/redhat/
[root@hyde redhat]# ll
total 24
drwxr-xr-x 2 zabbix zabbix 4096 avr 15 21:20 8.0
-rwxr-xr-x 1 zabbix zabbix 3214 avr 15 21:17 zabbix_agentd_ctl
-rwxr-xr-x 1 zabbix zabbix 3198 avr 15 21:17 zabbix_server_ctl
[root@hyde redhat]# cp zabbix_agentd_ctl /etc/init.d/

[root@hyde redhat]# cd /etc/init.d/
[root@hyde redhat]# vim zabbix_agentd_ctl

# base zabbix dir 
#BASEDIR=/opt/zabbix 
BASEDIR=/usr/local/

STOP / START Agent

[root@hyde init.d]# ./zabbix_agentd_ctl stop
./zabbix_agentd_ctl stop: zabbix_agentd process(es) stopped
[root@hyde init.d]# ps aux |grep zabbix_agent
root 12057 0.0 0.0 52148 768 pts/3 S+ 11:08 0:00 grep zabbix_agent
[root@hyde init.d]# ./zabbix_agentd_ctl start
./zabbix_agentd_ctl start: zabbix_agentd started
[root@hyde init.d]# ps aux |grep zabbix_agent
zabbix 12064 0.0 0.0 7188 788 ? SN 11:08 0:00 /usr/local/sbin/zabbix_agentd
zabbix 12065 0.0 0.0 7188 1000 ? SN 11:08 0:00 /usr/local/sbin/zabbix_agentd
zabbix 12066 0.0 0.0 7188 788 ? SN 11:08 0:00 /usr/local/sbin/zabbix_agentd
zabbix 12067 0.0 0.0 7188 788 ? SN 11:08 0:00 /usr/local/sbin/zabbix_agentd
zabbix 12068 0.0 0.0 7188 788 ? SN 11:08 0:00 /usr/local/sbin/zabbix_agentd
zabbix 12069 0.0 0.0 8232 912 ? SN 11:08 0:00 /usr/local/sbin/zabbix_agentd
root 12089 0.0 0.0 52148 768 pts/3 S+ 11:08 0:00 grep zabbix_agent
[root@hyde init.d]#

cd /etc/rc3.d/
ln -s ../init.d/zabbix_agent_stop.sh K20zabbix-agent
ln -s ../init.d/zabbix_agent_start.sh S20zabbix-agent

Test the proper operation of the agent

Connect on vmoni with root account

cd /usr/local/bin

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s servername

1.8.5

Must return the version of the zabbix agent.


NLE notes, test oracle probes

[zabbix@hyde ERPTEST sbin]$ ./zabbix_agent -c /etc/zabbix/zabbix_agentd.conf -t ora-check-instance-erptest

root@vmoni:/etc/zabbix# zabbix_get -s hyde.faiveleytransport.local -p 10050 -k ora-check-instance-erptest
ZBX_NOTSUPPORTED

root@vmoni:/etc/zabbix# zabbix_get -s 127.0.0.1 -p 10050 -k agent.version
1.8.5
root@vmoni:/etc/zabbix# zabbix_get -s 127.0.0.1 -p 10050 -k testnico
3

3.7 Zabbix Get (UNIX)
Zabbix UNIX Get est un processus qui communique avec l’agent ZABBIX et récupère les informations nécessaires.
Cet utilitaire est généralement utilisé pour résoudre les problèmes des agents ZABBIX.
Zabbix Get peut être démarré en utilisant:
shell> cd bin
shell> ./zabbix_get -s127.0.0.1 -p10050 -k »system.cpu.load[all,avg1] »
Zabbix Get accepte les paramètres en ligne de commandes suivants:
-p –port Spécifie le port de l’agent qui fonctionne sur l’hôte. La valeur par défaut est 10050.
-s -host Spécifie le nom machine ou l’adresse IP de l’hôte.
-I –source-address Spécifie l’adresse IP source
-k -key Spécifie le nom de la métrique (clé) que nous voulons récupérer.
-h –help Affiche cette aide.
-v –version Affiche la version.
Pour afficher cette aide:
shell> zabbix_get -h

Vérification d’un item

root@vmoni:~# zabbix_get -s hyde.faiveleytransport.local -p 10050 -k oracle[latchfree,erptest,gpbatch,hornet]
658

root@vmoni:~# zabbix_get -s hyde.faiveleytransport.local -p 10050 -k oracle[version,erptest,gpbatch,hornet]
Oracle Database 10g Release 10.2.0.4.0 – 64bit Production

Install zabbix agent Linux OEL5

alias ll=’ls -ltra’

Example : Install zabbix agent on vdtb4.

Create zabbix user

cat /etc/passwd

adduser zabbix

pwd : zabbixadm

addgroup zabbix admin

su – zabbix

cd /home/zabbix

Download agent and server components, unpack:

Distrib Zabbix : www.zabbix.com/download2.php

wget http://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/1.8/zabbix-1.8.tar.gz
tar zxvpf zabbix-1.8.tar.gz
wget http://www.zabbix.com/downloads/1.8.5/zabbix_agents_1.8.5.linux2_6.i386.tar.gz
tar zxvf zabbix_agents_1.8.5.linux2_6.i386.tar.gz

Copy agent files and create needed directories:

cd /home/zabbix/zabbix-1.8/
mkdir /etc/zabbix
mkdir /var/log/zabbix
chown -R zabbix.zabbix /etc/zabbix/
chown -R zabbix.zabbix /var/log/zabbix
cp /home/zabbix/zabbix-1.8.5/misc/conf/zabbix_agent* /etc/zabbix/
cp /home/zabbix/bin/zabbix_get /usr/bin/
cp /home/zabbix/bin/zabbix_sender /usr/bin/
cp /home/zabbix/sbin/zabbix_agent /usr/sbin/
cp /home/zabbix/sbin/zabbix_agentd /usr/sbin/

Edit zabbix agent configuration:

vim /etc/zabbix/zabbix_agentd.conf

Change :
DebugLevel=1

Server=vmoni.ft.grp

Hostname=vdtb4.ft.grp (Nom du client)

ListenPort=10050

ListenIP=130.117.62.228 (Ip du client)

Edit Services file:

cat /etc/services | grep 10050
cat /etc/services | grep 10051

vim /etc/services

#Add the following rules at the end:
zabbix_agent 10050/tcp # Zabbix ports
zabbix_trap 10051/tcp # Zabbix ports

Copy the init.d scripts:

cp /home/zabbix/zabbix-1.8/misc/init.d/redhat/zabbix_agentd_ctl /etc/init.d

#Edit the script files:
vim /etc/init.d/zabbix_agentd_ctl

#Change:
#BASEDIR=/opt/zabbix
BASEDIR=/usr

#ZABBIX_AGENTD=$BASEDIR/bin/zabbix_agentd
ZABBIX_AGENTD=$BASEDIR/sbin/zabbix_agentd

Set the correct rights and set zabbix to start automatically:

ll /etc/init.d/zabbix_agentd_ctl
chmod 755 /etc/init.d/zabbix_agentd_ctl
update-rc.d zabbix_agentd_ctl defaults

#Start the agent:
./zabbix_agentd_ctl start

#Check if the Agent is running:
ps aux | grep -v grep | grep zabbix_agentd

zabbix 3479 0.0 0.0 2748 536 ? SN 10:21 0:00 /usr/sbin/zabbix_agentd
zabbix 3480 0.0 0.0 2748 764 ? SN 10:21 0:00 /usr/sbin/zabbix_agentd
zabbix 3481 0.0 0.0 2748 420 ? SN 10:21 0:00 /usr/sbin/zabbix_agentd
zabbix 3482 0.0 0.0 2748 420 ? SN 10:21 0:00 /usr/sbin/zabbix_agentd
zabbix 3483 0.0 0.0 2772 768 ? SN 10:21 0:00 /usr/sbin/zabbix_agentd
zabbix 3484 0.0 0.0 2780 772 ? SN 10:21 0:00 /usr/sbin/zabbix_agentd

Test the proper operation of the agent.

Connect on vmoni with root account.

cd /usr/local/bin

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s servername

1.8.5

Must return the version of the zabbix agent.