bosun.org@v0.0.0-20210513094433-e25bc3e69a1f/cmd/bosun/conf/rule/test.conf (about) 1 squelch = k=v,k2=v2 2 squelch = a=b,k=c 3 squelch = pxname=_dev|^dev$|-dev 4 5 template generic { 6 body = `Alert definition: 7 8 <p>Name: {{.Alert.Name}} 9 <p>Crit: {{.Alert.Crit}} 10 11 <p>Tags 12 13 <table> 14 {{range $k, $v := .Group}} 15 <tr><td>{{$k}}</td><td>{{$v}}</td></tr> 16 {{end}} 17 </table> 18 19 <p>Computation 20 21 <table> 22 {{range .Computations}} 23 <tr><td>{{.Text}}</td><td>{{.Value}}</td></tr> 24 {{end}} 25 </table> 26 27 <p><a href="{{.Ack}}">Acknowledge alert</a>` 28 29 subject = {{.Last.Status}}: {{.Alert.Name}}: {{.E .Alert.Vars.q}} on {{.Group.host}} 30 } 31 32 notification default { 33 print = true 34 email = mjibson@stackoverflow.com 35 } 36 37 $default_time = "2m" 38 39 macro mm { 40 $t = $u hi 41 $w = 80 42 warnNotification = default 43 } 44 45 macro m2 { 46 $u = yes 47 macro = mm 48 $c = 90 49 } 50 51 alert os.high_cpu { 52 template = generic 53 $q = avg(q("avg:rate:os.cpu{host=ny-nexpose01}", $default_time, "")) 54 macro = m2 55 warn = $q > $w 56 crit = $q >= $c 57 critNotification = default 58 } 59 60 macro t { 61 crit = avg(q("avg:a", "", "")) > $v 62 } 63 64 alert m { 65 $v = 1 66 macro = t 67 } 68 69 alert braceTest { 70 $h = t=m 71 crit = avg(q("avg:o{$h}", "", "")) > ${env.env} 72 warn = avg(q("avg:o{$h}", "", "")) > $env.env 73 } 74 75 macro macroBraceTest { 76 crit = avg(q("avg:o{${braceVar}m}", "", "")) > 1 77 } 78 79 alert macroBraceTest { 80 $braceVar = t= 81 macro = macroBraceTest 82 } 83 84 lookup l { 85 entry port=1 { 86 t = v 87 } 88 entry port=* { 89 k = 1 90 } 91 } 92 93 lookup l2 { 94 entry port=2,host=* { 95 v = 3 96 } 97 entry port=4,host=ny-web|ny-db { 98 t = k 99 } 100 } 101 102 lookup l3 { 103 entry host=one,disk=/data { 104 r = 4 105 } 106 } 107 108 # notification lookups 109 110 notification nc1 { 111 print = true 112 } 113 114 notification nc2 { 115 print = true 116 } 117 118 notification nc3 { 119 print = true 120 } 121 122 notification nc4 { 123 print = true 124 } 125 126 lookup nc { 127 entry host=ny-* { 128 v = nc1 129 } 130 entry host=nyhq-* { 131 v = nc2 132 } 133 entry host=* { 134 v = nc1,nc3 135 } 136 } 137 138 alert nc { 139 crit = 1 140 critNotification = default,nc4 141 critNotification = lookup("nc", "v") 142 template = generic 143 } 144 145 # macros with variables and duplicates 146 147 macro macroVarMacro { 148 $a = 3 149 critNotification = default,nc3 150 critNotification = nc4 151 template = generic 152 } 153 154 alert macroVarAlert { 155 macro = macroVarMacro 156 critNotification = nc1 157 critNotification = nc2 158 crit = $a 159 }