GithubHelp home page GithubHelp logo

superq / mod_prometheus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from friends-of-freeswitch/mod_prometheus

0.0 3.0 0.0 19 KB

FreeSWITCH Prometheus Instrumentation Module in Rust

Rust 100.00%

mod_prometheus's Introduction

FreeSWITCH Prometheus Module

This module exposes FreeSWITCH metrics for scraping by Prometheus.

mod_prometheus is built upon FreeSWITCH Rust bindings.

Install

Installation instructions:

# Check for and install the Rust compiler
$ rustc -V || curl -sSf https://static.rust-lang.org/rustup.sh | sh

# Clone the project and build it:
$ git clone https://github.com/moises-silva/mod_prometheus.git
$ cd mod_prometheus
$ cargo build

# Copy the module to your FreeSWITCH modules directory:
$ sudo cp target/debug/libmod_prometheus.so `fs_cli -x 'global_getvar mod_dir'`

# Load the module:
$ fs_cli -x 'load libmod_prometheus'

# Make sure it's loaded and listening to TCP port 6780
$ fs_cli -x 'module_exists libmod_prometheus'
true

$ netstat -nl | grep 6780
tcp        0      0 0.0.0.0:6780            0.0.0.0:*               LISTEN

# For auto-load the module add this line at the end of your modules.conf
$ sudo vi /etc/freeswitch/autoload_configs/modules.conf.xml

    <load module="libmod_prometheus"/>

Now you can access your host at port 6780 to check your metrics: http://YOUR_HOST:6780/

Metrics

These are the metrics provided by default:

freeswitch_heartbeats
freeswitch_registration_attempts
freeswitch_registration_failures
freeswitch_registrations
freeswitch_registrations_active
freeswitch_sessions
freeswitch_sessions_active
freeswitch_sessions_answered
freeswitch_sessions_asr
freeswitch_sessions_failed
freeswitch_sessions_inbound
freeswitch_sessions_inbound_answered
freeswitch_sessions_inbound_failed
freeswitch_sessions_outbound
freeswitch_sessions_outbound_answered
freeswitch_sessions_outbound_failed

You can also use FreeSWITCH ESL APIs to create your own counters or gauges:

fscli> prom_counter_increment my_counter

fscli> prom_counter_increment my_counter 100

fscli> prom_gauge_set my_gauge 500

fscli> prom_gauge_increment my_gauge
fscli> prom_gauge_decrement my_gauge 2

As all FreeSWITCH APIs, these functions can be used from the XML dialplan or the command line.

mod_prometheus's People

Contributors

hdiogenes avatar holaso avatar jakekeeys avatar moises-silva avatar

Watchers

 avatar  avatar  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.