Giter Club home page Giter Club logo

s3-exporter's Introduction

s3-exporter

Prometheus metrics exporter for S3 Storage

Config example

access_key: "optional-your-access-key"
secret_key: "optional-your-secret-key"
bucket: "bucket-name"
patterns:
  - "*.zip"
folders:
  - "backup"
  - "nextcloudbackup"

You can omit access_key and secret_key to use credentials from environment settings, see the Boto3 documentation for more info.

If you would like metrics on objects in the root of the bucket use an empty folder, i.e.:

folders:
  - ""

If you would like to cut results (i.e. w/o subfolders) use delimiter within pattern, see AWS docs for explanations, for example:

patterns:
  - "some/long/path"
delimiter: "/"

Metrics

Metrics will be available at http://localhost:9327

# HELP s3_latest_file_timestamp Last modified timestamp(milliseconds) for latest file in folder
# TYPE s3_latest_file_timestamp gauge
s3_latest_file_timestamp{bucket="bucket-name",folder="backup"} 1519524066157.0
# HELP s3_oldest_file_timestamp Last modified timestamp(milliseconds) for oldest file in folder
# TYPE s3_oldest_file_timestamp gauge
s3_oldest_file_timestamp{bucket="bucket-name",folder="backup"} 1519005663854.0
# HELP s3_latest_file_size Size in bytes for latest file in folder
# TYPE s3_latest_file_size gauge
s3_latest_file_size{bucket="bucket-name",folder="backup"} 290355072.0
# HELP s3_oldest_file_size Size in bytes for latest file in folder
# TYPE s3_oldest_file_size gauge
s3_oldest_file_size{bucket="bucket-name",folder="backup"} 281699347.0
# HELP s3_file_count Numbeer of existing files in folder
# TYPE s3_file_count gauge
s3_file_count{bucket="bucket-name", folder="backup"} 7.0
# HELP s3_success Displays whether or not the listing of S3 was a success
# TYPE s3_success gauge
s3_success{bucket="bucket-name",folder="backup"} 1.0

Alert Example

  • Alert for time of latest backup. This example checks if backup is created every day (< 30h)
groups:
- name: host.rules
  rules:
  - alert: backup_is_too_old
    expr: (time()) - s3_latest_file_timestamp > 108000
    for: 5m
    labels:
      severity: critical
    annotations:
      description: Backup too old. Reported by instance {{ $labels.instance }}.
      summary: Backup too old


  • Alert for size of latest backup. This example checks latest backup file created has minimum size of 1MB
  - alert: backup_size_is_too_small
    expr: s3_latest_file_size < 1000000
    for: 5m
    labels:
      severity: critical
    annotations:
      description: Backup size too small. Reported by instance {{ $labels.instance }}.
      summary: Backup size too small

Run

Using code (local)

pip install -r app/requirements.txt
aws-profile -p prod/vault python app/exporter.py config/config.yml

Using docker

docker run -p 9327:9327 -v ./config:/config jamotion/s3-exporter

Using docker-compose

Currently the code will not be reloaded when it changes, so run the container interactively:

docker-compose run --service-ports s3

Then run the Python exporter process:

python exporter.py /config/config.yml

s3-exporter's People

Contributors

afda16 avatar akhon avatar js-timbirkett avatar rm-jamotion avatar sedan07 avatar shanepikecn avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

akhon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.