Jump to content
Sign in to follow this  
Dave The Ape

Creating Monitors via Script

Recommended Posts

Hello World!

I want to build a Script which creates a Monitor to watch the Connectionstate of a myUTN Device.

I used the "Agent Monitor Creation - Disk*" Script as template.

The heart of the Monitor Creation Process is the following SQL-Query:

INSERT INTO `agents` (`Name`, `LocID`, `ClientID`, `ComputerID`, `DriveID`, `CheckAction`, `AlertAction`, `AlertMessage`, `ContactID`, `interval`, `Where`, `What`, `DataOut`, `Comparor`, `DataIn`, `LastScan`, `LastFailed`, `FailCount`, `IDField`, `AlertStyle`, `Changed`, `Last_Date`, `Last_User`, `ReportCategory`, `TicketCategory`) VALUES('@aname@','0','0','%computerid%','1','6','67','SEH UTN Port @Port@ at @UTN_IP@ - %COMPUTERNAME%~~~%NAME% %STATUS% on %CLIENTNAME%\\%COMPUTERNAME% at %LOCATIONNAME% for %FIELDNAME% result %RESULT %.!!!SEH UTN Port @Port@ at @UTN_IP@ - %COMPUTERNAME%~~~%NAME% %STATUS% on %CLIENTNAME%\\%COMPUTERNAME% at %LOCATIONNAME% for %FIELDNAME% result %RESULT%.','0','300','127.0.0.1','7','\"@ProgramFilesPath@\\SEH Computertechnik GmbH\\SEH UTN Manager\\utnm.exe\" /c \"state @UTN_IP@ @Port@\" /mr /nw','1','Device state = \"Activated\" (@Port@)','','','0','0','0','-1','2019-09-20 13:48:24','root@localhost','0','0')

The monitor is created "successfully" on my client, but is doesnt check...

monitors8a365844e1dbf026.png

The monitor named "test" is a monitor i created by hand and it works.

I checked the SQL datasets in the agents table from the database and the entrys (for test and the created monitor) are exact the same (excluded names and stuff).

When I compare the Edit-Tab of both monitors I get this: (left the monitor i created by hand, right the monitor created by the script)

monitorcomparef1c25996878a3022.png

When i push "Test" on the monitor created from the script it is testing as expected, but nothing changes in the monitor status.

 

What am i doing wrong?

Why wont it check automaticly/check at all?

Thanks

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...