' ' Nagios Plugn for reading, from Sophos DB, the infected client of your network ' It is intended to use with NSClient++ ' ' ' Author: Simone vola ' Email: simone.vola@gmail.com ' Created on: 2013-11-22 Dim rad,txt,dag,alert,status Set cnn = CreateObject("ADODB.Connection") Set Rs = CreateObject("ADODB.Recordset") cnn.ConnectionString = "driver={SQL Server};server=sqlistance;Trusted_Connection=Yes;database=sophos50" cnn.Open rs.ActiveConnection = cnn exitcode = 0 txt="" allert() rs.close If txt > "" Then txt = "Virus Found on Clients: \n" & txt & " | " else txt = "OK" exitcode=0 End If wscript.echo(txt) wscript.quit exitcode Function allert() Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 strsql = "select ComputerName,ThreatName from computerlistdata2 where ThreatInstanceID>0" rs.Open strsql , cnn,3,3 Do While Not rs.EOF rad = rs("ComputerName") & " : " & rs("ThreatName") & "\n" Set fso = CreateObject("Scripting.FileSystemObject") txt = txt + rad rs.MoveNext Loop exitcode = 2 Exit Function End Function