Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resmon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrors
resmon
Commits
eefa053a
Commit
eefa053a
authored
6 years ago
by
Sergey Joseph Ivanov
Browse files
Options
Downloads
Patches
Plain Diff
Site/Megaraid merged into Core/SMART
parent
631db87f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/Site/Megaraid.pm
+0
-133
0 additions, 133 deletions
lib/Site/Megaraid.pm
with
0 additions
and
133 deletions
lib/Site/Megaraid.pm
deleted
100644 → 0
+
0
−
133
View file @
631db87f
package
Site::
Megaraid
;
use
strict
;
use
warnings
;
use
base
'
Resmon::Module
';
use
Resmon::
ExtComm
qw(run_command cache_command)
;
=pod
=head1 NAME
Site::Megaraid - pulls SMART values from disk drives
=head1 SYNOPSIS
Site::Megaraid {
sda/2 : smartctl_cmd => /usr/sbin/smartctl
}
=head1 DESCRIPTION
Self-Monitoring, Analysis and Reporting Technology (SMART) allows for detecting
errors and reporting on reliability indicators on hard disk drives.
This module pulls the specified values from the output of the smartctl utility.
For more information on smartctl, see http://smartmontools.sourceforge.net/
=head1 CONFIGURATION
=over
=item check_name
This indicates the disk argument to be given to smartctl. Expects the basename
of the device, not the full path, e.g. "sda" not "/dev/sda".
=item smartctl_cmd
The full path of the smartctl command. Defaults to /usr/sbin/smartctl.
=item smartctl_args
Optional list of additional arguments that will be passed to smartctl.
The default arguments are "-i -A". Any arguments specified here will be
added to this list.
If the argument contains a comma, it must be escaped with a backslash.
=back
=head1 METRICS
The SMART attribute data is highly vendor-specific. Each attribute will produce
two metrics, one with the normalized value and one with the raw value.
Post-processing may be desirable in specific cases, such as when the value as
hex has special meaning.
=over
=item model
Device model as reported in the information section.
=item serial
Device serial number as reported in the information section.
=item fw
Device firmware version as reported in the information section.
=item (attribute)
The normalized value of the attribute, expected to be an integer.
=item (attribute)_raw
The raw value of the attribute, expected to be an integer.
=back
=cut
sub
handler
{
my
$self
=
shift
;
my
$config
=
$self
->
{
config
};
my
(
$disk_name
,
$megaraid_number
)
=
split
('
/
',
$self
->
{
check_name
}),
my
$disk
;
$disk
=
"
/dev/
$disk_name
"
if
(
$^O
eq
"
linux
")
||
(
$^O
=~
/bsd/
)
;
$disk
=
"
/dev/rdsk/
$disk_name
"
if
$^O
eq
"
solaris
";
my
$smartctl_cmd
=
$config
->
{
smartctl_cmd
}
||
"
/usr/sbin/smartctl
";
my
$smartctl_args
=
"
-i -a -H -d megaraid,
$megaraid_number
";
$smartctl_args
=
"
$smartctl_args
$config
->{smartctl_args}
"
if
$config
->
{
smartctl_args
};
my
$smartdata
=
{};
print
STDERR
("
$smartctl_cmd
$smartctl_args
$disk
\n
");
my
$output
=
run_command
("
$smartctl_cmd
$smartctl_args
$disk
");
foreach
my
$line
(
split
(
/\n/
,
$output
))
{
if
(
(
$line
=~
/^Device Model:\s+(.+)$/
)
||
(
$line
=~
/^Product:\s+(.+)$/
)
)
{
$smartdata
->
{"
model
"}
=
[
$
1
,
"
s
"];
}
elsif
(
$line
=~
/^Serial Number:\s+(.+)$/i
)
{
$smartdata
->
{"
serial
"}
=
[
$
1
,
"
s
"];
}
elsif
(
$line
=~
/^SMART Health Status:\s+(.+)$/i
)
{
$smartdata
->
{"
health
"}
=
[
$
1
,
"
s
"];
}
elsif
(
(
$line
=~
/^Firmware Version:\s+(.+)$/
)
||
(
$line
=~
/^Revision:\s+(.+)$/
)
)
{
$smartdata
->
{"
firmware_version
"}
=
[
$
1
,
"
s
"];
}
elsif
(
$line
=~
/^Elements in grown defect list:\s+(.+)$/
)
{
$smartdata
->
{"
elements_in_defect_list
"}
=
[
$
1
,
"
i
"];
}
elsif
(
$line
=~
/^(read|write|verify):\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\S+)\s+(\d+)$/
)
{
print
STDERR
"
$1 $1_errors_corrected $5 $1_errors_uncorrected $8
\n
";
$smartdata
->
{"
$1_errors_corrected
"}
=
[
$
5
,
"
i
"];
$smartdata
->
{"
$1_errors_uncorrected
"}
=
[
$
8
,
"
i
"];
}
elsif
(
$line
=~
/^Non-medium error count:\s+(.+)$/
)
{
$smartdata
->
{"
non_medium_errors
"}
=
[
$
1
,
"
i
"];
}
}
return
$smartdata
;
};
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment