Display unused computers from SCCM adsysdis.log into zabbix

This is based on SCCM system discovery component SMS_AD_SYSTEM_DISCOVERY_AGENT.
This component keeps log file in:
c:\Program Files\Microsoft Configuration Manager\Logs\adsysdis.log
The string which we are interested looks something like:
ERROR: Machine COMPUTERNAME is offline or invalid..
To implement the rule at first you need to add cat, grep, sed, tail support to windows operating %path% variable. I usualy keep these all libraries in c:\gnu:
Now i add new UserParameter object in C:\Program Files\Zabbix Agent\zabbix_agentd.conf
EnableRemoteCommands=1 
UserParameter=MachineIsInvalid,if exist "C:\Program Files\Microsoft Configuration Manager\Logs\adsysdis.log" cat "C:\Program Files\Microsoft Configuration Manager\Logs\adsysdis.log" | grep -e "is offline or invalid" | sed "s/^.*Machine/Machine/g;s/invalid.*/invalid/g;s/\d039//g" | tail -1
Create new item in zabbix:
Name: MachineIsInvalid
Type: Zabbix Agent
Key: MachineIsInvalid
Host interface: IP: 10050
Type of information: Text
Create trigger:
Name: {ITEM.LASTVALUE}
Expression: {computername:MachineIsInvalid.regexp(invalid)}=1

No comments: