Git Product home page Git Product logo

jenkix's Introduction

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 [email protected]
~# 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

jenkix's People

Contributors

sergiotocalini avatar tleguern avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jenkix's Issues

Items Server: Jobs - Status gets error

Hi.

[Jenkins] Server: Jobs - Status (Inactive)
jenkix[server,jobs,inactive,30]

and

[Jenkins] Server: Jobs - Status (Active)
jenkix[server,jobs,active,30]

get

Value "/var/lib/zabbix/jenkix.sh: line 130: null null null null / 1000 : syntax error in expression (error token is "null null null / 1000 ")
/var/lib/zabbix/jenkix.sh: line 131: (1553699300-)/86400 : syntax error: operand expected (error token is ")/86400 ")
0" of type "string" is not suitable for value type "Numeric (unsigned)"

README.md is empty

Hi!
README.md is empty! Maybe is possible write it down, about template installation?

About Jenkins http port 8081 and prefix /jenkins!

Hi!
I use Jenkins with
HTTP_PORT=8081
PREFIX=/jenkins

I install Jenkix but in my Zabbix I see error
Value "lsof: unacceptable port specification in: -i :8081jenkins
lsof 4.89

OS= Debian 9.4

How is possible resolved it?

Error for this Zabbix Items [Jenkins] Service: Uptime [Jenkins] Service: Listening

Ubuntu 16.4
Error for this Zabbix Items:
[Jenkins] Service: Uptime
Value "sudo: no tty present and no askpass program specified
0" of type "string" is not suitable for value type "Numeric (unsigned)

[Jenkins] Service: Listening
Value "sudo: no tty present and no askpass program specified
0" of type "string" is not suitable for value type "Numeric (unsigned)"

In /etc/sudoers I add:
zabbix ALL=(ALL) NOPASSWD: ALL

README.md

Hi!
Can you please write a manual about using and testing this template? It would be grate for all new users.
As for me I get error "Unsupported item key" in Zabbix and "0" when manual running the script.
So maybe manual will help me to find my mistake.

Received value […/jenkix.sh: line 201: / 1000 : arithmetic syntax error

Hello!
Sometimes I get an error from the Status item- jenkix[job, active, some-job-in-jenkins, 30]

#1215:20200401:044711.639 item "jenkins-server:jenkix[job, active, some-job-in-jenkins, 30]" became not supported: Received value [/etc/zabbix/scripts/jenkix.sh: line 201:   / 1000 : arithmetic syntax error/etc/zabbix/scripts/jenkix.sh: line 202:  (1585716431-)/86400 : arithmetic syntax error] is not suitable for value type [Numeric (unsigned)] and data type [Decimal]

I don’t quite understand where it comes from, I don’t see any errors in the terminal

/etc/zabbix/scripts/jenkix.sh -s "job" -a p="active" -a p="some-job-in-jenkins" -a p="30" -a p=""
1

sudo required for jenkix.sh

Please add notice into documentation, that jenkix.sh script requires sudo for zabbix user or replace sudo logic with nonprivileged commands.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.