Git Product home page Git Product logo

openvpn-auth-log-exporter's Introduction

OpenVPN Auth Log Exporter

This is a simple Golang application that builds an exporter to be used with Prometheus to get the OpenVPN server authentication logs

Overview

This exporter is designed to expose metrics about a hypothetical service written in Golang. It provides insights into the performance and health of the service by exposing various metrics in the Prometheus exposition format.

Prerequisites

Installation

  1. Clone this repository:

    git clone https://github.com/devpolatto/openvpn-auth-log-exporter.git
  2. Navigate to the project directory:

    cd openvpn-auth-log-exporter
  3. Download the dependencies

    go mod download
  4. Build the exporter:

    go build main .

Usage

  1. Run the exporter:

    ./main

    The script expects the user to indicate where the .log file to be monitored is located. By default, the script searches /go/src/app/ovpn-ldap-auth.log.

    To replace the location, run:

    ./main -openvpn.auth_paths /path/to/.log
  2. Visit http://localhost:8080/metrics to access the metrics endpoint.

  3. Configure Prometheus to scrape metrics from the exporter by adding the following configuration to your prometheus.yml file:

    scrape_configs:
      - job_name: 'openvpn-auth-log-exporter'
        static_configs:
          - targets: ['192.168.10.10:9177']

    We chose to leave the path as /metrics because it is the prometheus default. You can change both the port and the path, as shown below:

    ./main -web.telemetry-path "/logs" -web.listen-address "9172"
  4. Restart Prometheus to apply the changes.

Metrics

The exporter displays the following log in the following format:

openvpn_ldap_user_logs_total{DN="",MessageResponse="unable to bind",ResultCode="1",Timestamp="2024-02-05 21:32:06",Username="",action="connection",status="error"} 1

Docker

To build a docker image, run:

cd openvpn-auth-log-exporter
docker build -t openvpn-auth-log-exporter .   

Then run the conatiner. Remember to make the volume bind ready for the .log file in your system file

docker run -p 9177:9177 -v ./ovpn-ldap-auth.log:/go/src/app/openvpn-status-auth.log openvpn-exporter:latest

openvpn-auth-log-exporter's People

Contributors

devpolatto avatar

Watchers

 avatar

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.