Git Product home page Git Product logo

kernelscope's Introduction

A service for logging and visualizing data from bpf scripts.

Flame Graph Table

Setup the database

For sqlite you do the following

cat kernelscope-sqlite.sql | sqlite3 yourdatabase.db

For mysql you can just run the following

mysql -u username -p < kernelscope-mysql.sql

Start the logging daemon

This is the daemon that accepts connections from your hosts that want to log their trace data. You need to point it at your database, the sqllite and mysql commands follow (use whichever one is relevant)

python KernelscopeLoggerService.py --mysql localhost --dbuser user --dbpassword password --dbname kernelscope 8081
python KernelscopeLoggerService.py --sqlite kernelscope.db 8081

Run the tracing tool on your target host

Currently the only script in this repo is offcputime.py, which is just Brendan Gregg's offcputime.py from bcc/tools/offcputime.py that has been modified to dump it's information into a kernelscope service. You run it as follows

python offcputime.py --logger 'http://localhost:8081' --threshold 5000

This will log to the service running on localhost and will only log events that take longer than 5000 microseconds, and will send information to the service once a minute.

Run the visualization service

This is the read-only side of kernelscope that runs the webapp. Simply run the following command for whichever database backend you are using

python KernelscopeService.py --mysql localhost --dbuser user --dbpassword password --dbname kernelscope 8080
python KernelscopeService.py --sqlite kernelscope.db 8080

and then navigate your browser to the appropriate host and port.

Extending for new data types

This is meant to be as easily extendable as possible. That said I, a kernel developer, wrote it so it made sense to me. If there are cleaner approaches I accept patches. All you should have to do is add entry to two dicts at the top of src/KernelscopeCategories.py. The format is the following

_categories['DATABASE TABLE NAME'] = [ {'name': 'COLUMN NAME 1', 'type':'TYPE', 'prettyname':'SOME PRETTY NAME TO DESCRIBE THE COLUMN'}]

TYPE has to be of one of the types described in json-api.txt. _valid_columns must be just a dict of the tables column names, so in the following format

_valid_columns['DATABASE TABLE NAME'] = [ 'COLUMN NAME 1', 'COLUMN NAME 2' ]

Then your script can log with the proper dict values set and it'll log into the datbase properly and then the webapp should show the data properly.

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.