GithubHelp home page GithubHelp logo

pombredanne / osquery_exporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zwopir/osquery_exporter

0.0 0.0 0.0 17 KB

Exporter for exporting osquery query results to prometheus

License: Apache License 2.0

Go 100.00%

osquery_exporter's Introduction

osquery_exporter

Exporter for exporting osquery (https://osquery.io) query results to prometheus

Installation

Install osquery from https://osquery.io/downloads/

Build with go1.7

go get github.com/zwopir/osquery_exporter
go build

Configuration

The exporter can be configured via configuration file and commandline parameters.

Usage of ./osquery_exporter:
  -config.file string
    	Config file (default "config.yaml")
  -log.format value
    	Set the log target and format. Example: "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true" (default "logger:stderr")
  -log.level value
    	Only log messages with the given severity or above. Valid levels: [debug, info, warn, error, fatal] (default "info")
  -web.listen-address string
    	Address on which to expose metrics and web interface. (default ":9232")
  -web.telemetry-path string
    	Path under which to expose metrics. (default "/metrics")

The configuration file is mandatory, whereas the commandline parameters are optional and have resonable default values

The configuration file (YAML) defines the queries that are run via osqueryi.

---
runtime:
  # osqueryi binary. Looked up in PATH if not specified as absolute path
  osquery: "osqueryi"
  # timeout for a single call to osqueryi
  timeout: 10s

metrics:
  counters:
    # a list of counter definitions
    [ - <counter definition> ... ]  
  gauges:
    # a list of gauge definitions
    [ - <gauge definition> ... ]  
  countervecs:
    # a list of countervec definitions
    [ - <countervec definition> ... ]  
  gaugevecs:
    # a list of gaugevec definitions
    [ - <gaugevec definition> ... ]  

There are four types of metrics, that can be exported:

counter and gauges

Counter and gauges are defined as an osquery query that returns a single line with a single element. Typical queries are select count(*) as c from <table>;. The resulting column must me named and referenced in the metric definition:

# name of the metric. Directly exported to prometheus (but prefixed with osquery_exporter_).
name: history_lines_count
# metric help
help: "number of entries in the history"
# the query to be executed via osqueryi
query: "select count(*) as count from shell_history"
# reference to the name of the result column
valueidentifier: count

It's up to the user to decide if the osquery query result is a counter or gauge. Further information about metric types and labeling recommendations can be found at

countervecs and gaugevecs

counter- and gaugevecs are analog counters and gauges, but the query result can (and should) consist of more than one result set. A single result set must contain label columns which are referenced in the metric definition:

name: users_by_shell
help: "number of users by login shell"
query:  select count(*) as count, shell from users group by shell;
valueidentifier: count
labelidentifier:
  - shell

Implicit metrics

In addition to the defined metrics defined via the configuration file, osquery_exporter implicitly creates metrics for

  • query duration (type summaryvec with a label "name")
  • query status (type gaugevec with a label "name"). A value of 0 indicates an error (including timeout), 1 indicates success.
  • number of result sets (SQL lines) per query (type gaugevec with a label "name")

osquery_exporter's People

Contributors

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