Skip to content

Commit

Permalink
Merge pull request #86 from ARGOeu/devel
Browse files Browse the repository at this point in the history
Prepare to Release 0.4.1-1
  • Loading branch information
kkoumantaros authored Jan 3, 2024
2 parents 046302a + 7667997 commit f59e672
Show file tree
Hide file tree
Showing 8 changed files with 1,850 additions and 498 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ attributes = /etc/argo-scg/attributes/attributes-tenant2.conf
metricprofiles = PROFILE1, PROFILE2
publish = true
publisher_queue = /var/spool/argo-nagios-ams-publisher/metrics
subscriptions_use_ids = true
subscription = servicetype
```

* `poem_url` - POEM URL for the given tenant,
Expand All @@ -50,7 +50,10 @@ subscriptions_use_ids = true
* `metricprofile` - comma separated list of metric profiles for the given tenant,
* `publish` - flag that marks if the metrics results should be sent to publisher,
* `publisher_queue` - publisher queue; this entry can be left out if `publish` is set to `False`,
* `subscriptions_use_ids ` - flag that marks that subscriptions should be represented as hostnames with ids; normally they are represented by simple hostname. Note that this only refers to subscriptions - entities are represented the same as they are represented in the topology.
* `subscription` - type of subscription to use. There are three possible values:
* `hostname` - hostname is used as a subscription (this is a default value),
* `servicetype` - service types are used as subscription,
* `hostname_with_id` - hostname with id is used as subscription.

## Tools

Expand Down Expand Up @@ -354,6 +357,10 @@ That way endpoints with overrides will use their values, and those that do not,

In case of extensions, special values from the topology (e.g. `info_hostdn`), overridden attributes and/or parameters, the checks are configured so that they can make use of all the labels created in entities' definitions.

If an attribute that is extension has a value of `0` or `1`, attribute's value is considered to be a flag: the value than marks that the flag should be used in probe execution. If it is not defined, the flag is simply not used.

Any extension ending in `_URL`, if not defined in the topology, would fall back to value defined in `info_URL`, except for two attributes used for webdav/xrootd endpoints: `ARGO_WEBDAV_OPS_URL` and `ARGO_XROOTD_OPS_URL`, which **must** be defined in the topology.

### Events

In Sensu, event is the context containing information about the entity running the check and the corresponding check result. Sensu scheduler runs checks on certain entities based on their subscriptions. Events are automatically processed by Sensu using handlers, filters and pipelines.
Expand Down
6 changes: 5 additions & 1 deletion argo-scg.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Summary: ARGO Sensu configuration manager.
Name: argo-scg
Version: 0.4.0
Version: 0.4.1
Release: 1%{?dist}
Source0: %{name}-%{version}.tar.gz
License: ASL 2.0
Expand Down Expand Up @@ -48,6 +48,10 @@ rm -rf $RPM_BUILD_ROOT


%changelog
* Wed Jan 3 2024 Katarina Zailac <[email protected]> - 0.4.1-1%{?dist}
- ARGO-4449 Add multiple subscription options
- ARGO-4450 Do not use URL for webdav/xrootd checks
- ARGO-4448 Treat certain attribute values as flags
* Thu Dec 7 2023 Katarina Zailac <[email protected]> - 0.4.0-1%{?dist}
- ARGO-4442 Add quotation marks to URLs that contain ampersand
- ARGO-4436 Use info_bdii_* tags as extensions
Expand Down
2 changes: 1 addition & 1 deletion config/scg.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ metricprofiles = ARGO_MON_TENANT1
topology = /etc/argo-scg/topology_tenant1.json
secrets = /etc/sensu/secrets2
publish = false
subscriptions_use_ids = true
subscription = hostname_with_id

[tenant2]
poem_url = https://tenant2.poem.devel.argo.grnet.gr
Expand Down
4 changes: 2 additions & 2 deletions exec/scg-reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def main():
local_topology = config.get_topology()
secrets = config.get_secrets()
publish_bool = config.publish()
subscriptions_use_ids = config.get_use_ids()
subscriptions = config.get_subscriptions()

tenants = config.get_tenants()

Expand Down Expand Up @@ -99,7 +99,7 @@ def main():
secrets_file=secrets[namespace],
default_ports=poem.get_default_ports(),
tenant=tenant,
subscriptions_use_ids=subscriptions_use_ids[namespace]
subscription=subscriptions[namespace]
)

sensu.add_daily_filter(namespace=namespace)
Expand Down
18 changes: 12 additions & 6 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,21 @@ def get_publisher_queue(self):

return queue

def get_use_ids(self):
use_ids = dict()
def get_subscriptions(self):
subscriptions = dict()
for tenant in self.tenants:
try:
value = self.conf.getboolean(tenant, "subscriptions_use_ids")
value = self.conf.get(tenant, "subscription")

if value not in ["hostname", "hostname_with_id", "servicetype"]:
raise ConfigException(
f"Unacceptable value '{value}' for option: "
f"'subscription' in section: '{tenant}'"
)

except configparser.NoOptionError:
value = False
value = "hostname"

use_ids.update({tenant: value})
subscriptions.update({tenant: value})

return use_ids
return subscriptions
Loading

0 comments on commit f59e672

Please sign in to comment.