Kaseya Community

Monitor a service running or not ONLY if user logged on

  • I am trying to figure out a way to monitor that a service is running on all my workstations ONLY if a user is logged on. Inmy situation I havea service I want to monotor. Itonly starts and should stay running if a user is logged on the PC. When the user logs off the service stops. When I setup a monitor set to watch that service I get alerts when users log off because I can not find any way to ignore that the service is not running because nobody is logged on the PC. I ONLY want to know if a user is loged on aPC and the service stops, another script I have writen then tries to start that service again and FAILS, then I want an alert. Any ideas? It would be great if there was an IF THEN options in the monitor sets like there is in the scripts.

    Legacy Forum Name: Monitor a service running or not ONLY if user logged on,
    Legacy Posted By Username: Todd Williams
  • Here is a set of scripts that will do that. The first script will check if the user is logged in then execute a second script if they are or reschedule its self for 1 hour if they not logged in. The second script will test if the service you want to monitor is running anf then either email you and day its running or email and say it is not running. Then it reschedules the whole process again for 2 hours. You can modify the second script to only report if it not running.

    Script Name: test2
    Script Description:

    IF User Is Logged In
    Parameter 1 :
    THEN
    Execute Script
    Parameter 1 :test3(NOTE: Script reference is NOT imported. Correct manually in script editor.
    Parameter 2 :
    Parameter 3 : 0
    OS Type : 0
    ELSE
    Schedule Script
    Parameter 1 : 85971452
    Parameter 2 : 60
    Parameter 3 :
    OS Type : 0

    ------------------------

    Script Name: test3
    Script Description:

    IF Service is Running
    Parameter 1 : wzcsvc
    THEN
    Send Email
    Parameter 1 : test@test.com
    Parameter 2 : service running
    Parameter 3 :
    OS Type : 0
    Schedule Script
    Parameter 1 : 85971452
    Parameter 2 : 120
    Parameter 3 :
    OS Type : 0
    ELSE
    Send Email
    Parameter 1 : test@test.com
    Parameter 2 : service not running
    Parameter 3 :
    OS Type : 0
    Schedule Script
    Parameter 1 : 85971452
    Parameter 2 : 120
    Parameter 3 :
    OS Type : 0



    God Bless,

    Marty




    Legacy Forum Name: Monitor/Event Sets/SNMP Sets,
    Legacy Posted By Username: MissingLink