Giter VIP home page Giter VIP logo

Comments (7)

tuxmea avatar tuxmea commented on July 29, 2024

Many thanks for the report. Can you check that the promtool check command works without errors on the new alert file?
I want to verify whether it is the promtool command or the alert file which causes the error.

from puppet-prometheus.

gangsta avatar gangsta commented on July 29, 2024

Hi @tuxmea ,

After getting above described error, I did ssh to vagrant box and added some simple alert.rules file to check promtool command . below copy of terminal .

[root@prometheus ~]# prometheus --version
prometheus, version 2.0.0 (branch: HEAD, revision: 0a74f98628a0463dddc90528220c94de5032d1a0)
  build user:       root@615b82cb36b6
  build date:       20171108-07:11:59
  go version:       go1.9.2
[root@prometheus ~]# cat /etc/prometheus/alert.rules 
groups:
- name: example
  rules:
  - alert: HighErrorRate
    expr: job:request_latency_seconds:mean5m{job="myjob"} > 0.5
    for: 10m
    labels:
      severity: page
    annotations:
      summary: High request latency
[root@prometheus ~]# /usr/local/bin/promtool check rules /etc/prometheus/alert.rules
Checking /etc/prometheus/alert.rules
  SUCCESS: 1 rules found

[root@prometheus ~]# echo $?
0
[root@prometheus ~]# 

BR
Karen

from puppet-prometheus.

gangsta avatar gangsta commented on July 29, 2024

definitely something wrong with alert.rules files . including '::prometheus' should work out of box . I`m wondering that something is wrong here

from puppet-prometheus.

gangsta avatar gangsta commented on July 29, 2024

content => $alerts.to_yaml, I think here converting is not working or we are providing wrong hash . but by default alert.rules is empty . if it`s empty?, validation should giving error .

from puppet-prometheus.

gangsta avatar gangsta commented on July 29, 2024

Found issue . As Far as alert.rule has no default value Validation of empty yaml file is giving above error . so either we should add some default alert.rules to module to get include ::prometheus working out of box , or we should add in Readme that without alertrules your going to get error . I`ll do in minutes pull to Readme file to add Hash to alert.rule >= prometheus2.0.0

from puppet-prometheus.

costela avatar costela commented on July 29, 2024

Empty hashes seem to work, while empty arrays don't:

$ ruby -e "require 'yaml'; puts {}.to_yaml" | promtool check rules /dev/stdin
Checking /dev/stdin
  SUCCESS: 0 rules found

$ ruby -e "require 'yaml'; puts [].to_yaml" | promtool check rules /dev/stdin
Checking /dev/stdin
  FAILED:
yaml: unmarshal errors:
  line 1: cannot unmarshal !!seq into rulefmt.RuleGroups

So we can just change the default to {}. People using 1.* and not providing alert rules would still get a noop, while those providing rules would see no change, since they would override the default.

from puppet-prometheus.

gangsta avatar gangsta commented on July 29, 2024

Hi @costela ,
Thats a good one , it will solve include ::prometheus without any param , otherwise we should define some alert rules , From me +
Greetings

from puppet-prometheus.

Related Issues (20)

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.