@@ -99,7 +99,7 @@ Press the Data Explorer in the menu and select the nginx measurement and create
## KPI triggers
In this demonstrator an example KPI rule has been set up in Kapacitor which fires when the average requests per second on the Apache 1 or Apache2 server goes above certain thresholds ( a 'warning' at 0.2 requests/second and a 'critical' message at 0.5 requests/second ). The TICKscript specification for this rule is as follows:
In this demonstrator an example KPI rule has been set up in Kapacitor which fires when the average number of active connections per 5 seconds on the Nginx 1 or Nginx 2 server goes above certain thresholds ( a 'warning' at 10 connections/5 seconds ). The TICKscript specification for this rule is as follows:
This test case generates some streaming requests to the server to ensure an alert is triggered and then tests the log file for this alert. Different logs can be tested by
appending to the list of parameters in the pytest decorator
appending to the list of parameters in the pytest decorator.
Format for pytest parameters under test:
([filename], [log])
where [filename] is the name of the json file for the rule under test (must be in the same folder as this test is)
[log] is the absolute path of the log file that must be created due to an alert
:param rule: the name of the rule json file
:param log: the path of the log file that is under test
:param streaming_url: the fixture providing the streaming url for this test case
:param streaming_manifest: the fixture providing the root of the XML streaming manifest
"""
kapacitor_setter=self.kapacitor_setting(rule)
next(kapacitor_setter)# Setup the test rule
try:
ifisfile(log):
remove(log)# delete log file if existing from previous tests
...
...
@@ -57,6 +71,30 @@ class TestStreamingAlerts(object):