Package: sau
SaU (Stopped and Unattached) ExporterOverviewThe SaU Exporter is a Python-based application designed to collect and expose AWS EC2 and EBS volume metrics for monitoring and observability. It utilizes the Prometheus client library to provide an HTTP endpoint for scraping metrics.FeaturesEC2 Metrics: Collects information about stopped EC2 instances in different AWS regions.EBS Volume Metrics: Retrieves data on unattached/errored EBS volumes, including volume state, type, size, and region.Prometheus Integration: Exposes metrics in the Prometheus format, making it compatible with Prometheus monitoring systems.Exclude Tagging: Instances and/or volumes tagged with the key "exclude_from_monitoring" with the value True will be omitted as metrics.Installing via pipPip package is availableherePrerequisites:Python 3.8+ installed on your system.Ensure the required Python libraries are installed by running the following command.pipinstall-rrequirements.txtpipinstallsauAWS CredentialsThe exporter requires two AWS EC2 permissions,DescribeInstancesandDescribeVolumes. A sample iam policy document can be seen below:{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Action":["ec2:DescribeInstances","ec2:DescribeVolumes"],"Resource":"*"}]}It would be easier to put the creds in a env file. Example.envfile can be seen below:AWS_ACCESS_KEY_ID=129QJDNC2OQD09N
AWS_SECRET_ACCESS_KEY=9KXXXXXXXXX
AWS_REGION=eu-central-1then you can source the.envsource.envConfigurationCreate a YAML configuration file with the necessary settings.Configuration OptionsRegions: Specify the AWS regions for which you want to collect metrics.Exporter Port: Define the port on which the exporter will expose metrics (default: 9191).Logging Configuration: Customize logging settings, such as log file directory and retention.
See example below.# list of regions to scrape: REQUIREDregions:-eu-central-1-eu-west-1# exporter port. Defaults to 9191exporter_port:9191# Logging configurationlogging:# Number of log files to retain after log rotationretention:7# log directory. defaults to current working directorydirectory:"."# log level (debug, info, warn, error). Defaults to infolevel:infoUsing pip package after installationpython3-msau-c/path/to/config.yamlInstalling using dockerThe docker repository is available atlink. You will need the following:Config file:see Configuration sectionAWS Credentials:see AWS Credentials sectionTo run the container, use the example command below:dockerrun-ti--env-file.env-v/path/to/config.yaml:/sau/config.yamlugwuanyi/sau:latest-c/sau/config.yamlInstalling from source:Prerequisites:Python 3.8+ installed on your system.clone the repositorygitclonehttps://github.com/emylincon/sau.gitEnsure the required Python libraries are installed by running the following command.pipinstall-rrequirements.txtYou will need the following:Config file:see Configuration sectionAWS Credentials:see AWS Credentials sectionExecute the exporter by providing the path to the configuration file:python3src/sau/__main__.py-c/path/to/your/config.yamlMetrics Endpoint:Once the exporter is running, metrics can be accessed athttp://localhost:<exporter_port>/.Grafana DashboardGrafana dashboard of sample metricsCustomizationFeel free to extend or customize the exporter to meet your specific requirements. You can modify the provided code or add additional collectors to gather more AWS resource metrics.LicenseThis project is licensed under the MIT License. Feel free to use, modify, and distribute it according to the terms of the license.AuthorCreated by Emeka Ugwuanyi. For questions or feedback, please contact me.Upgrading versionenable pr-commitpre-commitinstallIncreament version indocker/TaskfileCommiting changes with update all the version referencesHappy monitoring!