Jump to content
dmc600

A Drive Error and/or Raid Failure was found

Recommended Posts

Best I've found so far is to limit to specific disk, like:

Eventlogs.Source like 'disk' and eventlogs.message like ('\Device\Harddisk0') and timegen > DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)

 

Would suggest testing with wild-cards for the "Harddisk#" to see if you can get it to work for all physical disks.

Share this post


Link to post
Share on other sites

I made a lot of changes for a Drive Error and/or Raid Failure. Now it fits our needs at least.

 

- The internal monitor:

Identity Field:

CONVERT(CONCAT('EventID - ',Eventlogs.EventID,' ',Eventlogs.Logname,' log - ', Eventlogs.Source,':  ',Eventlogs.Message) using latin1) AS 'Event Information'

Additional Condition:

(Eventlogs.Source LIKE 'disk' OR (Eventlogs.Source LIKE 'Ntfs' AND Eventlogs.Message LIKE '%chkdsk%') OR Eventlogs.Source LIKE 'Cissesrv' OR Eventlogs.Source LIKE 'Storage Agents') AND Eventlogs.Message NOT LIKE '%controller error%' AND Eventlogs.Message NOT LIKE '%during a paging operation%' AND timegen > DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)

- The autofix action script:

I created script to export the drives details with the message from the monitor and the event log information, and send it by email to tech team.

The SQL query I use is:

SELECT 'Letter', 'VolumeName', 'Model', 'FileSystem', 'Size', 'Free', 'SmartStatus' UNION ALL SELECT Letter,VolumeName, Model, FileSystem, Size, Free, SmartStatus INTO OUTFILE 'C:/Windows/TEMP/Drives-%ComputerID%.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM drives WHERE computerid = %ComputerID% AND size <> 0 AND missing = 0 AND Internal = 1 AND SSD = 0 AND Model NOT IN ('%USB%','%CDRWDVD%', '%CDDVDW%')

Then I attache the file exported from my query in the email. the email body contains @fieldname@ from the monitor

Share this post


Link to post
Share on other sites

Hey,

 

Can you please export the latest Monitor set and attach here. (As we are new to LabTech)

Also attach the script that you have created for Auto fix action.

 

Thank you!

Share this post


Link to post
Share on other sites
I made a lot of changes for a Drive Error and/or Raid Failure. Now it fits our needs at least.

 

- The internal monitor:

Identity Field:

CONVERT(CONCAT('EventID - ',Eventlogs.EventID,' ',Eventlogs.Logname,' log - ', Eventlogs.Source,':  ',Eventlogs.Message) using latin1) AS 'Event Information'

Additional Condition:

(Eventlogs.Source LIKE 'disk' OR (Eventlogs.Source LIKE 'Ntfs' AND Eventlogs.Message LIKE '%chkdsk%') OR Eventlogs.Source LIKE 'Cissesrv' OR Eventlogs.Source LIKE 'Storage Agents') AND Eventlogs.Message NOT LIKE '%controller error%' AND Eventlogs.Message NOT LIKE '%during a paging operation%' AND timegen > DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)

- The autofix action script:

I created script to export the drives details with the message from the monitor and the event log information, and send it by email to tech team.

The SQL query I use is:

SELECT 'Letter', 'VolumeName', 'Model', 'FileSystem', 'Size', 'Free', 'SmartStatus' UNION ALL SELECT Letter,VolumeName, Model, FileSystem, Size, Free, SmartStatus INTO OUTFILE 'C:/Windows/TEMP/Drives-%ComputerID%.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM drives WHERE computerid = %ComputerID% AND size <> 0 AND missing = 0 AND Internal = 1 AND SSD = 0 AND Model NOT IN ('%USB%','%CDRWDVD%', '%CDDVDW%')

Then I attache the file exported from my query in the email. the email body contains @fieldname@ from the monitor

 

Hey,

 

Can you please export the latest Monitor set and attach here. (As we are new to LabTech)

Also attach the script that you have created for Auto fix action.

 

Thank you!

  • Like 1

Share this post


Link to post
Share on other sites

Hey,

 

Can you please export the latest Monitor set and attach here. (As we are new to LabTech)

Also attach the script that you have created for Auto fix action.

 

Thank you!

Sure, but please note that you have to do some edits in the script, I already wrote notes inside the script before the lines that you will need to edit, such as the LT Server's ID and the email you want to send the report for. you can make the script create a ticket instead of email as well.

If you need any help editing the script please ask.

 

The attached zip[ file contains:

Monitor: Copy - EV - Drive Errors and Raid Failure.sql

Script: Copy - Monitor Drive Errors and Raid Failures.xml

Drive Errors and Raid Failures.zip

Share this post


Link to post
Share on other sites

Hey,

 

Can you please export the latest Monitor set and attach here. (As we are new to LabTech)

Also attach the script that you have created for Auto fix action.

 

Thank you!

Sure, but please note that you have to do some edits in the script, I already wrote notes inside the script before the lines that you will need to edit, such as the LT Server's ID and the email you want to send the report for. you can make the script create a ticket instead of email as well.

If you need any help editing the script please ask.

 

The attached zip[ file contains:

Monitor: Copy - EV - Drive Errors and Raid Failure.sql

Script: Copy - Monitor Drive Errors and Raid Failures.xml

 

Thank you again, Kindly help me to clarify me on editing the script "LT Servers ID".

As we use LabTech as SaaS, which is owned by LT support team.

 

We have installed control center in one of my machine(Administration Server) for accessing the LT cloud server.

 

Is it enough to key-in my Administration server ID? on the script.

Share this post


Link to post
Share on other sites

I'm NOT sure...

We have LT on site, the server, DB, everything. I haven't worked on cloud based LT, but I think unfortunately if you don't have access to your LT database then you cannot use this script, neither the LT Server ID nor the SQL query to save a file to LT server drive.

Anyway, to make sure that i'm right (or not), please ask any one who has the same thing as you have, how do they access their database? or even is that is possible?

Share this post


Link to post
Share on other sites

 

I'm NOT sure...

We have LT on site, the server, DB, everything. I haven't worked on cloud based LT, but I think unfortunately if you don't have access to your LT database then you cannot use this script, neither the LT Server ID nor the SQL query to save a file to LT server drive.

Anyway, to make sure that i'm right (or not), please ask any one who has the same thing as you have, how do they access their database? or even is that is possible?

 

 

Hi,

 

It was working fine until previous month using my "Administration Server ID" for sending emails.

But now i dint work, when i check the script log i do see the following error.

"The Script(6095) failed in the Then section at step 2. The reason: SQL Execute failed processing query"

 

Can you help me with it, not sure what went wrong, i also tried executing the sql query in my cloud server directly, but then the query ends with error.

Error Code: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%ComputerID% AND size <> 0 AND missing = 0 AND Internal = 1 AND SSD = 0 AND Mode' at line 1

 

Share this post


Link to post
Share on other sites
Can you help me with it, not sure what went wrong, i also tried executing the sql query in my cloud server directly, but then the query ends with error.

Error Code: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%ComputerID% AND size <> 0 AND missing = 0 AND Internal = 1 AND SSD = 0 AND Mode' at line 1

Just jumping in here, but if you are trying to test this in SQLYog you need to replace each instance of %computerid% with an actual number. It should be the computer id you are testing for......

And looking closer, I possibly see a second problem. The query is trying to write a file on the Labtech server to 'C:/Windows/TEMP/Drives-%ComputerID%.csv'. On the hosted servers, that might be problematic...

 

FWIW, I tried this in SQLYOG on our hosted server:

SELECT 'Letter', 'VolumeName', 'Model', 'FileSystem', 'Size', 'Free', 'SmartStatus' UNION ALL SELECT Letter,VolumeName, Model, FileSystem, Size, Free, SmartStatus 
INTO OUTFILE 'C:/Windows/TEMP/Drives-1.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' 
FROM drives WHERE computerid = 1 AND size <> 0 AND missing = 0 AND Internal = 1 AND SSD = 0 AND Model NOT IN ('%USB%','%CDRWDVD%', '%CDDVDW%');

And I was able to verify the file existed with these contents:

"Letter","VolumeName","Model","FileSystem","Size","Free","SmartStatus"
"C","UNK","XENSRC PVDISK SCSI Disk Device","NTFS","30717","9587","SCSI:0::::0,0,0,0,0"
"Z","Temporary Storage 1","XENSRC PVDISK SCSI Disk Device","NTFS","152685","150891","SCSI:0::::0,0,0,0,0"

On the off chance that it is a path/permissions error, you can use the "%localltshare%" variable in your script instead of C:\Windows\Temp to save into the LTShare folder structure on the server. (Maybe to a path such as: "%localltshare%\Uploads\%clientname%\%computername%-%computerid%\drives-%computerid%.csv", assuming the folder already existed, Maybe "%localltshare%\Uploads\LTSERVER\drives-%computerid%.csv" would be better, since you can create it easily...) I tested and verified that MySQL will not create the file if the folder doesn't exist.

 

Here is a version of the query that can be used in a Variable Set or SQL Get Value function to retrieve the data that would be in the CSV, without needing a temp file:

SET SESSION group_concat_max_len = 1000000; SELECT CONVERT(GROUP_CONCAT(CONCAT_WS(',',Letter,VolumeName, Model, FileSystem, Size, Free, SmartStatus) SEPARATOR '\r\n' ) USING utf8)  AS Result FROM 
(SELECT '"Letter"' AS `Letter`, '"VolumeName"' AS `VolumeName`, '"Model"' AS `Model`, '"FileSystem"' AS `FileSystem`, '"Size"' AS `Size`, '"Free"' AS `Free`, '"SmartStatus"' AS `SmartStatus`
UNION ALL SELECT CONCAT('"',Letter,'"'),CONCAT('"',VolumeName,'"'),CONCAT('"', Model,'"'),CONCAT('"', FileSystem,'"'),CONCAT('"', Size,'"'),CONCAT('"', Free,'"'),CONCAT('"', SmartStatus,'"')
FROM drives WHERE computerid = %computerid% AND size <> 0 AND missing = 0 AND Internal = 1 AND SSD = 0 AND Model NOT IN ('%USB%','%CDRWDVD%', '%CDDVDW%')) AS tb1;

 

Options, options.. ;)

  • Like 1

Share this post


Link to post
Share on other sites

Hi Darren,

The version of the query without needing a temp file.

I executed the query and i do see results, thanks for that.

Can you please help me how to make use of this step and then send email having the csv attached to the existing ticket?

Thanks

Share this post


Link to post
Share on other sites

@pmanokaran The standard disclaimer: Use this information at your own risk. I/We take no responsibility for how you choose to use it.

 

You can use the comment ticket function provided you have the existing ticket id. If you don't have the existing ticketid you would need to get that with a SQL Query. I think you may find looking at the System Automation Ticket Consolidation script. The method without needing the temp file that Darren posted doesn't write a CSV, it writes the contents (body) of the CSV to a variable (of your choice using Variable Set or %sqlresult% using SQL Get Value).

To attach a CSV, you would need the CSV to attach (the temp file). However, you can still email the contents of the CSV directly inline in the Send Email function, or have your required email set in the ticketcreate function, that way when you use ticket comment you can choose to 'respond' to the requestor.

It is helpful for me to open up the scripts and read through what they are doing to understand how they are being used. If you end up using the Ticket Consolidation script, dont forget to set the necessary variables for it to be successful. I haven't had a chance to download or look at this modification, but IIRC there is a 'Monitor Drive errors and Raid Failures Ticket Consolidation' script already. 

Documentation that may be helpful:

Email Script function

Ticket Comment

Ticket Consolidation

Share this post


Link to post
Share on other sites

Thank for this, I am a Very VERY novice SQL guy  but I had to make a small edit in the condition --  'disk'   needed to be 'disk%'   Then it ran with no errors.  

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...