Jump to content
LoneWolf

Modify "Agent Monitor Creation - Disk" script to only build C: drive monitor?

Recommended Posts

My Labtech abilities sadly end right around the spot where the MySQL parts begin beyond some very basic queries, so I'm coming to all of you for help.

 

I have a problem with a number of DVR devices on our clients. These devices are designed to fill their disks (other than the C: drive, and they can have multiple drive letters from D-Z:) with recorded video, which continues to set off our disk space monitors. No problem, just set up new internal monitoring for them and delete the remote monitors for disks other than C:, right? Wrong. LabTech's Agent Maintenance script runs a disk monitor creation script every night that rebuilds those monitors, making this useless for those systems, and adding tons of noise tickets a week.

 

So, it appears I need to create a new service plan, which I have. I have copied the Agent Maintenance script and Agent Monitor Creation Scripts, and re-linked together what is needed, but I need to modify the default "Agent Monitor Creation - Disk" script to only add the C: drive (it can continue to remove any other monitors). This way, no monitors are added for Disk Free Space except for Drive C:, eliminating the tickets.

 

Is it possible that someone can assist or give me pointers? Here's a screenshot of my copy script (still default)

 

 

 

And all of you have a copy of the default "Agent Monitor Creation - Disk" script in the _System Automation -> Agent Maintenance folder already. Thanks in advance for any assistance you can provide.

Script_Screenshot.PNG.65ed19b226a390a8a45f91a3f77402b1.PNG

Share this post


Link to post
Share on other sites
So, it appears I need to create a new service plan, which I have. I have copied the Agent Maintenance script and Agent Monitor Creation Scripts, and re-linked together what is needed, but I need to modify the default "Agent Monitor Creation - Disk" script to only add the C: drive (it can continue to remove any other monitors). This way, no monitors are added for Disk Free Space except for Drive C:, eliminating the tickets.

Adjust line 21. In my script, the value currently is:

SELECT c.computerid AS computerid,c.name AS name,d.driveid AS driveid,d.letter as letter,d.size AS size,d.free as free,((d.free/d.size)*100) AS percent,d.filesystem as filesystem,d.volumename AS volumename,d.missing as missing FROM drives AS d INNER JOIN computers AS c ON d.computerid=c.computerid WHERE d.FileSystem not in ('CDFS','UKNFS','DVDFS','FAT','FAT32','NetFS') AND d.size > @MinSizeMB@ AND d.model not like '%usb%' AND d.model not like '%IEEE%' AND d.missing=0 AND c.computerid=@computerid@

Change this to

SELECT c.computerid AS computerid,c.name AS name,d.driveid AS driveid,d.letter as letter,d.size AS size,d.free as free,((d.free/d.size)*100) AS percent,d.filesystem as filesystem,d.volumename AS volumename,d.missing as missing FROM drives AS d INNER JOIN computers AS c ON d.computerid=c.computerid WHERE d.letter IN ('C') AND d.FileSystem not in ('CDFS','UKNFS','DVDFS','FAT','FAT32','NetFS') AND d.size > @MinSizeMB@ AND d.model not like '%usb%' AND d.model not like '%IEEE%' AND d.missing=0 AND c.computerid=@computerid@

It is just adding this to the WHERE criteria:

d.letter IN ('C') AND

('C') is a comma delimited list of the drive letters you want the monitors to be built for, that in this instance is only 'C'.

Share this post


Link to post
Share on other sites

Darren,

 

It looks like this is working! I really appreciate your help; this will cut down on a huge number of noise alerts created by a mere 4-5 systems.

Share this post


Link to post
Share on other sites
On 6/9/2017 at 4:06 PM, DarrenWhite99 said:

Adjust line 21. In my script, the value currently is:


SELECT c.computerid AS computerid,c.name AS name,d.driveid AS driveid,d.letter as letter,d.size AS size,d.free as free,((d.free/d.size)*100) AS percent,d.filesystem as filesystem,d.volumename AS volumename,d.missing as missing FROM drives AS d INNER JOIN computers AS c ON d.computerid=c.computerid WHERE d.FileSystem not in ('CDFS','UKNFS','DVDFS','FAT','FAT32','NetFS') AND d.size > @MinSizeMB@ AND d.model not like '%usb%' AND d.model not like '%IEEE%' AND d.missing=0 AND c.computerid=@computerid@
 

 

Change this to


SELECT c.computerid AS computerid,c.name AS name,d.driveid AS driveid,d.letter as letter,d.size AS size,d.free as free,((d.free/d.size)*100) AS percent,d.filesystem as filesystem,d.volumename AS volumename,d.missing as missing FROM drives AS d INNER JOIN computers AS c ON d.computerid=c.computerid WHERE d.letter IN ('C') AND d.FileSystem not in ('CDFS','UKNFS','DVDFS','FAT','FAT32','NetFS') AND d.size > @MinSizeMB@ AND d.model not like '%usb%' AND d.model not like '%IEEE%' AND d.missing=0 AND c.computerid=@computerid@
 

 

It is just adding this to the WHERE criteria:


d.letter IN ('C') AND
 

('C') is a comma delimited list of the drive letters you want the monitors to be built for, that in this instance is only 'C'.

Hello,

I'm really happy with this solution, but I cannot implement it. When I go to edit the "Agent Monitor Creation - Disk*" Script it says "System Scripts are protected and not editable by the user. To change this script please copy it and make changes to the Copy."

Do you know how I can get around this?

Thanks!

Erik

Share this post


Link to post
Share on other sites

Did anyone ever get around the editable system script? I think what I'm going to do is make the drive size larger (16GB at present) and try to reduce the rubbish.

Share this post


Link to post
Share on other sites

You can't edit Agent Monitor Creation - Disk* but you can copy it, then just edit the step in the Agent Monitor Creation* script that runs Agent Monitor Creation - Disk* to run your copy instead.

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.


×
×
  • Create New...