diff --git a/atlas/check_ami b/atlas/check_ami index 21403167..ebba2056 100755 --- a/atlas/check_ami +++ b/atlas/check_ami @@ -1,4 +1,17 @@ #!/usr/bin/env python +# Copyright European Organization for Nuclear Research (CERN) since 2012 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Copyright European Organization for Nuclear Research (CERN) 2013 diff --git a/atlas/check_disabled_rses b/atlas/check_disabled_rses index ce0f86bf..3f08d692 100755 --- a/atlas/check_disabled_rses +++ b/atlas/check_disabled_rses @@ -1,13 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. +# you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 # -# Authors: -# - Cedric Serfon, , 2015-2016 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import json import requests diff --git a/atlas/check_injecting_rules b/atlas/check_injecting_rules index 4d70e3b1..7b9b7b71 100755 --- a/atlas/check_injecting_rules +++ b/atlas/check_injecting_rules @@ -1,15 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Martin Barisits, , 2016 -# - Thomas Beermann, , 2019 -# - Donata Mielaikaite, , 2020 -# - Eric Vaandering, , 2020 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of injecting rules. @@ -19,14 +21,14 @@ import sys import traceback from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla import models from rucio.db.sqla.constants import RuleState from rucio.db.sqla.session import get_session from rucio.db.sqla.util import get_count -from utils import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/atlas/check_lost_files b/atlas/check_lost_files index 8e7dd06e..99f6834b 100755 --- a/atlas/check_lost_files +++ b/atlas/check_lost_files @@ -1,13 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2015 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Tomas Javurek, Cedric Serfon, 2015 -# - Alexander Bogdanchikov, 2019-2020 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os import sys diff --git a/atlas/check_map_voms_roles b/atlas/check_map_voms_roles index b4b4afe8..c63c9708 100755 --- a/atlas/check_map_voms_roles +++ b/atlas/check_map_voms_roles @@ -1,4 +1,17 @@ #!/usr/bin/env python +# Copyright European Organization for Nuclear Research (CERN) since 2012 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Copyright European Organization for Nuclear Research (CERN) @@ -17,12 +30,12 @@ import os import sys +from VOMSAdmin.VOMSCommands import VOMSAdminProxy + from rucio.client import Client from rucio.common.config import config_get from rucio.common.exception import Duplicate -from VOMSAdmin.VOMSCommands import VOMSAdminProxy - UNKNOWN = 3 CRITICAL = 2 WARNING = 1 diff --git a/atlas/check_quotas b/atlas/check_quotas index 0cac5ab2..019566a4 100755 --- a/atlas/check_quotas +++ b/atlas/check_quotas @@ -1,6 +1,17 @@ #!/usr/bin/env python3 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # -# Copyright European Organization for Nuclear Research (CERN) +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # Licensed under the Apache License, Version 2.0 (the "License"); # You may not use this file except in compliance with the License. @@ -18,20 +29,18 @@ # Set quotas for users on their country's localgroupdisk # Set quotas for all users on scratchdisk -from __future__ import print_function import json import sys import requests -from rucio.api.rse import get_rse, parse_rse_expression, get_rse_usage, list_rse_attributes from rucio.api.account import list_accounts from rucio.api.account_limit import set_local_account_limit from rucio.api.config import get -from rucio.db.sqla.session import get_session +from rucio.api.rse import get_rse, get_rse_usage, list_rse_attributes, parse_rse_expression from rucio.common.config import config_get -from rucio.common.exception import RucioException, RSENotFound, AccountNotFound - +from rucio.common.exception import AccountNotFound, RSENotFound, RucioException +from rucio.db.sqla.session import get_session UNKNOWN = 3 CRITICAL = 2 diff --git a/atlas/check_rse_attributes b/atlas/check_rse_attributes index b34094f3..674e1279 100755 --- a/atlas/check_rse_attributes +++ b/atlas/check_rse_attributes @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012-2019 CERN for the benefit of the ATLAS collaboration. +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,32 +12,19 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Vincent Garonne , 2013-2014 -# - David Cameron , 2014-2015,2020 -# - Tomas Kouba , 2014 -# - Cedric Serfon , 2016-2019 -# - Dimitrios Christidis , 2019 -# - Mario Lassnig , 2019 -# -# PY3K COMPATIBLE -from __future__ import print_function import json import sys import traceback - import requests -from rucio.db.sqla.session import get_session -from rucio.common.exception import RucioException, RSENotFound from rucio.common.config import config_get -from rucio.core.rse import add_rse_attribute, get_rses_with_attribute, del_rse_attribute, get_rse_usage, get_rse +from rucio.common.exception import RSENotFound, RucioException +from rucio.core.rse import add_rse_attribute, del_rse_attribute, get_rse, get_rse_usage, get_rses_with_attribute from rucio.core.rse_expression_parser import parse_expression - +from rucio.db.sqla.session import get_session UNKNOWN = 3 CRITICAL = 2 diff --git a/atlas/check_rules b/atlas/check_rules index e4478704..599b191e 100755 --- a/atlas/check_rules +++ b/atlas/check_rules @@ -1,12 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Wen Guan, , 2014 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Probe to check rules. @@ -16,10 +21,10 @@ import datetime import sys import time -from rucio.db.sqla.session import get_session - from utils import probe_metrics +from rucio.db.sqla.session import get_session + # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/atlas/check_set_rse_space_limits b/atlas/check_set_rse_space_limits index 68aa3ca4..1f49dace 100755 --- a/atlas/check_set_rse_space_limits +++ b/atlas/check_set_rse_space_limits @@ -1,4 +1,17 @@ #!/usr/bin/env python +# Copyright European Organization for Nuclear Research (CERN) since 2012 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Copyright European Organization for Nuclear Research (CERN) 2014 diff --git a/atlas/check_site_status b/atlas/check_site_status index d87b8490..0e4b8d98 100755 --- a/atlas/check_site_status +++ b/atlas/check_site_status @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012-2020 CERN for the benefit of the ATLAS collaboration. +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,11 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Cedric Serfon , 2014-2022 -# - Mario Lassnig , 2020 -# import json import os @@ -24,11 +19,10 @@ import sys import requests +from rucio.api.rse import get_rse_protocols, list_rses, update_rse from rucio.common.config import config_get -from rucio.api.rse import list_rses, update_rse, get_rse_protocols from rucio.transfertool.fts3 import FTS3Transfertool - UNKNOWN = 3 CRITICAL = 2 WARNING = 1 diff --git a/atlas/check_storage_space b/atlas/check_storage_space index 08c30fa8..9d4ca9a2 100755 --- a/atlas/check_storage_space +++ b/atlas/check_storage_space @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2012-2020 CERN for the benefit of the ATLAS collaboration. +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,14 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Wen Guan , 2014 -# - Sylvain Blunier , 2016 -# - Tomas Javurek , 2016 -# - Cedric Serfon , 2015-2017 -# - Dimitrios Christidis , 2019 -# - Mario Lassnig , 2020 import json import os @@ -27,10 +19,10 @@ import sys import gfal2 +from rucio.api.rse import get_rse, list_rse_attributes, list_rses, set_rse_usage from rucio.common.config import config_get from rucio.common.exception import RSEProtocolNotSupported from rucio.rse import rsemanager as rsemgr -from rucio.api.rse import list_rses, list_rse_attributes, get_rse, set_rse_usage OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/atlas/check_stresstest_dids_requests_replicas_daily b/atlas/check_stresstest_dids_requests_replicas_daily index 451eb9fd..b0e94c7e 100755 --- a/atlas/check_stresstest_dids_requests_replicas_daily +++ b/atlas/check_stresstest_dids_requests_replicas_daily @@ -1,12 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Wen Guan, , 2014 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Probe to check dids, requests and replicas by daily. @@ -16,10 +21,10 @@ import datetime import sys import time -from rucio.db.sqla.session import get_session - from utils import probe_metrics +from rucio.db.sqla.session import get_session + # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/atlas/check_stresstest_dids_requests_replicas_hourly b/atlas/check_stresstest_dids_requests_replicas_hourly index a6eab66b..9ff20309 100755 --- a/atlas/check_stresstest_dids_requests_replicas_hourly +++ b/atlas/check_stresstest_dids_requests_replicas_hourly @@ -1,12 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Wen Guan, , 2014 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Probe to check dids, requests and replicas by hourly. @@ -16,10 +21,10 @@ import datetime import sys import time -from rucio.db.sqla.session import get_session - from utils import probe_metrics +from rucio.db.sqla.session import get_session + # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/atlas/check_sync_rses_with_cric b/atlas/check_sync_rses_with_cric index 95f43322..d4983680 100755 --- a/atlas/check_sync_rses_with_cric +++ b/atlas/check_sync_rses_with_cric @@ -1,17 +1,17 @@ #!/usr/bin/env python3 -# Copyright European Organization for Nuclear Research (CERN) +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. +# you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 # -# Authors: -# - Vincent Garonne, , 2013-2014 -# - Mario Lassnig, , 2014-2022 -# - Cedric Serfon, , 2014-2018 -# - David Cameron, , 2015 -# - Dimitrios Christidis, , 2021 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import json import os.path @@ -23,12 +23,11 @@ import requests from rucio.api.account import list_accounts from rucio.api.account_limit import set_local_account_limit -from rucio.api.rse import get_rse_protocols, add_protocol, add_rse, update_protocols +from rucio.api.rse import add_protocol, add_rse, get_rse_protocols, update_protocols from rucio.common.config import config_get -from rucio.common.exception import Duplicate, RSEProtocolPriorityError, RSEProtocolNotSupported, RSENotFound +from rucio.common.exception import Duplicate, RSENotFound, RSEProtocolNotSupported, RSEProtocolPriorityError from rucio.db.sqla.constants import RSEType - UNKNOWN = 3 CRITICAL = 2 WARNING = 1 diff --git a/atlas/check_voms b/atlas/check_voms index 59218de1..8da623e7 100755 --- a/atlas/check_voms +++ b/atlas/check_voms @@ -1,34 +1,30 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. +# you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 # -# Authors: -# - Vincent Garonne, , 2012-2013 -# - Cedric Serfon, , 2014-2018 -# - David Cameron, , 2015 -# - Dimitrios Christidis, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 # -# PY3K COMPATIBLE +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. -from __future__ import print_function import os import sys import time import ldap # pylint: disable=import-error +from VOMSAdmin.VOMSCommands import VOMSAdminProxy # pylint: disable=import-error -from rucio.db.sqla.session import get_session from rucio.client import Client from rucio.common.config import config_get from rucio.common.exception import Duplicate - -from VOMSAdmin.VOMSCommands import VOMSAdminProxy # pylint: disable=import-error - +from rucio.db.sqla.session import get_session UNKNOWN = 3 CRITICAL = 2 diff --git a/atlas/check_voms_admin b/atlas/check_voms_admin index c3723c14..1497592c 100755 --- a/atlas/check_voms_admin +++ b/atlas/check_voms_admin @@ -1,20 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. +# you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# http://www.apache.org/licenses/LICENSE-2.0 # -# Authors: -# - David Cameron, , 2015 -# - Cedric Serfon, , 2016 +# http://www.apache.org/licenses/LICENSE-2.0 # -# Get country groups from VOMS, get DNs with production role, -# map to Rucio account and set country-: admin -# Get all DNs in country and set country-: user -# Get all DNs in phys/perf group with production role and set group-: admin -# Get all names in cloud support e-group and set cloud-: admin +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os import re diff --git a/atlas/check_xcache b/atlas/check_xcache index f5ec5288..9eb2d98b 100755 --- a/atlas/check_xcache +++ b/atlas/check_xcache @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012-2019 CERN for the benefit of the ATLAS collaboration. +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,14 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Mario Lassnig, , 2012-2019 -# - Dimitrios Christidis, , 2020 -# -# PY3K COMPATIBLE -from __future__ import print_function import json import sys @@ -34,14 +27,12 @@ except ImportError: # Python 3 from urllib.parse import urlparse -from rucio.db.sqla.session import get_session from rucio.common.config import config_get from rucio.common.exception import RucioException - -from rucio.core.config import set as core_set from rucio.core.config import items as core_items from rucio.core.config import remove_option as core_del - +from rucio.core.config import set as core_set +from rucio.db.sqla.session import get_session UNKNOWN = 3 CRITICAL = 2 diff --git a/cms/check_expected_total_number_of_files_per_rse b/cms/check_expected_total_number_of_files_per_rse index 7d60cac7..7f202658 100644 --- a/cms/check_expected_total_number_of_files_per_rse +++ b/cms/check_expected_total_number_of_files_per_rse @@ -1,13 +1,17 @@ #!/usr/bin/env python3 -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Donata Mielaikaite, , 2020 -# - Eric Vaandering, , 2022 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the number of expected files per rse. diff --git a/cms/check_expiring_rules_per_rse b/cms/check_expiring_rules_per_rse index a215d409..5a916825 100644 --- a/cms/check_expiring_rules_per_rse +++ b/cms/check_expiring_rules_per_rse @@ -1,13 +1,17 @@ #!/usr/bin/env python3 -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Donata Mielaikaite, , 2020 -# - Eric Vaandering, , 2022 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the number of expiring rules. diff --git a/cms/check_rse_files_rules b/cms/check_rse_files_rules index 4aafb308..f17d2d2d 100755 --- a/cms/check_rse_files_rules +++ b/cms/check_rse_files_rules @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2012-2020 CERN +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,10 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Donata Mielaikaite, , 2020 -# - Fernando Garzon, , 2020 """ Probe to check the number of expected files per rse. @@ -24,14 +20,13 @@ Probe to check the number of expected files per rse. import sys import traceback -from rucio.db.sqla import models -from rucio.db.sqla.constants import RequestType -from rucio.db.sqla.constants import RuleState -from rucio.db.sqla.session import get_session from sqlalchemy import func - from utils import common +from rucio.db.sqla import models +from rucio.db.sqla.constants import RequestType, RuleState +from rucio.db.sqla.session import get_session + PrometheusPusher = common.PrometheusPusher # Exit statuses diff --git a/cms/check_rule_counts b/cms/check_rule_counts index 69053aea..2f47eb97 100755 --- a/cms/check_rule_counts +++ b/cms/check_rule_counts @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2012-2024 CERN +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,12 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Donata Mielaikaite, , 2020 -# - Eric Vaandering, , 2021 -# - Fernando Garzon, ogarzonm@cern.ch, 2022 -# - Hasan Ozturk, haozturk AT cern DOT ch, 2024 """ @@ -30,14 +24,14 @@ import sys import traceback from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from sqlalchemy import func +from utils import common + from rucio.common.config import config_get from rucio.db.sqla import models -from rucio.db.sqla.constants import (RuleState) +from rucio.db.sqla.constants import RuleState from rucio.db.sqla.session import get_session from rucio.db.sqla.util import get_count -from sqlalchemy import func - -from utils import common PrometheusPusher = common.PrometheusPusher probe_metrics = common.probe_metrics @@ -71,7 +65,7 @@ if __name__ == '__main__': for state, num in result: manager.gauge(name='rule_count_per_state.{state}', documentation='Number of rules in a given state').labels(state=str(state.name)).set(num) - + # Rule count per state and activity results = (session.query(models.ReplicationRule.state, models.ReplicationRule.activity, func.count(models.ReplicationRule.state)) @@ -84,8 +78,8 @@ if __name__ == '__main__': manager.gauge(name='rule_count_per_state_and_activity.{state}.{activity}', documentation='Number of rules in a given state and activity').labels(state=result[0], activity=result[1]).set(result[2]) - - # Lock count per state (STUCK and REPLICATING) and activity + + # Lock count per state (STUCK and REPLICATING) and activity results = (session.query(models.ReplicationRule.activity, func.sum(models.ReplicationRule.locks_stuck_cnt), func.sum(models.ReplicationRule.locks_replicating_cnt)) @@ -109,7 +103,7 @@ if __name__ == '__main__': .filter(models.ReplicationRule.state == stateDB) .filter(models.ReplicationRule.created_at <= age)) result = query.scalar() or 0 - + manager.gauge(name='rule_count_per_state_and_date.{state}.{older_than_days}', documentation='Rule count per state and date').labels(state=stateName, older_than_days= nDays ).set(result) diff --git a/cms/check_rules_states_by_account b/cms/check_rules_states_by_account index 5b141249..d756e7f8 100644 --- a/cms/check_rules_states_by_account +++ b/cms/check_rules_states_by_account @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright 2012-2020 CERN +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,9 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Fernando Garzon, , 2021 """ Probe that counts the number of stuck, replicating rules and waiting for approval rules, clasiffied by account. diff --git a/cms/check_unlocked_replicas_per_rse b/cms/check_unlocked_replicas_per_rse index 54d65235..7b5d85f7 100644 --- a/cms/check_unlocked_replicas_per_rse +++ b/cms/check_unlocked_replicas_per_rse @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2012-2020 CERN +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,13 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 -# - Fernando Garzon, , 2020 -# - Donata Mielaikaite, , 2020 -# - Eric Vaandering, , 2021 """ diff --git a/cms/check_used_space b/cms/check_used_space index 87fd0779..d5d51209 100644 --- a/cms/check_used_space +++ b/cms/check_used_space @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# Copyright 2012-2020 CERN +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,12 +12,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -# -# Authors: -# - Donata Mielaikaite, , 2020 -# - Fernando Garzon, , 2020 -# - Eric Vaandering, , 2021 -# - Panos Paparrigopoulos, , 2024 """ Probe to check used space. @@ -54,7 +48,7 @@ if __name__ == '__main__': prom_labels = {'rse': rse['rse'], 'country': country, 'rse_type': rse_type, 'source': ''} label_names = ['rse', 'country', 'rse_type', 'source'] for usage in sources: - + # Calculate free rucio space of RSE and push it if usage['source'] == 'rucio': prom_labels['source'] = 'rucio_free_space' @@ -65,11 +59,11 @@ if __name__ == '__main__': .labels(**prom_labels) .set(rucio_free_space)) print(rse['rse'], country, rse_type, 'rucio_free_space', rucio_free_space) - + # Calculate total free space of RSE (static-rucio) and push it if usage['source'] == 'static': static_used = usage['used'] - + if rucio_used and static_used: prom_labels['source'] = 'free_space' free_space = int(static_used) - int(rucio_used) @@ -80,16 +74,16 @@ if __name__ == '__main__': print(rse['rse'], country, rse_type, 'free_space', free_space) source = usage['source'] - prom_labels['source'] = source + prom_labels['source'] = source (manager.gauge(name='{source}', documentation='Space used at an RSE from various sources', labelnames=label_names) .labels(**prom_labels) .set(usage['used'])) print(rse['rse'], country, rse_type, source, usage['used']) - + # export and push `MinFreeSpace` value from RSE limits if limits.get('MinFreeSpace'): - prom_labels['source'] = 'min_free_space' + prom_labels['source'] = 'min_free_space' (manager.gauge(name='min_free_space', documentation='Space used at an RSE from various sources', labelnames=label_names) .labels(**prom_labels) @@ -97,4 +91,4 @@ if __name__ == '__main__': print(rse['rse'], country, rse_type, 'min_free_space', limits.get('MinFreeSpace')) except: print(traceback.format_exc()) - sys.exit(UNKNOWN) \ No newline at end of file + sys.exit(UNKNOWN) diff --git a/cms/utils.py b/cms/utils.py index e1f01547..3a70e9d0 100644 --- a/cms/utils.py +++ b/cms/utils.py @@ -1,12 +1,17 @@ #!/usr/bin/env python3 -# Copyright European Organization for Nuclear Research (CERN) 2020 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Eric Vaandering, , 2022 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os diff --git a/common/check_deletable_replicas b/common/check_deletable_replicas index 30dd1931..b2507bb6 100755 --- a/common/check_deletable_replicas +++ b/common/check_deletable_replicas @@ -1,19 +1,22 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Mario Lassnig, , 2013-2014 -# - Cedric Serfon, , 2018 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Probe to check the queues of messages to submit by Hermes to the broker ''' -from __future__ import print_function import sys from rucio.db.sqla.session import get_session diff --git a/common/check_expired_dids b/common/check_expired_dids index dd8229bc..c3664d56 100755 --- a/common/check_expired_dids +++ b/common/check_expired_dids @@ -1,32 +1,34 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 -# - Eric Vaandering , 2020-2021 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of expired dids. """ -from __future__ import print_function import sys import traceback from datetime import datetime from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla import models from rucio.db.sqla.session import get_session from rucio.db.sqla.util import get_count -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_expired_locked_rules b/common/check_expired_locked_rules index 55e139a1..7ea21d16 100755 --- a/common/check_expired_locked_rules +++ b/common/check_expired_locked_rules @@ -1,12 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Cedric Serfon, , 2015 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Probe to check the locked expired rules or datasets with locked rules diff --git a/common/check_expired_rules b/common/check_expired_rules index 6d423c55..4171983a 100755 --- a/common/check_expired_rules +++ b/common/check_expired_rules @@ -1,14 +1,17 @@ #!/usr/bin/env python3 -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 -# - Eric Vaandering, , 2020-2023 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of expired rules. @@ -17,10 +20,10 @@ Probe to check the backlog of expired rules. import sys import traceback -from rucio.db.sqla.session import BASE, get_session - from utils.common import PrometheusPusher +from rucio.db.sqla.session import BASE, get_session + # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_free_space b/common/check_free_space index 91e6dd35..b9d1a207 100755 --- a/common/check_free_space +++ b/common/check_free_space @@ -1,12 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2015 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. ''' Probe to check the min free space. @@ -15,7 +20,7 @@ Probe to check the min free space. import sys import traceback -from rucio.core.rse import list_rses, get_rse_limits, set_rse_usage +from rucio.core.rse import get_rse_limits, list_rses, set_rse_usage # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_fts_backlog b/common/check_fts_backlog index 5c85cd97..b1556ed5 100755 --- a/common/check_fts_backlog +++ b/common/check_fts_backlog @@ -1,4 +1,17 @@ #!/usr/bin/env python +# Copyright European Organization for Nuclear Research (CERN) since 2012 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Copyright European Organization for Nuclear Research (CERN) 2013 @@ -12,25 +25,25 @@ - Eric Vaandering, , 2019-2021 - Thomas Beermann, , 2019 """ -from __future__ import print_function import os import sys import requests import urllib3 + try: from urlparse import urlparse except ImportError: from urllib.parse import urlparse from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get, config_get_bool from rucio.core.distance import update_distances from rucio.db.sqla.session import BASE, get_session -from utils.common import probe_metrics - OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 urllib3.disable_warnings() @@ -143,7 +156,7 @@ if __name__ == "__main__": + summary['staging'] + summary['started']) - g.labels(**{'hostname': hostname}).set((summary['submitted'] + summary['active'] + summary['staging'] + summary['started'])) + g.labels(**{'hostname': hostname}).set(summary['submitted'] + summary['active'] + summary['staging'] + summary['started']) retvalue = OK break except Exception as error: diff --git a/common/check_messages_to_submit b/common/check_messages_to_submit index 4400531e..41fb9c0e 100755 --- a/common/check_messages_to_submit +++ b/common/check_messages_to_submit @@ -1,27 +1,30 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Mario Lassnig, , 2013-2014 -# - Thomas Beermann, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the queues of messages to submit by Hermes to the broker """ -from __future__ import print_function import sys from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla.session import BASE, get_session -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_new_dids b/common/check_new_dids index 6f290cba..0862626e 100755 --- a/common/check_new_dids +++ b/common/check_new_dids @@ -1,31 +1,33 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 -# - Eric Vaandering , 2020 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of new dids. """ -from __future__ import print_function import sys import traceback from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla import models from rucio.db.sqla.session import get_session from rucio.db.sqla.util import get_count -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_oracle b/common/check_oracle index 7b23e6ec..41bc1230 100755 --- a/common/check_oracle +++ b/common/check_oracle @@ -1,29 +1,31 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Cedric Serfon, , 2014 -# - Eric Vaandering, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check Oracle. """ -from __future__ import print_function import re import sys import cx_Oracle -from rucio.common.config import config_get - from utils.common import probe_metrics +from rucio.common.config import config_get + # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_requests_to_rses b/common/check_requests_to_rses index d1324df0..e9b99c01 100755 --- a/common/check_requests_to_rses +++ b/common/check_requests_to_rses @@ -1,13 +1,17 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Wen Guan, , 2014 -# - Eric Vaandering, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check requests. @@ -17,10 +21,10 @@ import datetime import sys import time -from rucio.db.sqla.session import BASE, get_session - from utils.common import probe_metrics +from rucio.db.sqla.session import BASE, get_session + # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_stuck_rules b/common/check_stuck_rules index 84633ba6..e3d8b957 100755 --- a/common/check_stuck_rules +++ b/common/check_stuck_rules @@ -1,29 +1,31 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Martin Barisits, , 2014 -# - Eric Vaandering, , 2019-2021 -# - Thomas Beermann, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of stuck rules. """ -from __future__ import print_function import sys import traceback from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla.session import BASE, get_session -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_transfer_queues_status b/common/check_transfer_queues_status index 15f94b9b..f4bb9922 100755 --- a/common/check_transfer_queues_status +++ b/common/check_transfer_queues_status @@ -1,29 +1,30 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Mario Lassnig, , 2013-2021 -# - Cedric Serfon, , 2014 -# - Wen Guan, , 2015 -# - Thomas Beermann, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the queues of the transfer service """ -from __future__ import print_function import sys from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla.session import BASE, get_session -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_unevaluated_dids b/common/check_unevaluated_dids index d3428854..50939ab0 100755 --- a/common/check_unevaluated_dids +++ b/common/check_unevaluated_dids @@ -1,27 +1,30 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of dids waiting for rule evaluation. """ -from __future__ import print_function import sys from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla.session import BASE, get_session -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_unlocked_replicas b/common/check_unlocked_replicas index 80276a91..efa29c42 100755 --- a/common/check_unlocked_replicas +++ b/common/check_unlocked_replicas @@ -1,27 +1,30 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of unlocked replicas. """ -from __future__ import print_function import sys from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla.session import BASE, get_session -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/check_updated_dids b/common/check_updated_dids index 756aad8a..46a93019 100755 --- a/common/check_updated_dids +++ b/common/check_updated_dids @@ -1,31 +1,33 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2013 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Vincent Garonne, , 2013 -# - Thomas Beermann, , 2019 -# - Eric Vaandering , 2020-2021 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ Probe to check the backlog of updated dids. """ -from __future__ import print_function import sys import traceback from prometheus_client import CollectorRegistry, Gauge, push_to_gateway +from utils.common import probe_metrics + from rucio.common.config import config_get from rucio.db.sqla import models from rucio.db.sqla.session import get_session from rucio.db.sqla.util import get_count -from utils.common import probe_metrics - # Exit statuses OK, WARNING, CRITICAL, UNKNOWN = 0, 1, 2, 3 diff --git a/common/utils/__init__.py b/common/utils/__init__.py index e69de29b..23757cf2 100644 --- a/common/utils/__init__.py +++ b/common/utils/__init__.py @@ -0,0 +1,13 @@ +# Copyright European Organization for Nuclear Research (CERN) since 2012 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/common/utils/common.py b/common/utils/common.py index 11c69e86..41c15a4c 100644 --- a/common/utils/common.py +++ b/common/utils/common.py @@ -1,15 +1,20 @@ #!/usr/bin/env python -# Copyright European Organization for Nuclear Research (CERN) 2020 +# Copyright European Organization for Nuclear Research (CERN) since 2012 # # Licensed under the Apache License, Version 2.0 (the "License"); -# You may not use this file except in compliance with the License. -# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at # -# Authors: -# - Eric Vaandering, , 2022 +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import json -from typing import Tuple, Dict, List, Optional +from typing import Dict, List, Optional, Tuple from rucio.common.config import config_get from rucio.core.monitor import MetricManager