ARGO Monitoring Service library: A simple python library for interacting with the ARGO Monitoring Service REST API
The ARGO Monitoring service is designed to monitor the status, availability, and reliability of services provided by electronic infrastructures with moderate to high complexity. Its web API provides the Serving Layer, used for retrieving the Status, Availability, and Reliability reports as well as the actual raw metric results. This library intends to provide access to basic functionality of the API, in a simple and intuitive way.
You may find more information pertaining to the service and its web API on the ARGO Monitoring Service and ARGO web API documentation pages.
The library been tested with Python versions 3.9, 3.11, and 3.12 on Rocky 9. In order to install the library, you'll need to check out the source, have python setuptools installed and run
python3 ./setup.py build && \
sudo python3 ./setup.py installAlternatively, on RHEL-based systems with rpm-build and python3-dev installed, you may run
mkdir -p ~/rpmbuild/SOURCES && \
python3 ./setup.py build && \
python3 ./setup.py bdist_rpm && \
cp dist/argo-mon-library-0.1.0.tar.gz && \
rpmbuild -bb argo-mon-library.specto create an RPM file for each supported python version under ~/rpmbuild/RPMS/noarch, and then use rpm / dnf to install the desired RPM packages, e.g.
sudo dnf install ~/rpmbuild/RPMS/noarch/python3-argo-mon-library-0.1.0-1.el9.noarch.rpmfor version 0.1.0-1 of the library using the default (platform) python.
The Argo Monitoring library needs a valid API key to authenticate against the service's REST API. Each API key gives access to a specific tenant. Once a valid key has been obtained, a monitoring service object may be initialized as follows:
from argo_mon_library import ArgoMonitoringService
mon = ArgoMonitoringService(endpoint="mon_endpoint", apikey="your_api_key")In the examples folder, you may find the following library usage examples:
- getting a list of reports for a tenant (
examples/get_reports.py) - getting the status for each endpoint of all groups defined in a report
- getting daily/monthy A/R results for groups defined in a report
Help on running each example is available by running the example with -h.
Assuming you've saved your API key in a file under ~/mon.key, you may run the first example against the development instance of the service with
python3 ./examples/get_reports.py --host api.devel.mon.argo.grnet.gr --api-key ~/mon.key -fThis will print out a list of reports for the tenant, along with some information about the report, such as thresholds and the topology schema group hierarchy
To get status data for endpoints belonging to groups of a report, run
python3 ./examples/get_endpoint_statuses.py --host api.devel.mon.argo.grnet.gr --api-key ~/mon.key -f --report REPORTNAME --start-date YYYY-MM-DDwhere REPORTNAME is the name of a report, as listed in the 1st example, and YYYY-MM-DD is an ISO formated date. An optional end date may be passed with --end-date YYY-MM-DD, which otherwise defaults to the day defined by --start-date.
To get daily A/R results for all groups in a report, run
python3 ./examples/get_group_results.py --host api.devel.mon.argo.grnet.gr --api-key ~/mon.key -f --report REPORTNAME --start-date YYYY-MM-DDwhere REPORTNAME is the name of a report, as listed in the 1st example, and YYYY-MM-DD is an ISO formated date. An optional end date may be passed with --end-date YYY-MM-DD, which otherwise defaults to the day defined by --start-date. Additionally,
- The optional argument
--monthlymay be specified to fetch results with a monthy granularity, instead of daily. - The optional argument
--supergroup SUPERGROUPNAMEmay be specified, in order to fetch results for a specific top-level group (supergroup) - The optional argument
--group GROUNAMEmay be specified in order to fetch results for specific group of each supergroup, instead of all groups
DEBUG: Set to any truthy value in order to have debugging information printed to stdout, for development pusposes.