File tree 4 files changed +140
-5
lines changed
pluto/prometheus/exporters
4 files changed +140
-5
lines changed Original file line number Diff line number Diff line change 34
34
log_statement = "none" ;
35
35
36
36
# pgbadger-compatible logging
37
- log_transaction_sample_rate = 1.0e-2 ;
37
+ log_transaction_sample_rate = 0.01 ;
38
38
log_min_duration_statement = 5000 ;
39
39
log_checkpoints = "on" ;
40
40
log_connections = "on" ;
80
80
# benefit from frequent vacuums, so this should
81
81
# help. In particular, I'm thinking the jobsets
82
82
# pages.
83
- autovacuum_vacuum_scale_factor = 2.0e-2 ;
84
- autovacuum_analyze_scale_factor = 1.0e-2 ;
83
+ autovacuum_vacuum_scale_factor = 0.02 ;
84
+ autovacuum_analyze_scale_factor = 0.01 ;
85
85
86
86
shared_preload_libraries = "pg_stat_statements" ;
87
87
compute_query_id = "on" ;
Original file line number Diff line number Diff line change 1
- { config , ... } :
1
+ {
2
+ config ,
3
+ lib ,
4
+ pkgs ,
5
+ ...
6
+ } :
2
7
8
+ let
9
+ bannedUserAgentPatterns = [
10
+ "Trident/"
11
+ "Android\\ s[123456789]\\ ."
12
+ "iPod"
13
+ "iPad\\ sOS\\ s"
14
+ "iPhone\\ sOS\\ s[23456789]"
15
+ "Opera/[89]"
16
+ "(Chrome|CriOS)/(\\ d\\ d?\\ .|1[01]|12[4])"
17
+ "(Firefox|FxiOS)/(\\ d\\ d?\\ .|1[01]|12[012345679]\\ .)"
18
+ "PPC\\ sMac\\ sOS"
19
+ "Windows\\ sCE"
20
+ "Windows\\ s95"
21
+ "Windows\\ s98"
22
+ "Windows\\ sNT\\ s[12345]\\ ."
23
+ ] ;
24
+ in
3
25
{
4
26
networking . firewall . allowedTCPPorts = [
5
27
80
27
49
worker_connections 1024;
28
50
'' ;
29
51
52
+ appendHttpConfig = ''
53
+ map $http_user_agent $badagent {
54
+ default 0;
55
+ ${ lib . concatMapStringsSep "\n " ( pattern : ''
56
+ ~${ pattern } 1;
57
+ '' ) bannedUserAgentPatterns }
58
+ }
59
+ '' ;
60
+
30
61
virtualHosts . "hydra.nixos.org" = {
31
62
forceSSL = true ;
32
63
enableACME = true ;
33
64
34
65
extraConfig = ''
66
+ error_page 502 /502.html;
35
67
error_page 503 /503.html;
36
- location = / 503.html {
68
+ location ~ /(502| 503) .html {
37
69
root ${ ./nginx-error-pages } ;
38
70
internal;
39
71
}
40
72
'' ;
41
73
74
+ # Ask robots not to scrape hydra, it has various expensive endpoints
75
+ locations . "=/robots.txt" . alias = pkgs . writeText "hydra.nixos.org-robots.txt" ''
76
+ User-agent: *
77
+ Disallow: /
78
+ Allow: /$
79
+ '' ;
80
+
42
81
locations . "/" = {
43
82
proxyPass = "http://127.0.0.1:3000" ;
83
+ extraConfig = ''
84
+ if ($badagent) {
85
+ access_log /var/log/nginx/abuse.log;
86
+ return 403;
87
+ }
88
+ '' ;
44
89
} ;
45
90
46
91
locations . "/static/" = {
Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html>
2
+ < html lang ="en ">
3
+ < head >
4
+ < title > Error 502 - hydra.nixos.org</ title >
5
+ < meta http-equiv ="Content-Type " content ="text/html; charset=utf-8 " />
6
+ < meta http-equiv ="X-UA-Compatible " content ="IE=Edge " />
7
+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
8
+ < link
9
+ rel ="stylesheet "
10
+ href ="https://nixos.org/bootstrap/css/bootstrap.min.css "
11
+ />
12
+ < link
13
+ rel ="stylesheet "
14
+ href ="https://nixos.org/bootstrap/css/bootstrap-responsive.min.css "
15
+ />
16
+ < style >
17
+ body {
18
+ padding-top : 0 ;
19
+ margin-top : 4em ;
20
+ margin-bottom : 4em ;
21
+ }
22
+ body > div {
23
+ max-width : 800px ;
24
+ }
25
+ h1 {
26
+ margin : 0 auto;
27
+ text-align : center;
28
+ }
29
+ p {
30
+ text-align : center;
31
+ }
32
+ </ style >
33
+ </ head >
34
+ < body >
35
+ < div class ="container jumbotron ">
36
+ < div class ="jumbotron ">
37
+ < p class ="lead ">
38
+ < a href ="https://nixos.org/nixos ">
39
+ < img
40
+ src ="https://nixos.org/logo/nixos-hires.png "
41
+ width ="500px "
42
+ alt ="logo "
43
+ />
44
+ </ a >
45
+ </ p >
46
+
47
+ < h1 > HTTP Error 502</ h1 >
48
+
49
+ < p class ="lead "> This service is currently unavailable!</ p >
50
+ </ div >
51
+ < hr >
52
+ < div class ="help ">
53
+ < p >
54
+ You can check the following resources for further informations:< br >
55
+ < a href ="https://prometheus.nixos.org/alerts "> Alerts</ a > |
56
+ < a href ="https://grafana.nixos.org/ "> Dashboards</ a > |
57
+ < a href ="https://github.com/NixOS/infra/issues "> Issues</ a > |
58
+ < a href ="https://matrix.to/#/#infra:nixos.org "> Chatroom</ a >
59
+ </ p >
60
+ </ div >
61
+ </ div >
62
+ </ body >
63
+ </ html >
Original file line number Diff line number Diff line change
1
+ {
2
+ pkgs ,
3
+ ...
4
+ } :
1
5
{
2
6
services . prometheus = {
3
7
scrapeConfigs = [
14
18
] ;
15
19
}
16
20
] ;
21
+ ruleFiles = [
22
+ ( pkgs . writeText "node-exporter.rules" (
23
+ builtins . toJSON {
24
+ groups = [
25
+ {
26
+ name = "zfs" ;
27
+ rules = [
28
+ {
29
+ alert = "ZfsPoolFull" ;
30
+ expr = ''
31
+ (zfs_pool_free_bytes / zfs_pool_size_bytes) * 100 < 15
32
+ '' ;
33
+ for = "30m" ;
34
+ labels . severity = "warning" ;
35
+ annotations . summary = "ZFS pool {{ $labels.pool }} on {{ $labels.instance }} has only {{ $value }}% free space." ;
36
+ annotations . grafana = "https://grafana.nixos.org/d/rYdddlPWk/node-exporter-full?orgId=1&var-job=node&var-node={{ $labels.instance }}" ;
37
+ }
38
+ ] ;
39
+ }
40
+ ] ;
41
+ }
42
+ ) )
43
+ ] ;
17
44
} ;
18
45
}
You can’t perform that action at this time.
0 commit comments