NSClient++ Help (#1) - confused Problem with vbs (#167) - Message List

confused Problem with vbs

Hi I used Nagios 3.02 with nrpe and the newest Version of nscp. I have a Problem with nscp and an vb script. If I run nscp in test mode all worked fine. If i run in normal mode its doesent work.

This is my nsc.ini

check_DBBank=cscript.exe T:30 NoLogo scripts\check_DBBank.vbs

This is my check_DBBank.vbs

On Error Resume Next

set db = createobject ("ADODB.connection")

dim LastDate?

db.open "DRIVER={SQL SERVER};SERVER=XXX;DATABASE=XXX"

sql = "SELECT SN_XXX, XXXKenn, AnkuDatu? " _

& "FROM XXX " _ & "WHERE (XXXKenn = 'Bank') " _ & "ORDER BY AnkuDatu? DESC"

set rs = db.Execute(sql)

LastDate? = rs("AnkuDatu?")

db.close

if DateDiff?("d", LastDate?, date) > 3 then

Wscript.StdOut?.WriteLine? "Eintrge lter als 3 Tage!"

WScript.Quit(2)

End if

if DateDiff?("d", LastDate?, date) > 0 then

Wscript.StdOut?.WriteLine? "Eintrge lter als 1 Tag(e)!"

WScript.Quit(1)

else

Wscript.StdOut?.WriteLine? "Eintrge von Heute vorhanden!"

WScript.Quit(0)

End If

Wscript.StdOut?.WriteLine? "Wert nicht ermittelbar!"

WScript.Quit(3)


In test mode he quits with 0 or 1! This is Correct! If I run the vbs himselve he quits also with 0 or 1. But if I run nscp in normal mode it allways quits with 2! I don't know why and hope anybody can help me!

thanks

  • Message #468

    Just a quick thought: Does the user that runs the NSClient++ service have the same "setup" as your user? Since you are calling a database and such I am guessing you need the datasource setup and such? Also how do you login to the datasource with a dedicated login or the "windows magic login thingy"? (again check users).

    But this is as I said just a though... (when you run in test mode you run as "you" when you run as a service you run as "someone else")

    MickeM

    • Message #469

      Thanks you are great, I don't know why but I don't check this. Know its Work fine!

Subscriptions