generated from EGI-Federation/repository-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be8f81f
commit 4cc9c2b
Showing
7 changed files
with
233 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Maintainers | ||
----------- | ||
Andrea Manzi <[email protected]> | ||
Baptiste Grenier <[email protected]> | ||
|
||
Contributors | ||
------------ | ||
Andrea Manzi <[email protected]> | ||
Baptiste Grenier <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
NAME= $(shell grep Name: *.spec | sed 's/^[^:]*:[^a-zA-Z]*//') | ||
VERSION= $(shell grep Version: *.spec | sed 's/^[^:]*:[^0-9]*//') | ||
RELEASE= $(shell grep Release: *.spec | cut -d"%" -f1 | sed 's/^[^:]*:[^0-9]*//') | ||
build=$(shell pwd)/build | ||
DATE=$(shell date "+%a, %d %b %Y %T %z") | ||
dist=$(shell rpm --eval '%dist' | sed 's/%dist/.el5/') | ||
|
||
default: | ||
@echo "Nothing to do" | ||
|
||
install: | ||
@echo installing ... | ||
|
||
dist: | ||
@mkdir -p $(build)/$(NAME)-$(VERSION)/ | ||
rsync -HaS --exclude ".git" --exclude "$(build)" * $(build)/$(NAME)-$(VERSION)/ | ||
cd $(build); tar --gzip -cf $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)/; cd - | ||
|
||
sources: dist | ||
cp $(build)/$(NAME)-$(VERSION).tar.gz . | ||
|
||
prepare: dist | ||
@mkdir -p $(build)/RPMS/noarch | ||
@mkdir -p $(build)/SRPMS/ | ||
@mkdir -p $(build)/SPECS/ | ||
@mkdir -p $(build)/SOURCES/ | ||
@mkdir -p $(build)/BUILD/ | ||
cp $(build)/$(NAME)-$(VERSION).tar.gz $(build)/SOURCES | ||
cp $(NAME).spec $(build)/SPECS | ||
|
||
srpm: prepare | ||
rpmbuild -bs --define="dist ${dist}" --define='_topdir ${build}' $(build)/SPECS/$(NAME).spec | ||
|
||
rpm: srpm | ||
rpmbuild --rebuild --define='_topdir ${build}' --define="dist ${dist}" $(build)/SRPMS/$(NAME)-$(VERSION)-$(RELEASE)${dist}.src.rpm | ||
|
||
clean: | ||
rm -f *~ $(NAME)-$(VERSION).tar.gz | ||
rm -rf $(build) | ||
|
||
.PHONY: dist srpm rpm sources clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,90 @@ | ||
# Template for EGI repositories | ||
# Nagios-plugins-storage | ||
|
||
This is Nagios probe to monitor Storage endpoints executing simple file operations via Xrootd or Webdav protocols | ||
|
||
It's based on the gfal2 library for the storage operations and the python-nap library for execution and reporting. | ||
|
||
A X509 valid proxy certificate is needed to execute the probe (configured via X509_USER_PROXY variable). | ||
|
||
The probes runs the following passive checks in sequence: | ||
|
||
* LsDir: list the folder | ||
* Put: put a test file | ||
* Ls: list the file previously copied | ||
* Get: copy the file locally and check if content matches | ||
* Del: delete the file | ||
|
||
the active check VOAll just combines the passive checks outcomes. | ||
|
||
## Usage | ||
|
||
```shell | ||
usage: storage_probe.py [-h] [--version] [-H HOSTNAME] [-w WARNING] [-c CRITICAL] | ||
[-d] [--print-all] [-p PREFIX] [-s SUFFIX] [-t TIMEOUT] | ||
[-C COMMAND] [--dry-run] [-o OUTPUT] [-E ENDPOINT] [-X X509] | ||
[-to TOKEN] [--se-timeout SE_TIMEOUT] [-S] [-RO] | ||
|
||
NAGIOS Storage probe | ||
|
||
options: | ||
-h, --help show this help message and exit | ||
--version show program's version number and exit | ||
-H HOSTNAME, --hostname HOSTNAME | ||
Host name, IP Address, or unix socket (must be an absolute path) | ||
-w WARNING, --warning WARNING | ||
Offset to result in warning status | ||
-c CRITICAL, --critical CRITICAL | ||
Offset to result in critical status | ||
-d, --debug Specify debugging mode | ||
--print-all Print output from all metrics to stdout | ||
-p PREFIX, --prefix PREFIX | ||
Text to prepend to ever metric name | ||
-s SUFFIX, --suffix SUFFIX | ||
Text to append to every metric name | ||
-t TIMEOUT, --timeout TIMEOUT | ||
Global timeout for plugin execution | ||
-C COMMAND, --command COMMAND | ||
Nagios command pipe for submitting passive results | ||
--dry-run Dry run, will not execute commands and submit passive results | ||
-o OUTPUT, --output OUTPUT | ||
Plugin output format; valid options are nagios, check_mk | ||
or passive (via command pipe); defaults to nagios) | ||
-E ENDPOINT, --endpoint ENDPOINT | ||
base URL to test | ||
-X X509, --x509 X509 location of x509 certificate proxy file | ||
-to TOKEN, --token TOKEN | ||
BEARER TOKEN to be used | ||
--se-timeout SE_TIMEOUT | ||
storage operations timeout | ||
-S, --skip-ls-dir skip LSDir tests, needed for Object storage backend | ||
-RO, --read-only enable read-only tests | ||
``` | ||
## Example | ||
```shell | ||
./plugins/storage_probe.py -E root://eospps.cern.ch:1094/eos/pps/opstest/ftstests/test_andrea -H eospps.cern.ch --dry-run -X /tmp/x509up_u0 -d | ||
Dec 01 18:40:53 DEBUG core[1559]: Call sequence: [(<function metricLsDir at 0x7f761240bc80>, 'LsDir', True), (<function metricPut at 0x7f761240bd08>, 'Put', True), (<function metricLs at 0x7f761240bd90>, 'Ls', True), (<function metricGet at 0x7f761240be18>, 'Get', True), (<function metricDel at 0x7f761240bea0>, 'Del', True), (<function metricAlll at 0x7f761240bf28>, 'All', False)] | ||
Dec 01 18:40:53 DEBUG core[1559]: Function call: metricLsDir | ||
Dec 01 18:40:53 DEBUG core[1559]: b'OK - Storage Path[root://eospps.cern.ch:1094/eos/pps/opstest/ftstests/test_andrea] Directory successfully listed\\n' | ||
Dec 01 18:40:53 DEBUG core[1559]: [1638384053] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;LsDir;0;OK - Storage Path[root://eospps.cern.ch:1094/eos/pps/opstest/ftstests/test_andrea] Directory successfully listed\n | ||
Dec 01 18:40:53 DEBUG core[1559]: Function call: metricPut | ||
Dec 01 18:40:54 DEBUG core[1559]: b'OK - File was copied to the Storage endpoint: Transfer time: 0:00:00.815718\\n' | ||
Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Put;0;OK - File was copied to the Storage endpoint: Transfer time: 0:00:00.815718\n | ||
Dec 01 18:40:54 DEBUG core[1559]: Function call: metricLs | ||
Dec 01 18:40:54 DEBUG core[1559]: b'OK - File successfully listed\\n' | ||
Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Ls;0;OK - File successfully listed\n | ||
Dec 01 18:40:54 DEBUG core[1559]: Function call: metricGet | ||
Dec 01 18:40:54 DEBUG core[1559]: b'OK - File was copied from Storage endpoint.: Diff successful. Transfer time: 0:00:00.127798\\n' | ||
Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Get;0;OK - File was copied from the Storage endpoint.: Diff successful. Transfer time: 0:00:00.127798\n | ||
Dec 01 18:40:54 DEBUG core[1559]: Function call: metricDel | ||
Dec 01 18:40:54 DEBUG core[1559]: b'OK - File was deleted from the Storage endpoint.\\n' | ||
Dec 01 18:40:54 DEBUG core[1559]: [1638384054] PROCESS_SERVICE_CHECK_RESULT;eospps.cern.ch;Del;0;OK - File was deleted from the Storage endpoint.\n | ||
Dec 01 18:40:54 DEBUG core[1559]: Function call: metricAlll | ||
OK - All fine | ||
mkdir build | ||
cd build | ||
make rpm -f ../Makefile | ||
``` | ||
This repository is to be used as a repository template for creating a new EGI | ||
repository, and is aiming at being a clean basis promoting currently accepted | ||
good practices. | ||
|
||
It includes: | ||
|
||
- License information | ||
- Copyright and author information | ||
- Code of conduct and contribution guidelines | ||
- Templates for PR and issues | ||
- Code owners file for automatic assignment of PR reviewers | ||
- [GitHub actions](https://github.com/features/actions) workflows for linting | ||
and checking links | ||
|
||
Content is based on: | ||
|
||
- [Contributor Covenant](http://contributor-covenant.org) | ||
- [Semantic Versioning](https://semver.org/) | ||
- [Chef Cookbook Contributing Guide](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD) | ||
|
||
## Asking for creation of a repository | ||
|
||
It can be done by contacting the | ||
[administrators](https://github.com/orgs/EGI-Federation/teams/admins). | ||
|
||
The following information should be provided: | ||
|
||
- repository name (lower case, usually not required to mention EGI in the name) | ||
- repository description (oneliner is enough) | ||
- optionally additional users that should be able to manage PR and issues | ||
- optional additional requirements (like disabling Pull Requests for the initial | ||
repository population) | ||
|
||
If required a private repository can be created but public ones are the default, | ||
but feel free to ask. | ||
|
||
Once all info will have been agreed the repository will be created. | ||
|
||
## GitHub repository management rules | ||
|
||
All changes should go through Pull Requests. | ||
|
||
### Merge management | ||
|
||
- Only squash should be enforced in the repository settings. | ||
- Update commit message for the squashed commits as needed. | ||
|
||
### Protection on main branch | ||
|
||
To be configured on the repository settings. | ||
|
||
- Require pull request reviews before merging | ||
- Dismiss stale pull request approvals when new commits are pushed | ||
- Require review from Code Owners | ||
- Require status checks to pass before merging | ||
- GitHub actions if available | ||
- Other checks as available and relevant | ||
- Require branches to be up to date before merging | ||
- Include administrators | ||
|
||
## Access | ||
|
||
All access should be managed via | ||
[GitHub teams](https://github.com/orgs/EGI-Federation/teams). | ||
|
||
- EGI-Federation/admins: administration right | ||
- Others participants depending on the requirement: maintain, triage or write or | ||
rights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: nagios-plugins-storage | ||
channels: | ||
- conda-forge | ||
dependencies: | ||
- python-gfal2=1.12.2 | ||
- pip | ||
- pip: | ||
- https://github.com/marian-babik/python-nap/archive/refs/tags/v0.1.21.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Package needs to stay arch specific (due to nagios plugins location), but | ||
# there's nothing to extract debuginfo from | ||
%global debug_package %{nil} | ||
|
||
%define nagios_plugins_dir %{_libdir}/nagios/plugins | ||
|
||
Name: nagios-plugins-s3 | ||
Version: 0.0.1 | ||
Release: 1%{?dist} | ||
Summary: Nagios probes to be run remotely against s3 endpoints | ||
License: MIT | ||
Group: Applications/Internet | ||
URL: https://github.com/EGI-Federation/nagios-plugins-storage | ||
# The source of this package was pulled from upstream's vcs. Use the | ||
# following commands to generate the tarball: | ||
Source0: %{name}-%{version}.tar.gz | ||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) | ||
BuildArch: noarch | ||
|
||
Requires: nagios%{?_isa} | ||
Requires: python3 | ||
Requires: python3-nap | ||
Requires: python3-botocore | ||
Requires: python3-boto3 | ||
|
||
%description | ||
This package provides the nagios probes for s3 | ||
|
||
%prep | ||
%setup -q -n %{name}-%{version} | ||
|
||
%build | ||
|
||
%install | ||
make install DESTDIR=%{buildroot} | ||
mkdir -p %{buildroot}%{_libdir}/nagios/plugins/s3 | ||
cp --preserve=timestamps plugins/*.py %{buildroot}%{_libdir}/nagios/plugins/s3 | ||
|
||
%clean | ||
rm -rf %{buildroot} | ||
|
||
%files | ||
%defattr(-,root,root,-) | ||
%{nagios_plugins_dir}/s3 | ||
%doc LICENSE README.md | ||
|
||
%changelog | ||
* Wed Jun 26 2024 Andrea Manzi <[email protected]> - 0.0.1-0 | ||
- first version |