Skip to content

sergiotocalini/jenkix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jenkix

Jenkins Monitoring

This script is part of a monitoring solution that allows to monitor several services and applications.

For more information about this monitoring solution please check out this post on my site.

Dependencies

Packages

  • curl
  • jq
  • ksh
  • sudo

Debian/Ubuntu

~# sudo apt install curl jq ksh sudo
~#

Red Hat

~# sudo yum install curl jq ksh sudo
~#

Deploy

Sudoers

The deploy script is not intended to advise which approach you should implemented nor deploy the sudoers configuration but the user that will run the script needs to have sudo privileges for some checks.

There are two options to setting up sudoers for the user:

  1. Provided sudo all
~# cat /etc/sudoers.d/user_zabbix
Defaults:zabbix !syslog
Defaults:zabbix !requiretty

zabbix	ALL=(ALL)  NOPASSWD:ALL
~#
  1. Limited acccess to run command with sudo
~# cat /etc/sudoers.d/user_zabbix
Defaults:zabbix !syslog
Defaults:zabbix !requiretty

zabbix ALL=(ALL) NOPASSWD: /usr/bin/lsof *
zabbix ALL=(ALL) NOPASSWD: /bin/ps *
~#

Parameters

The username and the password can be empty if jenkins has the read only option enable. Default variables:

NAME VALUE
JENKINS_URL http://localhost:8080
JENKINS_USER
JENKINS_PASS
CACHE_DIR /etc/zabbix/scripts/agentd/jenkix/tmp
CACHE_TTL 5
SCRIPT_DIR /etc/zabbix/scripts/agentd/jenkix
ZABBIX_INC /etc/zabbix/zabbix_agentd.d

Note: this variables has to be saved in the config file (jenkix.conf) in the same directory than the script.

Demo Deploy

~# git clone https://github.com/sergiotocalini/jenkix.git
~# ./jenkix/deploy_zabbix.sh -H
Usage:  [Options]

Options:
  -F            Force configuration overwrite.
  -H            Displays this help message.
  -P            Installation prefix (SCRIPT_DIR).
  -Z            Zabbix agent include files directory (ZABBIX_INC).
  -c            Configuration key CACHE_DIR.
  -j            Configuration key JENKINS_URL.
  -p            Configuration key JENKINS_PASS.
  -t            Configuration key CACHE_TTL.
  -u            Configuration key JENKINS_USER.

Please send any bug reports to sergiotocalini@gmail.com
~# sudo ./jenkix/deploy_zabbix.sh -j "${JENKINS_URL}" \
   				  -u "${JENKINS_USER}" \
				  -p "${JENKINS_PASS}"
~# sudo systemctl restart zabbix-agent

Note: the installation has to be executed on the zabbix agent host and you have to import the template on the zabbix web. The default installation directory is /etc/zabbix/scripts/agentd/jenkix