早上好。
过去几天我一直在使用bosun监控应用程序,我非常喜欢它。但我需要一件事我无法解决。
我希望得到1个警报,根据时间的不同,响应会有所不同。因此,白天每小时登录我的网站的数量需要为100,而夜间需要为10.当它低于我想要创建警报时。
如果我使用2个警报执行此操作,则白天警报将在晚上发出警报。所以我需要进行查找,检查它的时间,然后给出正确的阈值。
任何人都知道如何做到这一点。
Marcel Koert
答案 0 :(得分:5)
Bosun没有此功能。我考虑过了,但我从来没有被证明是必要的用例。为什么呢?
我考虑过两个一般情况:
为了处理这种情况,我们使用异常警报。这实际上说的是“这不是过去几周一周中同一时间的情况,发出警报”。关键功能是band功能。以下是从examples page执行此操作的示例:
alert slower.route.performance {
template = route.performance
$notes = Response time is based on HAProxy's Tr Value. This is the web server response time (time elapsed between the moment the TCP connection was established to the web server and the moment it send its complete response header
$duration = "1d"
$route=*
$metric = "sum:10m-avg:haproxy.logs.route_tr_median{route=$route}"
$route_hit_metric = "sum:10m-avg:rate{counter,,1}:haproxy.logs.hits_by_route{route=$route}"
$total_hit_metric = "sum:10m-avg:rate{counter,,1}:haproxy.logs.hits_by_route"
$route_hits = change($route_hit_metric, $duration, "")
$total_hits = change($total_hit_metric, $duration, "")
$hit_percent = $route_hits / $total_hits * 100
$current_hitcount = len(q($metric, $duration, ""))
$period = "7d"
$lookback = 4
$history = band($metric, $duration, $period, $lookback)
$past_dev = dev($history)
$past_median = percentile($history, .5)
$current_median = percentile(q($metric, $duration, ""), .5)
$diff = $current_median - $past_median
warn = $current_median > ($past_median + $past_dev*2) && abs($diff) > 10 && $hit_percent > 1
warnNotification = default
ignoreUnknown = true
}
希望这条路可以解决您的警报需求吗?
答案 1 :(得分:2)
使用<form id="names" >
<fieldset>
<legend>Personal information:</legend>
First name:<br>
<input type="text" name="firstname" placeholder="Mickey"><br>
Last name:<br>
<input type="text" name="lastname" placeholder="Mouse"><br>
Car Type:<br>
<select id="CarList" onChange="showDiv(this)">
<option value="none">Choose a Car..</option>
<option value="Toyota">Toyota</option>
<option value="Volvo">Volvo</option>
<option value="Audi">Audi</option>
</select>
Color <input type="color" name="favcolor" value="#ff0000"><br>
Date:<input type="date" name="bday" max="1999-1-1"><br><br>
<p class="totalPrice booktxt" id="dispcoin" style="display: none;">Total Price For the Renting 50BHD/Week<br> </p>
<div id="hidden_div" style="display: none;"><img src="images/6.jpg"/></div>
<div id="hidden_div2" style="display: none;"><img src="images/1.jpg"/></div>
<div id="hidden_div3" style="display: none;"><img src="images/9.jpg"/></div>
<form class="price">
<input onclick="calculateTotal(0) " type="checkbox" class="ful">With Fuel<br>
<input onclick="calculateTotal(0) " type="checkbox" class="pol">Polishing 2 weeks<br>
<input onclick="calculateTotal(0) " type="checkbox" class="drv">Driver<br>
</form>
<input id="butn" type="button" style="display: none;" value="Submit" onClick="validateForm(), myFunction(this), showDiv(this)">
</fieldset>
</form>
功能,您可以确定它的时间。只需每天86400秒修改epoch()
即可获得当天的第二个相对值。将其与您希望窗口开始和结束的UTC时间的开始和结束时间进行比较。
如果评估警报的时间是在UTC时间08:00和03:00之间,则此宏将$ during_business_hours设置为true。
epoch()