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

Sonde temps de reponse page web

Avec proxy

zab_web_avec.sh

#!/bin/bash
export http_proxy=’gateway.zscaler.net:80′
cd /tmp
d1=`date + »%S.%N »`
wget -q –proxy=on –dns-cache=off http://www.citrix.com
d2=`date + »%S.%N »`
rm /tmp/index.html
echo « scale=2; $d2-$d1 » | bc

Sans proxy

zab_web_sans.sh

#!/bin/bash
cd /tmp
d1=`date + »%S.%N »`
wget -q –proxy=off –dns-cache=off http://www.citrix.com
d2=`date + »%S.%N »`
rm /tmp/index.html
echo « scale=2; $d2-$d1 » | bc

Redémarrage auto des services windows avec Zabbix

Cette procédure permet de redémarrer automatiquement les services windows qui sont « STOPPED » alors qu’ils sont en démarrage automatique, devraient donc être « STARTED ».

1- Sur le serveur cible : Se connecter avec le compte Dcxservice
Copier le fichier C:\Batchs\Start_service_auto.bat (voir en fin d’article) de PSERV dans C:\Batchs
Creer le dossier c:\temp

2- Appliquer le template Tmp_Service_Auto_Restart sur le serveur

3- Facultatif : Modifier (supprimer) les services à exclure sur l’item (serveur cible) .

Liste des serveurs où cette fonctionnalité est implanté.

PSERV
PWEB
VTREND
PDTB1
VWCCO15P
VMEC

ATTENTION :

Le fichier de zabbix_agentd.conf de l’agent Zabbix (sur le serveur cible) doit contenir la ligne :
EnableRemoteCommands=1

———————————————————————————————————————–

C:\Batchs\Start_service_auto.bat

@echo off
cls
:: EF le 16/05/2012
:: MV le 17/01/2017 ajout du check for permissions, windows 2012 r2

setlocal enableDelayedExpansion

:: BatchGotAdmin
:————————————-
REM –> Check for permissions
>nul 2>&1 « %SYSTEMROOT%\system32\cacls.exe » « %SYSTEMROOT%\system32\config\system »

REM –> If error flag set, we do not have admin.
if ‘%errorlevel%’ NEQ ‘0’ (
echo Requesting administrative privileges…
goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
echo Set UAC = CreateObject^(« Shell.Application »^) > « %temp%\getadmin.vbs »
echo UAC.ShellExecute « %~s0 », «  », «  », « runas », 1 >> « %temp%\getadmin.vbs »

« %temp%\getadmin.vbs »
exit /B

:gotAdmin
if exist « %temp%\getadmin.vbs » ( del « %temp%\getadmin.vbs » )
pushd « %CD% »
CD /D « %~dp0″
:————————————–

set fic_log=c:\temp\service_to_restart.log
set fic_temp=c:\temp\service_to_restart.txt
set fic_start=c:\temp\service_to_start.txt
set fic_bat=c:\temp\service_to_start.bat
del /F %fic_log%
del /F %fic_temp%
del /F %fic_start%
del /F %fic_bat%

TIMEOUT /T 3 /NOBREAK 1>nul

TYPE NUL > %fic_start%
TYPE NUL > %fic_bat%

wmic service where (state= »stopped » and startmode= »Auto ») get name>%fic_temp%

for /f « delims= skip=1 » %%i in (‘type %fic_temp%’) do (
set w_serv=%%i
echo net start %%i>> %fic_start%
)

TIMEOUT /T 3 /NOBREAK 1>nul

for /f « tokens=1,2,3* delims=  » %%i in (%fic_start%) do (
set wstr=%%i %%j
set wser=%%k %%l
for /l %%a in (11,1,100) do if « !wser:~-1! »== »  » set wser=!wser:~0,-1!
set w_ligne=!wstr! »!wser! »
echo !w_ligne!
echo !w_ligne!>>%fic_bat%
echo TIMEOUT /T 5 /NOBREAK >> %fic_bat%
)

%fic_bat% > %fic_log%

Install Zabbix Agent sur Windows

Récupérer l’agent sur PFILE :

\\PFILE\Distrib\Zabbix Agent\zabbix_agents_1.8.10.win

copier le dossier dans :

L:\Soft\

Le fichier L:\Soft\zabbix_agents_1.8.10.win\zabbix_agentd.conf contient

Server=vmoni.ft.grp
EnableRemoteCommands=1
DebugLevel=2
LogFile= L:\Soft\zabbix_agents_1.8.10.win\logs\zabbix_agentd.log

———————————————————————————————————————-

Désinstallationde l’agent attention vérifier les chemins dans les propriétés du service

Fenêtre de cmd:

64 bits

C:\Users\adm_1504>L:\Soft\zabbix_agents_1.8.10.win\win64\zabbix_agentd.exe --uninstall
 zabbix_agentd.exe [4344]: Service "Zabbix Agent" uninstalled successfully
 zabbix_agentd.exe [4344]: Event source "Zabbix Agent" uninstalled successfully.

32 bits

C:\Users\adm_1504>L:\Soft\zabbix_agents_1.8.10.win\win32 \zabbix_agentd.exe --uninstall
 zabbix_agentd.exe [4344]: Service "Zabbix Agent" uninstalled successfully
 zabbix_agentd.exe [4344]: Event source "Zabbix Agent" uninstalled successfully.

———————————————————————————————————————

Installation de l’agent

Fenêtre de cmd en Administrateur:

change user /install

64 bits

C:\Users\adm_1504>L:\Soft\zabbix_agents_1.8.10.win\win64\zabbix_agentd.exe --config L:\Soft\zabbix_agents_1.8.10.win\zabbix_agentd.conf --install
 zabbix_agentd.exe [4704]: service [Zabbix Agent] installed successfully
 zabbix_agentd.exe [4704]: event source [Zabbix Agent] installed successfully

32 bits

C:\Users\adm_1504>L:\Soft\zabbix_agents_1.8.10.win\win32\zabbix_agentd.exe --config L:\Soft\zabbix_agents_1.8.10.win\zabbix_agentd.conf --install
zabbix_agentd.exe [3676]: service [Zabbix Agent] installed successfully
 zabbix_agentd.exe [3676]: event source [Zabbix Agent] installed successfully

Démarrer le service en tant que DcXservice@ft.grp : Dc…..#7….

change user /execute

———————————————————————————————————-

Tester si l’agent fonctionne

Se connecter root sur vmoni il doit retourner la version exemple 1.8.10 pour le serveur vadmin.ft.grp

root@vmoni:~# zabbix_get -p 10050 -k agent.version -s vadmin.fr.grp
1.8.10

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.

Remonté des Erreurs SQL dans VTOM

Attention pour remonter les erreurs SQL dans VTOM, il faut ajouter la ligne :

WHENEVER SQLERROR EXIT SQL.SQLCODE

après la connexion sqlplus, stocker le resultat dans une variable err_sql=$? puis sortir avec la valeur de la variable.

exemple :

sqlplus ${1}/${2} < $0.txt
WHENEVER SQLERROR EXIT SQL.SQLCODE
EXEC csv.generate(‘DIR_EXPORT_CSV’, ‘${3}.csv’,’SELECT * FROM ${4}’);
exit
EOSQL

err_sql=$?

…..

exit $err_sql

 

sqlplus $1/$2 <

WHENEVER SQLERROR EXIT SQL.SQLCODE
exec Pack_Batch_Quotidien.p_quotidien($3);
exit
EOSQL

sqlplus $1/$2 <WHENEVER SQLERROR EXIT SQL.SQLCODE
exec Pack_Batch_Quotidien.p_quotidien($3);
exit
EOSQL

si l’instruction sqlplus est suivie d’une autre instruction, envoi de mail par exemple, il faut mémoriser la valeur de l’erreur sql et la transmettre en fin de script.

sqlplus $1/$2 <WHENEVER SQLERROR EXIT SQL.SQLCODE
exec Pack_Batch_Quotidien.p_quotidien($3);
exit
EOSQL

err_sql=$?

${ABM_BIN}/tmail -c ${ABM_BIN}/tmail.ini -cc $4 -sub « Traitement $TOM_JOB Terminé » -msg  »
Bonjour,
Le traitement est terminé, vérifier les fichiers logs joints.*
Bonne journée. »

exit $err_sql

Redémarrage sur serveur dormant TAC

Redémarrage sur TAC

Arrêter les moteurs et le vtserveur sur TIC (si ce n’est déjà fait).

Sur Tac

Nettoyer la base (normalement c’est déjà fait)

cd $TOM_BASES

rm -r -f *

Décompresser le dernier fichier.tar

tar xvfz ../backup/Save_20100914_134741.tar.gz

(Durée : 15 mn env)

Lancer le service (admins) VTOM (compte vtom) sur TAC

Démarrer le servuer vtom

Démarrer les moteurs

et vérifier avec la commande vtping.

Modifier les machines des jobs qui utilisent tval (modification ou affichage de ressource).

PROD_ERP/APP_ERP_NUIT/erp_dispo_NON

PROD_ERP/APP_ERP_NUIT/erp_dispo_OUI

PROD_ERP/APP_ERP_NUIT/erp_dispo_NON_

PROD_ERP/Mensuel_ERP/Octal_dispo_OUI

PROD_ERP/APP_ERP_DISPO/ERP_indispo_fait

PROD_ERP/APP_ERP_DISPO/ERP_dispo_fait

Pour revenir à la situation normale (sur TIC) exécuter la même procédure sur TIC.

Principales commandes VTOM

vtping
Donne l’état d’une machine

tlist -v env
Liste les moteurs avec PID

vtmachine
Liste toutes les machines

vtmachine | grep Linux | awk ‘{print $2}’

vtmachine | grep Windows | awk ‘{print $2}’
Liste les machine Windows

vtmachine /info king
Donne le détail d’une machine

vtmachine /info jerry | grep Path
Donne les path

| DB Path | E:\Soft\VTOM5\BASES |
| vtom.ini Path | C:\WINDOWS\vtom.ini
tlist -v -f PROD_ERP/APP_ERP_JOUR job
Liste les jobs d’un environnement et d’une appli
vtaddapp /Nom=PROD_ERP/APP_ERP_JOUR /Mode=AV
Modifie une appli, met l’appli PROD_ERP/APP_ERP_JOUR => A Venir
vtaddjob /Nom=PROD_ERP/APP_ERP_JOUR/dispo_ABELARD /status=AV
Modifie un jobi, met le jobi PROD_ERP/APP_ERP_JOUR/dispo_ABELARD => A Venir
vtbackup -p /opt/vtom/vtbackup_base
Sauvegarde la base (avec dump) dans la directorie /opt/vtom/vtbackup_base

Pas de remonté TSEND vers le serveur (Linux)

Les jobs s’exécutent mais la fin de job n’est pas remontée par le TSEND vers le serveur.

Le job reste bleu.

Modifier le fichier hosts sur le client

/etc/hosts
ou
C:\Windows\System32\drivers\etc\hosts

10.20.112.34 vsch1.ft.grp vsch1 
10.20.112.40 vsch2.ft.grp vsch2
10.20.112.60 smtp-relay.ft.grp vsmtp 

10.129.20.22 wctsrv0011.wabtec.com wctsrv0011 # vtom server 1 new
10.129.20.23 wctsrv0012.wabtec.com wctsrv0012 # vtom server 2 new