This nagios plugin helps project maintainers hosted on Gitlab, Github, etc... to keep track of their staled Merge Request / Pull Requests.
Important: Currently only gitlab
provider is supported
$ CGO_ENABLED=0 go build -ldflags "-s -w -extldflags '-static'" -o check_git_project_merge_requests .
$ check_git_project_merge_requests -h
Checks that a github / gitlab / gitea project has opened merge requests
Usage:
nagios-plugin-git-hosted-project-merge-requests [flags]
Flags:
--api-token string API Token used for authentication
-c, --config string config file (default is /etc/nagios-plugin-git-hosted-project-merge-requests/config.yaml)
--critical-last-update duration critical if last-update was that delay ago (default 24h0m0s)
-d, --debug Enable debug
-p, --git-provider string git provider can be one of gitlab
-h, --help help for nagios-plugin-git-hosted-project-merge-requests
-H, --host string host to check (API endpoint)
-P, --project string project to check for opened MergeRequests
--target-branch string Only consider merge requests with this target-branch (default "master")
-t, --timeout duration Global timeout (default 30s)
--warning-last-update duration warning if last-update was that delay ago (default 6h0m0s)
$ API_TOKEN=XXXXXXX check_git_project_merge_requests -H https://gitlab.com -P "riton/blog" -p gitlab
OK: No opened merge requests | 'total_duration'=0.551541323s;;;; 'opened_merge_requests'=0;;;;
$ API_TOKEN=XXXXXXX check_git_project_merge_requests -H https://gitlab.com -P "riton/blog" -p gitlab
OK: No merge requests too old | 'total_duration'=0.566831438s;;;; 'opened_merge_requests'=1;;;; 'oldest_merge_request'=1319.409961917s;;;;
$ API_TOKEN=XXXXXXX check_git_project_merge_requests -H https://gitlab.com -P "riton/blog" -p gitlab --warning-last-update 5m --critical-last-update 8m
CRITICAL: Merge request 42 last activity was 21m43.664245342s ago | 'total_duration'=0.795784589s;;;; 'opened_merge_requests'=1;;;; 'oldest_merge_request'=1303.664245342s;;;;
This project is using viper so any configuration flag can be passed using environment variables or using a configuration file.
A sample configuration file can be found in the example/config.yaml directory.
- Add support for Github provider
- Add support for nagios range definition