Git Product home page Git Product logo

cache's Introduction

Moira 2.0 Build Status codecov Documentation Status Telegram Go Report Card

Moira is a real-time alerting tool, based on Graphite or Prometheus/VictoriaMetrics metrics.

Installation

Docker Compose is the easiest way to try:

git clone https://github.com/moira-alert/docker-compose.git
cd docker-compose
docker-compose pull
docker-compose up

See more on our documentation page.

Feed data in Graphite format to localhost:2003:

echo "local.random.diceroll 4 `date +%s`" | nc localhost 2003

Configure triggers at localhost:8080 using your browser.

Other installation methods are available, see documentation.

Contribution

Check our contribution guideline

Getting Started

See our user guide that is based on a number of real-life scenarios, from simple and universal to complicated and specific.

What is in the other repositories

Code in this repository is the backend part of Moira monitoring application.

Contact us

If you have any questions, you can ask us on Telegram.

Thanks

SKB Kontur

Moira was originally developed and is supported by SKB Kontur, a B2G company based in Ekaterinburg, Russia. We express gratitude to our company for encouraging us to opensource Moira and for giving back to the community that created Graphite and many other useful DevOps tools.

cache's People

Contributors

alexakulov avatar beevee avatar gmlexx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cache's Issues

items that my update more then 1 times(metrics in the past) handles inproperly

When we use amazon cloud watch, it doesn't every time give metrics correctly(less that it must be), so we correct them time to time, and this is mean that the the same metrics may come 2 and more times, with the same timestamp. But moira cache do follow:

metricValue := fmt.Sprintf("%v %v", m.value, m.timestamp)
c.Send("ZADD", metricKey, m.timestamp, metricValue)

So for the same value(with the same timestamp) we have 2 and more different values, like this;

81) "1123 1452634560"
82) "679 1452634560"

In this situation moira doesn't behave like graphite, it doens't allow set point in the past, and doesn't allow update metric

The simeplest workaround will be, remove alredy existens elements by score:

c.Send("ZREMRANGEBYSCORE", metricKey, m.timestamp, m.timestamp)

Panic on reload

апр 12 00:26:16 vm-moira moira-cache[6466]: panic: runtime error: invalid memory address or nil pointer dereference
апр 12 00:26:16 vm-moira moira-cache[6466]: [signal 0xb code=0x1 addr=0x0 pc=0x51ad90]
апр 12 00:26:16 vm-moira moira-cache[6466]: goroutine 26 [running]:
апр 12 00:26:16 vm-moira moira-cache[6466]: github.com/moira-alert/cache/filter.findPart(0xc8200c9100, 0x3, 0x39, 0xc820142c20, 0x1, 0x1, 0x0, 0x0, 0x0, 0x533e23)
апр 12 00:26:16 vm-moira moira-cache[6466]: /opt/TeamCity/buildAgent/work/8f0b3fe99b08b4df/gocode/src/github.com/moira-alert/cache/filter/pattern.go:151 +0x450
апр 12 00:26:16 vm-moira moira-cache[6466]: github.com/moira-alert/cache/filter.(_PatternStorage).MatchPattern(0xc8200c00a8, 0xc8200c9100, 0x27, 0x39, 0x0, 0x0, 0x0)
апр 12 00:26:16 vm-moira moira-cache[6466]: /opt/TeamCity/buildAgent/work/8f0b3fe99b08b4df/gocode/src/github.com/moira-alert/cache/filter/pattern.go:124 +0x1c2
апр 12 00:26:16 vm-moira moira-cache[6466]: github.com/moira-alert/cache/filter.(_PatternStorage).ProcessIncomingMetric(0xc8200c00a8, 0xc8200c9100, 0x38, 0x39, 0x0)
апр 12 00:26:16 vm-moira moira-cache[6466]: /opt/TeamCity/buildAgent/work/8f0b3fe99b08b4df/gocode/src/github.com/moira-alert/cache/filter/metric.go:98 +0x7d0
апр 12 00:26:16 vm-moira moira-cache[6466]: main.handleConnection.func1(0xc820188000, 0xc8200c9100, 0x39, 0x39, 0xc82017a000)
апр 12 00:26:16 vm-moira moira-cache[6466]: /opt/TeamCity/buildAgent/work/8f0b3fe99b08b4df/gocode/src/github.com/moira-alert/cache/main.go:198 +0x6c
апр 12 00:26:16 vm-moira moira-cache[6466]: created by main.handleConnection
апр 12 00:26:16 vm-moira moira-cache[6466]: /opt/TeamCity/buildAgent/work/8f0b3fe99b08b4df/gocode/src/github.com/moira-alert/cache/main.go:201 +0x300

Crash if redis unavailable

Moira-cache crashed if redis unavailable

cache.log

pid:7034 15:22:47.180903 main.go:102: listening on :2003
pid:7034 15:22:47.182828 pattern.go:52: pattern refresh failed: dial tcp [::1]:6379: getsockopt: connection refused
pid:7034 15:22:48.183367 pattern.go:52: pattern refresh failed: dial tcp [::1]:6379: getsockopt: connection refused
pid:7034 15:22:49.184259 pattern.go:52: pattern refresh failed: dial tcp [::1]:6379: getsockopt: connection refused
pid:7034 15:22:50.184591 pattern.go:52: pattern refresh failed: dial tcp [::1]:6379: getsockopt: connection refused

journalctl -f moira-cache

May 13 15:22:47 moira-dev systemd[1]: Starting moira-cache - metric stream filtering and caching for Moira...
May 13 15:22:47 moira-dev systemd[1]: Started moira-cache - metric stream filtering and caching for Moira.
May 13 15:22:50 moira-dev cache[7034]: panic: runtime error: invalid memory address or nil pointer dereference
May 13 15:22:50 moira-dev cache[7034]: [signal 0xb code=0x1 addr=0x0 pc=0x51af90]
May 13 15:22:50 moira-dev cache[7034]: goroutine 27 [running]:
May 13 15:22:50 moira-dev cache[7034]: github.com/moira-alert/cache/filter.findPart(0xc820011c00, 0x6, 0x3d, 0xc820033c10, 0x1, 0x1, 0x0, 0x0, 0x0, 0x5340c3)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/filter/pattern.go:160 +0x450
May 13 15:22:50 moira-dev cache[7034]: github.com/moira-alert/cache/filter.(*PatternStorage).MatchPattern(0xc8200b12a0, 0xc820011c00, 0x2b, 0x3d, 0x0, 0x0, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/filter/pattern.go:133 +0x1c2
May 13 15:22:50 moira-dev cache[7034]: github.com/moira-alert/cache/filter.(*PatternStorage).ProcessIncomingMetric(0xc8200b12a0, 0xc820011c00, 0x3c, 0x3d, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/filter/metric.go:98 +0x80c
May 13 15:22:50 moira-dev cache[7034]: main.handleConnection.func1(0xc8200b18d0, 0xc820011c00, 0x3d, 0x3d, 0xc8200b25a0)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:200 +0x6c
May 13 15:22:50 moira-dev cache[7034]: created by main.handleConnection
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:203 +0x33c
May 13 15:22:50 moira-dev cache[7034]: goroutine 1 [chan receive]:
May 13 15:22:50 moira-dev cache[7034]: github.com/rcrowley/goagain.Wait(0x7f2ef2960d50, 0xc820020128, 0x7f2ef2960d50, 0x0, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/rcrowley/goagain/goagain.go:207 +0x41a
May 13 15:22:50 moira-dev cache[7034]: main.main()
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:117 +0x1390
May 13 15:22:50 moira-dev cache[7034]: goroutine 17 [syscall, locked to thread]:
May 13 15:22:50 moira-dev cache[7034]: runtime.goexit()
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/runtime/asm_amd64.s:1721 +0x1
May 13 15:22:50 moira-dev cache[7034]: goroutine 6 [syscall]:
May 13 15:22:50 moira-dev cache[7034]: os/signal.loop()
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/os/signal/signal_unix.go:22 +0x18
May 13 15:22:50 moira-dev cache[7034]: created by os/signal.init.1
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/os/signal/signal_unix.go:28 +0x37
May 13 15:22:50 moira-dev cache[7034]: goroutine 7 [chan receive]:
May 13 15:22:50 moira-dev cache[7034]: github.com/rcrowley/go-metrics.(*meterArbiter).tick(0x8252e0)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/rcrowley/go-metrics/meter.go:221 +0x4b
May 13 15:22:50 moira-dev cache[7034]: created by github.com/rcrowley/go-metrics.NewMeter
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/rcrowley/go-metrics/meter.go:40 +0x154
May 13 15:22:50 moira-dev cache[7034]: goroutine 8 [sleep]:
May 13 15:22:50 moira-dev cache[7034]: time.Sleep(0x3b9aca00)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/runtime/time.go:59 +0xf9
May 13 15:22:50 moira-dev cache[7034]: github.com/moira-alert/cache/filter.(*PatternStorage).Refresh(0xc8200b12a0, 0xc8200b1290)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/filter/pattern.go:55 +0x1b7
May 13 15:22:50 moira-dev cache[7034]: created by main.main
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:88 +0xe4f
May 13 15:22:50 moira-dev cache[7034]: goroutine 9 [chan receive]:
May 13 15:22:50 moira-dev cache[7034]: github.com/cyberdelia/go-metrics-graphite.GraphiteWithConfig(0xc8200d4150, 0x7f2ef295f358, 0xc82000e6f0, 0xdf8475800, 0x1, 0xc82000bb80, 0x12, 0xc8200d4450, 0x5, 0x5)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/cyberdelia/go-metrics-graphite/graphite.go:43 +0xbd
May 13 15:22:50 moira-dev cache[7034]: github.com/cyberdelia/go-metrics-graphite.Graphite(0x7f2ef295f358, 0xc82000e6f0, 0xdf8475800, 0xc82000bb80, 0x12, 0xc8200d4150)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/cyberdelia/go-metrics-graphite/graphite.go:37 +0x10e
May 13 15:22:50 moira-dev cache[7034]: created by main.main
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:92 +0xff1
May 13 15:22:50 moira-dev cache[7034]: goroutine 10 [IO wait]:
May 13 15:22:50 moira-dev cache[7034]: net.runtime_pollWait(0x7f2ef2960b80, 0x72, 0xc82000e1f0)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/runtime/netpoll.go:157 +0x60
May 13 15:22:50 moira-dev cache[7034]: net.(*pollDesc).Wait(0xc8200c81b0, 0x72, 0x0, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
May 13 15:22:50 moira-dev cache[7034]: net.(*pollDesc).WaitRead(0xc8200c81b0, 0x0, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
May 13 15:22:50 moira-dev cache[7034]: net.(*netFD).accept(0xc8200c8150, 0x0, 0x7f2ef2960e30, 0xc8200de200)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/net/fd_unix.go:408 +0x27c
May 13 15:22:50 moira-dev cache[7034]: net.(*TCPListener).AcceptTCP(0xc820020128, 0xc820031ef8, 0x0, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/net/tcpsock_posix.go:254 +0x4d
May 13 15:22:50 moira-dev cache[7034]: net.(*TCPListener).Accept(0xc820020128, 0x0, 0x0, 0x0, 0x0)
May 13 15:22:50 moira-dev cache[7034]: /usr/local/go/src/net/tcpsock_posix.go:264 +0x3d
May 13 15:22:50 moira-dev cache[7034]: main.serve(0x7f2ef2960d50, 0xc820020128, 0xc8200b1770)
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:167 +0x111
May 13 15:22:50 moira-dev cache[7034]: created by main.main
May 13 15:22:50 moira-dev cache[7034]: /vagrant/project/gocode/src/github.com/moira-alert/cache/main.go:104 +0x1372
May 13 15:22:50 moira-dev cache[7034]: goroutine 11 [select, locked to thread]:
May 13 15:22:50 moira-dev systemd[1]: moira-cache.service: main process exited, code=exited, status=2/INVALIDARGUMENT
May 13 15:22:50 moira-dev systemd[1]: Unit moira-cache.service entered failed state.
May 13 15:22:50 moira-dev systemd[1]: moira-cache.service failed.

crash because of no /etc/moira/cache/storage-schemas.conf

OracleEnterpriseLinux 7, via RPM

pid:15839 13:40:05.657611 main.go:76: error open retentions file /var/run/moira-cache.pid: open /etc/moira/cache/storage-schemas.conf: no such file or directory

The docs make no mention of what should be in this file.

Unable to get the metrics value

I try to use Moira,but I can not monit my metrics value by Moira.
there is nodata in Moira web. Can I find the metrics value in moira-cache ?
I'm not sure whether the carbon-c-relay has to transfer the data.

Do you have any other way ?

my carbon-c-relay config file:

cluster output file
/dev/stdout;
cluster moira
forward
moira-cache:2003;

cluster graphite
carbon_ch
graphite:2003;

match *
send to
moira
graphite;

Cache crashes when processing unprintable input data (eg tab character)

Some sort of out of bounds exception is thrown when sending unprintable data to the cache causing the service to panic and crash out.

Reproduction steps

echo -e "\n\t" | nc $CACHE_HOST 2003

Logs

panic: runtime error: slice bounds out of range

goroutine 10954 [running]:
github.com/moira-alert/cache/filter.(*PatternStorage).ProcessIncomingMetric(0xc8200240f8, 0xc8203cce60, 0x43, 0x45, 0x0)
    /moira/src/github.com/moira-alert/cache/filter/metric.go:36 +0xc77
main.handleConnection.func1(0xc8203cce60, 0x45, 0x45, 0xc8200e8120)
    /moira/src/github.com/moira-alert/cache/main.go:180 +0x41
created by main.handleConnection
    /moira/src/github.com/moira-alert/cache/main.go:183 +0x2c9

Quick link to offennding bit of code;
https://github.com/moira-alert/cache/blob/master/filter/metric.go#L35-L38

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.