Code Monkey home page Code Monkey logo

sphinx_exporter's Introduction

Sphinx Exporter for Prometheus

GitHub Workflow Status (branch) GitHub release (latest SemVer) Docker Pulls

A sphinx exporter for prometheus.

Grafana Dashboards

Install

Docker

Specific version

docker pull foxdalas/sphinx-exporter:v0.3.0

latest version

docker pull foxdalas/sphinx-exporter:latest

Building

The sphinx exporter exports metrics from a sphinx server for consumption by prometheus. The server is specified as --sphinx.address and --sphinx.port flag to the program (default is localhost:9306).

By default the sphinx_exporter serves on port 0.0.0.0:9247 at /metrics

make build
./sphinx_exporter

Alternatively a Dockerfile is supplied

make docker

OR

go build -o sphinx_exporter .
docker build -t foxdalas/sphinx-exporter:latest .

Collectors

The exporter collects a number of statistics from the server:


# HELP sphinx_agent_connect Number of agent connect since server start.
# TYPE sphinx_agent_connect counter
sphinx_agent_connect 0
# HELP sphinx_agent_retry Number of agent retry since server start.
# TYPE sphinx_agent_retry counter
sphinx_agent_retry 0
# HELP sphinx_avg_dist_local Number of avg_dist_local since server start.
# TYPE sphinx_avg_dist_local counter
sphinx_avg_dist_local 0
# HELP sphinx_avg_dist_wait Number of avg_dist_wait since server start.
# TYPE sphinx_avg_dist_wait counter
sphinx_avg_dist_wait 0
# HELP sphinx_avg_dist_wall Number of avg_dist_wall since server start.
# TYPE sphinx_avg_dist_wall counter
sphinx_avg_dist_wall 0
# HELP sphinx_avg_query_cpu Number of avg_query_cpu since server start.
# TYPE sphinx_avg_query_cpu gauge
sphinx_avg_query_cpu 0
# HELP sphinx_avg_query_readkb Number of avg_query_readkb since server start.
# TYPE sphinx_avg_query_readkb gauge
sphinx_avg_query_readkb 0
# HELP sphinx_avg_query_reads Number of avg_query_reads since server start.
# TYPE sphinx_avg_query_reads gauge
sphinx_avg_query_reads 0
# HELP sphinx_avg_query_readtime Number of avg_query_readtime since server start.
# TYPE sphinx_avg_query_readtime gauge
sphinx_avg_query_readtime 0
# HELP sphinx_avg_query_wall Number of avg_query_wall since server start.
# TYPE sphinx_avg_query_wall counter
sphinx_avg_query_wall 0
# HELP sphinx_command_delete Number of delete command since server start.
# TYPE sphinx_command_delete counter
sphinx_command_delete 0
# HELP sphinx_command_flushattrs Number of flushattrs command since server start.
# TYPE sphinx_command_flushattrs counter
sphinx_command_flushattrs 0
# HELP sphinx_command_keywords Number of keywords command since server start.
# TYPE sphinx_command_keywords counter
sphinx_command_keywords 672
# HELP sphinx_command_persist Number of persist command since server start.
# TYPE sphinx_command_persist counter
sphinx_command_persist 0
# HELP sphinx_command_search Number of search command since server start.
# TYPE sphinx_command_search counter
sphinx_command_search 802
# HELP sphinx_command_status Number of status command since server start.
# TYPE sphinx_command_status counter
sphinx_command_status 133
# HELP sphinx_command_update Number of update command since server start.
# TYPE sphinx_command_update counter
sphinx_command_update 0
# HELP sphinx_connections Number of connections since the server started.
# TYPE sphinx_connections counter
sphinx_connections 59691
# HELP sphinx_dist_local Number of dist_local since server start.
# TYPE sphinx_dist_local counter
sphinx_dist_local 0
# HELP sphinx_dist_queries Number of distributed queries since server start.
# TYPE sphinx_dist_queries counter
sphinx_dist_queries 0
# HELP sphinx_dist_wait Number of dist_wait since server start.
# TYPE sphinx_dist_wait counter
sphinx_dist_wait 0
# HELP sphinx_dist_wall Number of dist_wall since server start.
# TYPE sphinx_dist_wall counter
sphinx_dist_wall 0
# HELP sphinx_maxed_out Number of max children barier since the server started.
# TYPE sphinx_maxed_out counter
sphinx_maxed_out 0
# HELP sphinx_qcache_cached_queries Number of qcache_cached_queries since server start.
# TYPE sphinx_qcache_cached_queries counter
sphinx_qcache_cached_queries 0
# HELP sphinx_qcache_max_bytes Number of qcache_max_bytes since server start.
# TYPE sphinx_qcache_max_bytes counter
sphinx_qcache_max_bytes 1.6777216e+07
# HELP sphinx_qcache_thresh_msec Number of qcache_thresh_msec since server start.
# TYPE sphinx_qcache_thresh_msec counter
sphinx_qcache_thresh_msec 3000
# HELP sphinx_qcache_ttl_sec Number of qcache_ttl_sec since server start.
# TYPE sphinx_qcache_ttl_sec counter
sphinx_qcache_ttl_sec 60
# HELP sphinx_qcache_used_bytes Number of qcache_used_bytes since server start.
# TYPE sphinx_qcache_used_bytes counter
sphinx_qcache_used_bytes 0
# HELP sphinx_queries Number of queries since server start.
# TYPE sphinx_queries counter
sphinx_queries 802
# HELP sphinx_query_cpu Number of query_cpu since server start.
# TYPE sphinx_query_cpu gauge
sphinx_query_cpu 0
# HELP sphinx_query_readkb Number of query_readkb since server start.
# TYPE sphinx_query_readkb counter
sphinx_query_readkb 0
# HELP sphinx_query_reads Total number of KB read since server start.
# TYPE sphinx_query_reads counter
sphinx_query_reads 0
# HELP sphinx_query_readtime Total time spent doing read operations (in seconds) since server start.
# TYPE sphinx_query_readtime counter
sphinx_query_readtime 0
# HELP sphinx_query_wall Number of query_wall since server start.
# TYPE sphinx_query_wall counter
sphinx_query_wall 0.291
# HELP sphinx_up Could the searchd server be reached.
# TYPE sphinx_up gauge
sphinx_up 1
# HELP sphinx_uptime Number of seconds since the server started.
# TYPE sphinx_uptime gauge
sphinx_uptime 92852
# HELP sphinx_index_count Number of indexes.
# TYPE sphinx_index_count counter
sphinx_index_count 10
# HELP sphinx_threads_count Number of threads
# TYPE sphinx_threads_count counter
sphinx_threads_count{state="net_idle"} 7
sphinx_threads_count{state="query"} 1

sphinx_exporter's People

Contributors

dependabot[bot] avatar foxdalas avatar ghostiam avatar kshvakov avatar xelatirdan avatar

Stargazers

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

Watchers

 avatar

sphinx_exporter's Issues

Infinite recursion in `printerror()` ?

When the exporter is unable to connect to sphinx server at startup, the exporter dies due to a stack overflow. A gist of the stack trace is this:

INFO[0000] Starting sphinx_exporter (version=0.0.2, branch=master, revision=01fbd50db7193cef6ce37ed527e3a1c7494b6695)  source="main.go:658"
INFO[0000] Build context (go=go1.11.1, user=root@f7cd2537cfdd, date=20181031-08:51:54)  source="main.go:659"
INFO[0000] Starting HTTP server on :9247                 source="main.go:673"
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x8d296f, 0xe)
    /usr/local/go/src/runtime/panic.go:608 +0x72
runtime.newstack()
    /usr/local/go/src/runtime/stack.go:1008 +0x729
runtime.morestack()
    /usr/local/go/src/runtime/asm_amd64.s:429 +0x8f

goroutine 21 [running]:
main.printerror(0xc000097380, 0x949fa0, 0xc00008ed70, 0xc00019e000)
    /go/src/github.com/foxdalas/sphinx_exporter/main.go:637 +0xbd fp=0xc0201c2328 sp=0xc0201c2320 pc=0x7d7e2d
main.printerror(0xc000097380, 0x949fa0, 0xc00008ed70, 0xc00019e000)
    /go/src/github.com/foxdalas/sphinx_exporter/main.go:639 +0x4d fp=0xc0201c2388 sp=0xc0201c2328 pc=0x7d7dbd
main.printerror(0xc000097380, 0x949fa0, 0xc00008ed70, 0xc00019e000)
    /go/src/github.com/foxdalas/sphinx_exporter/main.go:639 +0x4d fp=0xc0201c23e8 sp=0xc0201c2388 pc=0x7d7dbd
main.printerror(0xc000097380, 0x949fa0, 0xc00008ed70, 0xc00019e000)
    /go/src/github.com/foxdalas/sphinx_exporter/main.go:639 +0x4d fp=0xc0201c2448 sp=0xc0201c23e8 pc=0x7d7dbd
main.printerror(0xc000097380, 0x949fa0, 0xc00008ed70, 0xc00019e000)
    /go/src/github.com/foxdalas/sphinx_exporter/main.go:639 +0x4d fp=0xc0201c24a8 sp=0xc0201c2448 pc=0x7d7dbd
main.printerror(0xc000097380, 0x949fa0, 0xc00008ed70, 0xc00019e000)
    /go/src/github.com/foxdalas/sphinx_exporter/main.go:639 +0x4d fp=0xc0201c2508 sp=0xc0201c24a8 pc=0x7d7dbd
[many repeated lines]
...additional frames elided...
created by github.com/foxdalas/sphinx_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).Gather
    /go/src/github.com/foxdalas/sphinx_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:381 +0x302

Looking at main.go source code, I've the feeling there's an infinite recursion at line 639. May you explain the purpose of that line, please?

Thanks,
Marco

License?

Hello !

Would you mind adding a license file to the repo ? I need this to be able to use the software.

Thanks!

busy buffer

ERROR: packets.go:428: busy buffer

Sphinx 2.1.9-id64-release

Don't work with sphinx 2.2.11

Try to use sphinx-exporter geting the error:

time="2022-02-07T09:52:09Z" level=error msg="sql: expected 5 destination arguments in Scan, not 14" source="main.go:608"
time="2022-02-07T09:52:24Z" level=error msg="Error 1040: Too many connections" source="main.go:432"

As I see it were broken in #10

Docker container don't work

Steps to reproduce

# docker run --rm -it foxdalas/sphinx-exporter:v0.1.0
standard_init_linux.go:228: exec user process caused: no such file or directory

Then some debug:

# docker run --rm -it --entrypoint=sh foxdalas/sphinx-exporter:v0.1.0
/ # ls -lah /bin/sphinx_exporter 
-rwxr-xr-x    1 root     root        8.4M Dec 27 09:29 /bin/sphinx_exporter
/ # /bin/sphinx_exporter 
sh: /bin/sphinx_exporter: not found
/ # file /bin/sphinx_exporter 
/bin/sphinx_exporter: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=73P0s5YKkefPXvH5yrc0/pain-d_RTIRiUpco8NMS/h6Sxie90oBypkw18qH1J/saA34-lO2D5nUEce6gPW, stripped
/ # ls -lah /lib64/ld-linux-x86-64.so.2
ls: /lib64/ld-linux-x86-64.so.2: No such file or directory

We should install apk package libc6-compat with /lib64/ld-linux-x86-64.so.2, because we using alpine image or build sphinx_exporter with statically linked library.
https://pkgs.alpinelinux.org/contents?file=ld-linux-x86-64*&path=&name=&branch=v3.15&repo=main

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.