system resource usage monitoring
i want to make a report which gives weekly usage of ram cpu memory usuage of per servers for some specific date or week.
is there a comment or any possible way for it on RHEL box?
linux
add a comment |
i want to make a report which gives weekly usage of ram cpu memory usuage of per servers for some specific date or week.
is there a comment or any possible way for it on RHEL box?
linux
Try 'sar' tool.
– mrc02_kr
Dec 19 '18 at 12:22
add a comment |
i want to make a report which gives weekly usage of ram cpu memory usuage of per servers for some specific date or week.
is there a comment or any possible way for it on RHEL box?
linux
i want to make a report which gives weekly usage of ram cpu memory usuage of per servers for some specific date or week.
is there a comment or any possible way for it on RHEL box?
linux
linux
asked Dec 19 '18 at 12:19
King Satan
12
12
Try 'sar' tool.
– mrc02_kr
Dec 19 '18 at 12:22
add a comment |
Try 'sar' tool.
– mrc02_kr
Dec 19 '18 at 12:22
Try 'sar' tool.
– mrc02_kr
Dec 19 '18 at 12:22
Try 'sar' tool.
– mrc02_kr
Dec 19 '18 at 12:22
add a comment |
1 Answer
1
active
oldest
votes
sar -u -f /var/log/sa/sa15
will give the logs for the 15th of the month.
sadf is another utility to use this data. Here's a sample:
START_TIME=$( date +%s --date 'yesterday 8am' )
END_TIME=$( date +%s --date 'yesterday 5pm' )
sadf -p /var/log/sa/sa15 -- -n DEV -q -w -b -u -r |
awk -v start_time=$START_TIME -v end_time=$END_TIME -v get_latest=$GET_LATEST '
BEGIN {
wanted_fields="%user %idle %system %iowait ldavg-1 ldavg-5 ldavg-15 cswch/s kbmemfree kbbuffers kbcached kbswpfree kbswpused bread/s bwrtn/s rxbyt/s txbyt/s"
num_fields=split(wanted_fields, fields)
for (i in fields) {
fieldname = fields[i]
value[fieldname] = 0.0
number[fieldname] = 0
}
}
! /t(sit0|lo)t/ {
if ($3 > start_time && $3 <= end_time) {
if (number[$5] < 1) {
number[$5] = 0
value[$5] = 0.0
}
if (get_latest) {
value[$5] = $6
} else {
value[$5] += $6
}
number[$5] += 1
}
}
END {
"hostname" | getline hostname
printf("%d hostname=%s start=%d end=%d ", end_time, hostname, start_time, end_time)
for (i=1; i <= num_fields; i++) {
fieldname = fields[i]
printf("%s=", fieldname)
if (number[fieldname] > 0) {
if (get_latest) {
v=value[fieldname]
} else {
v=value[fieldname]/number[fieldname]
}
printf("%f ", v)
} else {
printf("- ")
}
}
}
' | tr -d '%/'
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489892%2fsystem-resource-usage-monitoring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
sar -u -f /var/log/sa/sa15
will give the logs for the 15th of the month.
sadf is another utility to use this data. Here's a sample:
START_TIME=$( date +%s --date 'yesterday 8am' )
END_TIME=$( date +%s --date 'yesterday 5pm' )
sadf -p /var/log/sa/sa15 -- -n DEV -q -w -b -u -r |
awk -v start_time=$START_TIME -v end_time=$END_TIME -v get_latest=$GET_LATEST '
BEGIN {
wanted_fields="%user %idle %system %iowait ldavg-1 ldavg-5 ldavg-15 cswch/s kbmemfree kbbuffers kbcached kbswpfree kbswpused bread/s bwrtn/s rxbyt/s txbyt/s"
num_fields=split(wanted_fields, fields)
for (i in fields) {
fieldname = fields[i]
value[fieldname] = 0.0
number[fieldname] = 0
}
}
! /t(sit0|lo)t/ {
if ($3 > start_time && $3 <= end_time) {
if (number[$5] < 1) {
number[$5] = 0
value[$5] = 0.0
}
if (get_latest) {
value[$5] = $6
} else {
value[$5] += $6
}
number[$5] += 1
}
}
END {
"hostname" | getline hostname
printf("%d hostname=%s start=%d end=%d ", end_time, hostname, start_time, end_time)
for (i=1; i <= num_fields; i++) {
fieldname = fields[i]
printf("%s=", fieldname)
if (number[fieldname] > 0) {
if (get_latest) {
v=value[fieldname]
} else {
v=value[fieldname]/number[fieldname]
}
printf("%f ", v)
} else {
printf("- ")
}
}
}
' | tr -d '%/'
add a comment |
sar -u -f /var/log/sa/sa15
will give the logs for the 15th of the month.
sadf is another utility to use this data. Here's a sample:
START_TIME=$( date +%s --date 'yesterday 8am' )
END_TIME=$( date +%s --date 'yesterday 5pm' )
sadf -p /var/log/sa/sa15 -- -n DEV -q -w -b -u -r |
awk -v start_time=$START_TIME -v end_time=$END_TIME -v get_latest=$GET_LATEST '
BEGIN {
wanted_fields="%user %idle %system %iowait ldavg-1 ldavg-5 ldavg-15 cswch/s kbmemfree kbbuffers kbcached kbswpfree kbswpused bread/s bwrtn/s rxbyt/s txbyt/s"
num_fields=split(wanted_fields, fields)
for (i in fields) {
fieldname = fields[i]
value[fieldname] = 0.0
number[fieldname] = 0
}
}
! /t(sit0|lo)t/ {
if ($3 > start_time && $3 <= end_time) {
if (number[$5] < 1) {
number[$5] = 0
value[$5] = 0.0
}
if (get_latest) {
value[$5] = $6
} else {
value[$5] += $6
}
number[$5] += 1
}
}
END {
"hostname" | getline hostname
printf("%d hostname=%s start=%d end=%d ", end_time, hostname, start_time, end_time)
for (i=1; i <= num_fields; i++) {
fieldname = fields[i]
printf("%s=", fieldname)
if (number[fieldname] > 0) {
if (get_latest) {
v=value[fieldname]
} else {
v=value[fieldname]/number[fieldname]
}
printf("%f ", v)
} else {
printf("- ")
}
}
}
' | tr -d '%/'
add a comment |
sar -u -f /var/log/sa/sa15
will give the logs for the 15th of the month.
sadf is another utility to use this data. Here's a sample:
START_TIME=$( date +%s --date 'yesterday 8am' )
END_TIME=$( date +%s --date 'yesterday 5pm' )
sadf -p /var/log/sa/sa15 -- -n DEV -q -w -b -u -r |
awk -v start_time=$START_TIME -v end_time=$END_TIME -v get_latest=$GET_LATEST '
BEGIN {
wanted_fields="%user %idle %system %iowait ldavg-1 ldavg-5 ldavg-15 cswch/s kbmemfree kbbuffers kbcached kbswpfree kbswpused bread/s bwrtn/s rxbyt/s txbyt/s"
num_fields=split(wanted_fields, fields)
for (i in fields) {
fieldname = fields[i]
value[fieldname] = 0.0
number[fieldname] = 0
}
}
! /t(sit0|lo)t/ {
if ($3 > start_time && $3 <= end_time) {
if (number[$5] < 1) {
number[$5] = 0
value[$5] = 0.0
}
if (get_latest) {
value[$5] = $6
} else {
value[$5] += $6
}
number[$5] += 1
}
}
END {
"hostname" | getline hostname
printf("%d hostname=%s start=%d end=%d ", end_time, hostname, start_time, end_time)
for (i=1; i <= num_fields; i++) {
fieldname = fields[i]
printf("%s=", fieldname)
if (number[fieldname] > 0) {
if (get_latest) {
v=value[fieldname]
} else {
v=value[fieldname]/number[fieldname]
}
printf("%f ", v)
} else {
printf("- ")
}
}
}
' | tr -d '%/'
sar -u -f /var/log/sa/sa15
will give the logs for the 15th of the month.
sadf is another utility to use this data. Here's a sample:
START_TIME=$( date +%s --date 'yesterday 8am' )
END_TIME=$( date +%s --date 'yesterday 5pm' )
sadf -p /var/log/sa/sa15 -- -n DEV -q -w -b -u -r |
awk -v start_time=$START_TIME -v end_time=$END_TIME -v get_latest=$GET_LATEST '
BEGIN {
wanted_fields="%user %idle %system %iowait ldavg-1 ldavg-5 ldavg-15 cswch/s kbmemfree kbbuffers kbcached kbswpfree kbswpused bread/s bwrtn/s rxbyt/s txbyt/s"
num_fields=split(wanted_fields, fields)
for (i in fields) {
fieldname = fields[i]
value[fieldname] = 0.0
number[fieldname] = 0
}
}
! /t(sit0|lo)t/ {
if ($3 > start_time && $3 <= end_time) {
if (number[$5] < 1) {
number[$5] = 0
value[$5] = 0.0
}
if (get_latest) {
value[$5] = $6
} else {
value[$5] += $6
}
number[$5] += 1
}
}
END {
"hostname" | getline hostname
printf("%d hostname=%s start=%d end=%d ", end_time, hostname, start_time, end_time)
for (i=1; i <= num_fields; i++) {
fieldname = fields[i]
printf("%s=", fieldname)
if (number[fieldname] > 0) {
if (get_latest) {
v=value[fieldname]
} else {
v=value[fieldname]/number[fieldname]
}
printf("%f ", v)
} else {
printf("- ")
}
}
}
' | tr -d '%/'
answered Dec 19 '18 at 12:26
wef
1013
1013
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f489892%2fsystem-resource-usage-monitoring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Try 'sar' tool.
– mrc02_kr
Dec 19 '18 at 12:22