eventlog

check_eventlog

Checks the windows eventlog entries.

Basically, this check wraps this wmi query: SELECT ComputerName, LogFile, Category, EventCode, EventIdentifier, EventType, Message, SourceName, Type, TimeWritten, TimeGenerated FROM Win32_NTLogEvent

See https://learn.microsoft.com/en-us/previous-versions/windows/desktop/eventlogprov/win32-ntlogevent for a description of the provided fields.

Implementation

WindowsLinuxFreeBSDMacOSX

Examples

Default Check

check_eventlog
OK - Event log seems fine

Return all events, by default only unique events will be returned:

check_eventlog "detail-syntax=%(id) %(uniqueindex)" "unique-index=0"
WARNING - 4 message(s) warning(10010 Application-Microsoft-Windows-RestartManager-10010, 10016 System-Microsoft-Windows-DistributedCOM-10016, 6155 System-LsaSrv-6155, 6147 System-LsaSrv-6147)

Example using NRPE and Naemon

Naemon Config

define command{
    command_name         check_nrpe
    command_line         $USER1$/check_nrpe -H $HOSTADDRESS$ -n -c $ARG1$ -a $ARG2$
}

define service {
    host_name            testhost
    service_description  check_eventlog
    use                  generic-service
    check_command        check_nrpe!check_eventlog!filter=provider = 'Microsoft-Windows-Security-SPP' and id = 903 and message like 'foo'
}

Argument Defaults

ArgumentDefault Value
filterlevel in (‘warning’, ’error’, ‘critical’)
warninglevel = ‘warning’ or problem_count > 0
criticallevel in (’error’, ‘critical’)
empty-state0 (OK)
empty-syntax%(status) - No entries found
top-syntax%(status) - %(count) message(s) %(problem_list)
ok-syntax%(status) - Event log seems fine
detail-syntax%(file) %(source) (%(message))

Check Specific Arguments

ArgumentDescription
fileFile to read (can be specified multiple times to check multiple files)
logAlias for file
scan-rangeSets time range to scan for message (default is 24h)
timezoneSets the timezone for time metrics (default is local time)
truncate-messageMaximum length of message for each event log message text
uniqueAlias for unique-index
unique-indexCombination of fields that identifies unique events, set to 0 to disable. Default is “${log}-${source}-${id}”

Attributes

Filter Keywords

these can be used in filters and thresholds (along with the default attributes):

AttributeDescription
computerWhich computer generated the message (ComputerName)
fileThe logfile name
logAlias for file
idEventlog id (EventCode)
eventidentifierEvent identifier (EventIdentifier)
levelSeverity level (lowercase Type)
messageThe message as a string
sourceThe source system (SourceName)
providerAlias for source
writtenTime of the message being written( TimeWritten)