Kaseya Community

Monitor changes made to a custom field

  • Greetings from the state of hockey!!

    I've written a script that gathers information from a txt file and puts it in a custom field. 

    My end goal: I need to monitor (and generate an alarm) if what is in the CF changes. Currently, it shows the windows firewall profile type (Domain, Home, Public, Work) and I need to know if that changes. I'm able to get the custom field populated, but not sure how to monitor if that changes, and generate an alarm.

    Any insight?

  • Don't use a custom field. Just leave the text file on the agent, and use monitor - agent monitoring - alerts - Get files function.

    See help.kaseya.com/.../index.asp for more info.

    edit: probably not an ideal solution, however it's the easiest solution without resorting to third party trickery outside of the VSA.

    The only other way is to use two custom fields - store the "normal" result in one, the "current" result in the other. Compare the two and if not identical, trigger the alarm. Do this within the procedure that refreshed the "current" result. From memory, clearing alarms in scripts is difficult, so this may or may not be practical either.

    [edited by: Craig Hart at 5:20 PM (GMT -8) on Jan 6, 2016]
  • I would build in to the script something like this.

    Get variable from custom field

    Run current script steps

    Compare variable 1 and variable 2.

    Create alert if variable 1 is not equal to variable 2

    Write new variable to custom field.

  • What command/function do I actually use to compare? That's where I'm spinning my wheels. Even if I have both items in custom fields, I still have no idea on how to compare them.

  • How do you get a variable from a custom field?

  • Run script steps and get var1

    If checkVar #vSystemInfoManual.[Custom Field Name Here]# is equal to #var1#

  • GDRBrian
    If checkVar #vSystemInfoManual.[Custom Field Name Here]# is equal to #var1#

    Just be aware that #vSystemInfoManual.variableName# does not like spaces in the name of the Machine Custom Field, at least in my experience.

    All of my Machine Custom Fields are named with underscores_between_the_words.

    I'm not sure if this is strictly presently necessary; however, if #vSystemInfoManual.Field With Spaces# doesn't work, you can try renaming the field to Field_With_Spaces and reference it as #vSystemInfoManual.Field_With_Spaces# and see if that chooches.

  • Well, I ended up making it work (after finding an error or two of my own doing) and it seems to be working great now. Thanks everyone for all the help!!

  • I've been following this, but can't seem to read the CF at all.  The CF is named TEST, and I can populate it with whatever data I want, however when I attempt to read the data into a variable all I get is "Failed THEN in step 1".  The procedure is only 2 lines long!  I've also tried in the past to enclose in [ ] as some posts elsewhere recommend, however they also fail.

    I didn't think it should be so hard?

    Any help would be appreciated...

    <ScriptExport><Procedure name="TestReadingVar" treePres="3" id="1611184389" folderId="746239731249513" treeFullPath="myProcedures - Daniel.Aldam"><Body description=""><Statement name="SendMessage" continueOnFail="false" osType="None"><Parameter xsi:type="StringParameter" name="Message" value="TESTING"/><Parameter xsi:type="BooleanParameter" name="Immediate" value="True"/></Statement><Statement name="GetVariable" continueOnFail="false"><Parameter xsi:type="EnumParameter" name="VariableType" value="SQLView"/><Parameter xsi:type="StringParameter" name="SourceContent" value="#vSystemInfoManual.Manufacturer#"/><Parameter xsi:type="StringParameter" name="VariableName" value="OUTPUT"/></Statement><Statement name="SendMessage" continueOnFail="false"><Parameter xsi:type="StringParameter" name="Message" value="#OUTPUT#"/><Parameter xsi:type="BooleanParameter" name="Immediate" value="True"/></Statement><Statement name="SendEmail" continueOnFail="false"><Parameter xsi:type="StringParameter" name="To" value="daniel.aldam@eyeTSystems.com.au"/><Parameter xsi:type="StringParameter" name="Subject" value="#OUTPUT#"/><Parameter xsi:type="MultiLineStringParameter" name="Body" value="#OUTPUT#"/></Statement></Body></Procedure></ScriptExport>