-
Notifications
You must be signed in to change notification settings - Fork 814
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[wmi] adding test for win32 event log.
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
EventCode 0 | ||
EventIdentifier 0 | ||
EventType 0 | ||
InsertionStrings [insertionstring] | ||
Logfile Application | ||
Message SomeMessage | ||
SourceName MSQLSERVER | ||
TimeGenerated 20151224113047.000000-480 | ||
This comment has been minimized.
Sorry, something went wrong. |
||
User FooUser | ||
Type Error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# project | ||
from tests.core.test_wmi import TestCommonWMI | ||
from tests.checks.common import AgentCheckTest | ||
|
||
|
||
class W32LogEventTestCase(AgentCheckTest, TestCommonWMI): | ||
CHECK_NAME = 'win32_event_log' | ||
|
||
WIN_LOGEVENT_CONFIG = { | ||
'host': ".", | ||
'tags': ["mytag1", "mytag2"], | ||
'sites': ["Default_Web_Site", "Failing site"], | ||
'logfile': ["Application"], | ||
'type': ["Error", "Warning"], | ||
'source_name': ["MSSQLSERVER"] | ||
} | ||
|
||
def test_check(self): | ||
""" | ||
Returns the right metrics and service checks | ||
""" | ||
# Run check | ||
config = { | ||
'instances': [self.WIN_LOGEVENT_CONFIG] | ||
} | ||
|
||
self.run_check_twice(config) | ||
|
||
# TODO: Test for events | ||
self.assertEvent('SomeMessage', count=1, | ||
tags=self.WIN_LOGEVENT_CONFIG['tags'], | ||
msg_title='Application/MSQLSERVER', | ||
event_type='win32_log_event', alert_type='error', | ||
source_type_name='event viewer') | ||
|
||
self.coverage_report() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Will the test stop working after 🎅 🎄 ? 😛