Alertalot
Python library for creating AWS CloudWatch alerts automatically based on predefined configurations.
Running the Code
Linux
- Clone the repository and run
./bin/install.sh
- Optionally, run tests
./bin/test.sh
You should see:... ───────────────────────────────────────────── ✓ SUCCESS: Alertalot Pylint check passed ✓ SUCCESS: Unittests Pylint check passed ✓ SUCCESS: Unittests passed ───────────────────────────────────────────── ✓ OK!
Code Quality and Testing
Before running any of the following commands, ensure that your virtual environment is activated:
source ./venv/bin/activate
Test and Lint Commands
| Task | Command |
|---|---|
| Run Unit Tests with Coverage | pytest --cov=alertalot --cov-report=html --cov-branch |
| Lint Alertalot Code | pylint alertalot --rcfile=.pylintrc --fail-under=10 |
| Lint Test Code | pylint tests --rcfile=tests/.pylintrc --fail-under=10 |
Usage
Alertalot can be run with various options to create CloudWatch alerts for AWS resources.
Basic Usage
python -m alertalot.main --instance-id i-xxxxxxxxx --vars-file examples/variables.yaml --template-file examples/ec2-application.yaml --region us-east-1
Available Options
| Option | Description |
|---|---|
--instance-id |
ID of an EC2 instance to generate the alerts for |
--params-file |
Relative path to the parameters file to use (see examples/params.yaml) |
--template-file |
Relative path to the template file to use (see examples/ec2-application.yaml) |
--region |
The AWS region to use |
--dry-run |
Simulate the requests without executing them |
-v, --verbose |
Enable verbose output to show details about executed actions |
Special Actions
| Action | Description |
|---|---|
--show-parameters, --show-params |
Only loads the parameters file and outputs the result. Parameters for the specified region will be merged with global parameters. |
--test-aws |
Only checks if AWS is accessible by calling sts:GetCallerIdentity. Use with --verbose to see detailed output. |
--show-instance |
Loads and describes the target instance. Requires a valid instance ID. |
Configuration Files
Parameters File
The parameters file (YAML or JSON) contains values that will be substituted in the template file:
params:
global:
# Global parameters used across all regions
us-east-1:
# Region-specific parameters
ALARM_ACTION_ARN: "arn:aws:sns:us-east-1:aaaa:bbbb"
Template File
The template file defines the CloudWatch alarms to be created:
alarms:
- type: ec2
alarm-name: AWS / CPU Usage 5 minute / $INSTANCE_NAME / $INSTANCE_ID
metric-name: CPUUtilization
alarm-actions: $ALARM_ACTION_ARN
statistic: Average
period: 5 minutes
comparison-operator: GreaterThanOrEqualToThreshold
threshold: 70%
evaluation-periods: 1 minute
tags:
level: info
treat-missing-data: breaching
Metadata
Release files for alertalot 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| alertalot-0.2.0.tar.gz | 25.3 kB | Without provenance | Details for alertalot-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| alertalot-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for alertalot-0.2.0-py3-none-any.whl |
Total release size: 58.8 kB
Release files / alertalot-0.2.0.tar.gz
| Download URL | alertalot-0.2.0.tar.gz |
|---|---|
| Size | 25.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f0a9a44adc1fff048b7f7e929d8988b3f572e711277beb69f5851a520a340e9d
|
|
BLAKE2b-256 checksum How to use checksums |
fbb2fe018ce99b836aaa33b3df11e47e2c8ade57965a88360b21714600e10ba5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Release files / alertalot-0.2.0-py3-none-any.whl
| Download URL | alertalot-0.2.0-py3-none-any.whl |
|---|---|
| Size | 33.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
17eef78e2a168f7bc93268464043fe7339c429d3ea085e8bbc9cdb7cbc33b6ed
|
|
BLAKE2b-256 checksum How to use checksums |
c4402402802ad70715124af6bb6bf69ba48278ea38bdfa6c94947ee147fb7fa1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.17
|
Security for alertalot 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.