GRP04 – 2017S01 - Integrando GLPI com Nagios

Опубликовано: 04 Август 2026
на канале: BlackMesa
1,586
15

Integrando Nagios Com glpi

Autor Matheus dos Santos Souza


Instalar o lamp
sudo apt-get update

sudo apt-get -y install apache2 mysql-server php5-mysql php5 libapache2-mod-php5
php5-mcrypt


depois instlalar o php5-gd

apt-get install php5-gd

mysql -u root -p

download glpi

wget -c "https://github.com/glpi-project/glpi/..."

tar -xzvf glpi-0.90.1.tar.gz


chown -R www-data:www-data /var/www/html/glpi

chmod 777 -R /var/www/html/glpi/files

chmod 777 -R /var/www/html/glpi/config

acessar browser

criar diretorios



Baixar os arquivos php

https://www.dropbox.com/s/3qfrawa2aq9...

https://www.dropbox.com/s/lcp46mq8bhp...

editamos os arquivos php com os seguintes parâmetros colocando usuário glpi e senha glpi e em xml host colocamos
127.0.0.1/glpi/

faça isso nos dois arquivos hos e service

$user = "glpi"; //GLPI User Account - REQUIRED
$password = "glpi"; //GLPI User Password - REQUIRED
$xmlhost = "127.0.0.1/glpi/"; //GLPI Server HOSTNAME/IP - REQUIRED
$xmlurl = "plugins/webservices/xmlrpc.php"; //Path to xmlrpc on GLPI server - REQUIRED


vamos criar os seguintes diretorios e colocarmos os arquivos php nele

/usr/share/nagios3/plugins/eventhandlers/

mudamos as permissões com chmod 777 manage-host-tickets manage-service-tickets


agora iremos criar os comandos no commands.cfg

adicionamos os seguintes linhas


define command{
command_name manage-host-tickets
command_line php /usr/share/nagios3/plugins/eventhandlers/manage-host-tickets.php event="$HOSTSTATE$" state="$HOSTSTATETYPE$" eventhost="$HOSTNAME$" hostattempts="$HOSTATTEMPT$" maxhostattempts="$MAXHOSTATTEMPTS$" hostproblemid="$HOSTPROBLEMID$" lasthostproblemid="$LASTHOSTPROBLEMID$"
}


define command{
command_name manage-service-tickets
command_line php /usr/share/nagios3/plugins/eventhandlers/manage-service-tickets.php event="$SERVICESTATE$" state="$SERVICESTATETYPE$" hoststate="$HOSTSTATE$" eventhost="$HOSTNAME$" service="$SERVICEDISPLAYNAME$" serviceattempts="$SERVICEATTEMPT$" maxserviceattempts="$MAXSERVICEATTEMPTS$" servicestate="$SERVICESTATE$" lastservicestate="$LASTSERVICESTATE$" servicecheckcommand="$SERVICECHECKCOMMAND$" serviceoutput="$SERVICEOUTPUT$" longserviceoutput="$LONGSERVICEOUTPUT$"
}



modificaremos arquivos de host e services adcionando os seguintes parâmetros

no arquivo do seu host no template

event_handler_enabled 1
event_handler manage-host-tickets
flap_detection_enabled 1
process_perf_data 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1
nos arquivo de service no template

event_handler_enabled 1
event_handler manage-service-tickets
flap_detection_enabled 1
process_perf_data 1
process_perf_data 1
retain_status_information 1
retain_nonstatus_information 1


feito todas as configurações reiniciamos o nagios

sudo service nagios restart

feito isso o proximo passo é baixar o plugin do glpi o webservices

damos os seguintes comandos

wget "https://forge.glpi-project.org/attach..."

Extraimos o plugin

tar -xzvf glpi-webservices-1.6.0.tar.gz


movendo ele para a pasta do glpi


mv webservices /var/www/glpi/plugins/


Feito isso iremos baixar a dependencia php para que que o plugin funcione


apt-get install php5-xmlrpc


abrindo a pagina web


Configurar - Plugins;

Instalar;

Habilitar.


Agora so testar um serviço ou host