如果我理解正确的话,Prometheus 支持两种创建带有可视化时间序列数据图表的仪表板的方法。一种方式使用 Grafana 及其仪表板,另一种方式使用 Prometheus 自己的 Web 前端及其 控制台模板。
在比较这两个选项时,是否可以假设使用 Grafana 的选项是最近的选项,目前受到更多关注,并且可能是在常见情况下和展望未来的更好方法?
我创建了一个简单的 Puppet 4 类和一个单元测试,如下(在执行touch metadata.json; rspec-puppet-initwhile in 之后modules/test/):
# modules/test/manifests/hello_world1.pp
class test::hello_world1 {
file { "/tmp/hello_world1":
content => "Hello, world!\n"
}
}
# modules/test/spec/classes/test__hello_world1_spec.rb
require 'spec_helper'
describe 'test::hello_world1' do
it { is_expected.to compile }
it { is_expected.to contain_file('/tmp/hello_world1')\
.with_content(/^Hello, world!$/) }
end
Run Code Online (Sandbox Code Playgroud)
我可以通过rspec spec/classes/test__hello_world1_spec.rb在modules/test/.
我现在想继续学习一个稍微高级一点的类,它使用另一个模块的代码,即concat(该模块已经安装在 中modules/concat):
# modules/test/manifests/hello_world2.pp
class test::hello_world2
{
concat{ "/tmp/hello_world2":
ensure => present,
}
concat::fragment{ "/tmp/hello_world2_01":
target => "/tmp/hello_world2",
content => "Hello, world!\n",
order => …Run Code Online (Sandbox Code Playgroud) 我想mymetricname{foo="bar"}在Prometheus 2.0.0-beta.2安装中删除时间序列的所有指标.
我目前从这个HTTP API调用中收到一条错误消息:
curl -X DELETE -g \
'http://localhost:9090/api/v1/series?match[]=mymetricname{foo="bar"}'
{"status":"error","errorType":"internal","error":"not implemented"}
Run Code Online (Sandbox Code Playgroud)
但是,作者的一份声明显然表明这种呼叫在很久以前就已成为可能(早在2015年).这里发生了什么?
更新此问题似乎不太可能是由于URL中的错误转义信件,因为以下工作正常:
curl -X GET -g \
'http://localhost:9090/api/v1/series?match[]=mymetricname{foo="bar"}'
{"status":"success","data":[<data>]}
Run Code Online (Sandbox Code Playgroud) 我想在端口8080而不是9090上安装Prometheus(它是正常的默认设置)。为此,我进行了编辑/etc/systemd/system/prometheus.service以包含以下行:
ExecStart=/usr/local/bin/prometheus \
--config.file=/etc/prometheus.yaml --web.enable-admin-api \
--web.listen-address=":8080"
Run Code Online (Sandbox Code Playgroud)
即,我正在使用选项--web.listen-address来指定非默认端口。
但是,当我使用Prometheus(2.0 beta)启动时,systemctl start prometheus收到以下错误消息:
parse external URL "": invalid external URL "http://<myhost>:8080\"/"
Run Code Online (Sandbox Code Playgroud)
那么,如何配置Prometheus,以便可以在http://<myhost>:8080/(而不是http://<myhost>:9090)访问其Web UI ?
prometheus ×3
grafana ×1
http ×1
port ×1
puppet ×1
rspec ×1
rspec-puppet ×1
systemd ×1
unit-testing ×1