Download the PHP package cytopia/check_git without Composer
On this page you can find all versions of the php package cytopia/check_git. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cytopia/check_git
More information about cytopia/check_git
Files in cytopia/check_git
Package check_git
Short Description Nagios plugin to verify a git repository.
License MIT
Homepage https://github.com/cytopia/check_git
Informations about the package check_git
check_git
Nagios plugin to verify a git directory. Checks include git status
(with or without submodules), HEAD is on a branch or tag (any or specified), has diffs against remote (with or without submodules), HEAD (tag, branch or commit) is GPG signed and the signature is valid.
Find more plugins at Awesome Nagios | |
---|---|
Find more plugins at Icinga Exchange | |
Find more plugins at Nagios Exchange |
1. Nagios / Icinga integration
There are two ways how to integrate this with nagios or icinga.
1.1 Direct approach (not recommended)
Use check_git
directly from nagios and test a repository every time a check is triggered. In order for the output to be usaeble by Nagios / Icinga, you will have to use -n <NAME>
, which will amongst others remove the shell colors from the output. Correct exit codes for success
, warning
, error
and unknown
are thrown by default.
Example
1.2 Approach to just parse a logfile (recommended)
This approach reduces the overhead to check a repository every 5min by nagios, and rather check the logfile created by check_git
.
Sometimes a full check (status, gpg, remote check, etc) can take up to a few seconds and u don't want to stress the system every 5min.
For that to work, you simply add check_git
to your crontab and only check your repository every 4 hours for example.
Nagios / Icinga can still check the logfile every 5 minutes.
Crontab
This will update the logfile under /var/log/git/<project-name>.log
every 4 hours and nagios/icinga can however check on it as often as they want via:
The actual check
2. Examples
The following examples show each options separately, you can of course combine most checks.
2.1 Check git status
Without submodules (-s
)
With submodules (-S
)
2.2 Check status of HEAD (branch or tag)
HEAD must be on a branch (any branch -b
)
HEAD must be on branch develop (-B
)
HEAD must be on a tag (any tag -t
)
HEAD must be on tag 0.3 (-T
)
2.3 Check GPG signature of commit/tag
Check if the current commit (or if HEAD is a tag, the current tag) is signed with gpg and valid (-g
).
Check if the current commit (or if HEAD is a tag, the current tag) is signed with gpg, valid and matches one of the specified key ids (-G
).
2.4 Check Diff against remote
Check if you have new code to pull (only makes sense if you are on a branch). Check excluding submodules (-R
)
Check if you have new code to pull (only makes sense if you are on a branch). Check including submodules (-r
)
2.5 Show additional verbose output
Show some verbose output (will also be visible within nagios extended output)