Git Product home page Git Product logo

rrdrest's Introduction

RRDReST

simple micro service for converting your RRD's to web services

rrdReST

getting started

  • ensure you have rrdtool installed and you can access the rrd files from the server
  • git clone the project git clone https://github.com/tbotnz/RRDReST && cd RRDReST
  • install the requirements pip3 install -r requirements.txt
  • run the app with uvicorn uvicorn rrdrest:rrd_rest --host "0.0.0.0" --port 9000
  • access the swagger documentation via http://127.0.0.1:9000/docs

examples

  • last 24 hours curl 127.0.0.1:9000/?rrd_path=tests/port-id15.rrd
  • epoch date time filter curl 127.0.0.1:9000/?rrd_path=tests/port-id15.rrd&epoch_start_time=1622109000&epoch_end_time=1624787400

rrdtool

  • tested with version 1.7

rrdrest's People

Contributors

tbotnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rrdrest's Issues

systemd script

A suggested enhancement:

stephen@librenms:~$ cat rrdrest.service

Description=Uvicorn systemd service.
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
ExecStart=/usr/local/bin/uvicorn rrdrest:rrd_rest --host "0.0.0.0" --port 9000
User=stephen
Group=stephen
RuntimeDirectory=/var/run/uvicorn
WorkingDirectory=/home/stephen/RRDReST
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
TimeoutStopSec=5
PrivateTmp=true
RestartSec=1
Restart=always

[Install]
WantedBy=multi-user.target

stephen@librenms:~$

`stephen@librenms:~$ sudo systemctl status rrdrest
● rrdrest.service
Loaded: loaded (/lib/systemd/system/rrdrest.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2023-04-02 11:52:32 AEST; 2min 2s ago
Main PID: 29832 (uvicorn)
Tasks: 5 (limit: 4636)
Memory: 11.8M
CGroup: /system.slice/rrdrest.service
└─29832 /usr/bin/python3 /usr/local/bin/uvicorn rrdrest:rrd_rest --host 0.0.0.0 --port 9000

Apr 02 11:52:32 librenms systemd[1]: Started rrdrest.service.
Apr 02 11:52:32 librenms uvicorn[29832]: INFO: Started server process [29832]
Apr 02 11:52:32 librenms uvicorn[29832]: INFO: Waiting for application startup.
Apr 02 11:52:32 librenms uvicorn[29832]: INFO: Application startup complete.
Apr 02 11:52:32 librenms uvicorn[29832]: INFO: Uvicorn running on http://0.0.0.0:9000 (Press CTRL+C to quit)`

Note that I used the git directory as the working directory as uvicorn cant find the RRD module unless the CWD is the git directory. Perhaps some instructions on installing the module might help, to noobs like me :)

feature request: add parameter for 'step'

Thanks for RRDRest! It's helping me with a project to collect LibreNMS RRD data for reporting with PowerBI.

Quick feature req that I'm happy to work on and submit a PR for, it'd be nice if I could specify the step that gets passed to rrdtool.

clarification request: is it possible to aggregate two or more .rrd files

Dear tbotnz
I'm Paolo Cruschelli from Italy. Thank you for your work on RRDREST, I managed to have it working with my librenms installation.
One question arise. Is it possible to display the aggregated data from two (or more ports)?, in other words is is possible to query two (or more) .rrd files at once?

I know that this is possible with rrdtools (in the following an example which aggregates bandwidth for two files related to two ports:
port-id1170.rrd
port-id1169.rrd

thank you in advance
regards

Paolo

rrdtool graph /tmp/W96uhLxhVo9u15Ht --start 1675162500 --end 1675248900 --width 1519 --height 300 --font LEGEND:8:DejaVuSansMono --font AXIS:7:DejaVuSansMono --font-render-mode normal -c FONT#000000 -c BACK#EEEEEE00 -c SHADEA#EEEEEE00 -c SHADEB#EEEEEE00 -c CANVAS#FFFFFF00 -c GRID#a5a5a5 -c MGRID#FF9999 -c FRAME#5e5e5e -c ARROW#5e5e5e --alt-autoscale-max --rigid --slope-mode COMMENT:'Bits/sec ' COMMENT:' Current' COMMENT:' Average' COMMENT:' Maximum' COMMENT:'\l' DEF:in0=62.196.5.4/port-id1170.rrd:INOCTETS:AVERAGE DEF:out0=62.196.5.4/port-id1170.rrd:OUTOCTETS:AVERAGE CDEF:inB0=in0,8,* CDEF:outB0=out0,8,* CDEF:outB0_neg=outB0,-1,* CDEF:octets0=inB0,outB0,+ AREA:inB0#CAE853:'pe-mi-196-04-piastra In' GPRINT:inB0:LAST:%6.2lf%sbps GPRINT:inB0:AVERAGE:%6.2lf%sbps GPRINT:inB0:MAX:%6.2lf%sbps\l 'HRULE:0#A9A9F2:ge-1/0/1 Out' GPRINT:outB0:LAST:%6.2lf%sbps GPRINT:outB0:AVERAGE:%6.2lf%sbps GPRINT:outB0:MAX:%6.2lf%sbps\l 'COMMENT:\l' DEF:in1=62.196.5.4/port-id1169.rrd:INOCTETS:AVERAGE DEF:out1=62.196.5.4/port-id1169.rrd:OUTOCTETS:AVERAGE CDEF:inB1=in1,8,* CDEF:outB1=out1,8,* CDEF:outB1_neg=outB1,-1,* CDEF:octets1=inB1,outB1,+ AREA:inB1#B2D849:'pe-mi-196-04-piastra In':STACK GPRINT:inB1:LAST:%6.2lf%sbps GPRINT:inB1:AVERAGE:%6.2lf%sbps GPRINT:inB1:MAX:%6.2lf%sbps\l 'HRULE:0#9696DD:ge-1/0/0 Out' GPRINT:outB1:LAST:%6.2lf%sbps GPRINT:outB1:AVERAGE:%6.2lf%sbps GPRINT:outB1:MAX:%6.2lf%sbps\l 'COMMENT:\l' 'AREA:outB0_neg#A9A9F2:' 'AREA:outB1_neg#9696DD::STACK' HRULE:0#999999 --daemon 100.67.0.46:42217

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.