Xymon Mailing List Archive search

CPU Average for 1 month via CLI

4 messages in this thread

list Bill Howe · Fri, 1 Mar 2019 09:54:47 -0600 ·
Hello,

Is anyone aware of a way to generate reports via the CLI that show, for
example, a host's CPU average over the last 30 days?

I can get the data in graph form via the xymon web portal's "Metrics
Reports" page, but need to gather this data point for a large number of
hosts.

I also looked at the manpage for 'xymon', and xymondboard appears to gather
current stats, but I didn't see a way to gather a date range.

Thank you,

Bill Howe
user-851eeb93eef8@xymon.invalid <http://www.linkedin.com/in/whowe>;
list Michael T Pins · Fri, 1 Mar 2019 10:40:37 -0700 (MST) ·
quoted from Bill Howe
Bill Howe writes:
Is anyone aware of a way to generate reports via the CLI that show, for
example, a host's CPU average over the last 30 days?
I can get the data in graph form via the xymon web portal's "Metrics
Reports" page, but need to gather this data point for a large number of
hosts.
I also looked at the manpage for 'xymon', and xymondboard appears to gather
current stats, but I didn't see a way to gather a date range.
It depends upon what you mean by "a host's CPU average over the last 30
days".  Do you mean one number that's the 30 day average?  30 numbers that
each show a 1 day average?  Every 5 minute number for 30 days?

In any case, the likely answer is to use rrdfetch and pull the data
directly from the rrd files.  Do read the RESOLUTION INTERVAL section of
the rrdfetch manpage.  If you don't have your boundries correct you won't
get the answers you're expecting.  Note that you likely don't have 5 minute
resolution going back anywhere near 30 days.  (By default you'll likely
have 2 hour resolution for that period.)

For example, to get a 24hr average for each of the last 30 days:
TIME=$(date +%s)
RRDRES=86400
rrdtool fetch la.rrd AVERAGE -r $RRDRES -e $(($TIME/$RRDRES*$RRDRES)) -s e-30d

Also note that you need to adjust the results.  For example:

7.3520000000e+01 = .73520000000
1.0855666667e+02 = 1.0855666667
list Norbert Kriegenburg · Fri, 1 Mar 2019 19:03:57 +0100 ·
There is no way to get this directly afaik.
But you can extract those values from your rrd files with the start and end
arg with rrdtool.

For example to get the average load for a server for the last 15 days just
do:

rrdtool fetch la.rrd AVERAGE -s now-15d -e now | gawk '!/nan/{sum+=$2};END
{printf("Average load: %.1f\n",sum/NR)}'

For a bunch of servers loop like this

for server in $list
do
  rdtool fetch $XYMONRRDS/$server/la.rrd AVERAGE -s now-15d -e now|gawk
'!/nan/{sum+=$2};END{printf("Average load server %s: %.1f
\n","'"$server"'",sum/NR)}'
done

Norbert


From:	Bill Howe <user-851eeb93eef8@xymon.invalid>
To:	Xymon Mailing List <xymon at xymon.com>
Date:	03/01/2019 04:55 PM
Subject:	[Xymon] CPU Average for 1 month via CLI
Sent by:	"Xymon" <xymon-bounces at xymon.com>
quoted from Michael T Pins


Hello,

Is anyone aware of a way to generate reports via the CLI that show, for
example, a host's CPU average over the last 30 days?

I can get the data in graph form via the xymon web portal's "Metrics
Reports" page, but need to gather this data point for a large number of
hosts.

I also looked at the manpage for 'xymon', and xymondboard appears to gather
current stats, but I didn't see a way to gather a date range.

Thank you,

Bill Howe
user-851eeb93eef8@xymon.invalid

https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.xymon.com_mailman_listinfo_xymon&d=DwIGaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=1okcrdQDEUvhgFMv7NgYfuq4YGCugFBVqzoTP_MCY98&m=LGSjDiQr5uMUWbaSRNZefbi91CXHpFZrkxyScTU_lJg&s=73T5zFtsxwfJiNScF_ekl7_eMkHWY2cy6pV0L7CmTWc&e=
list Bill Howe · Fri, 1 Mar 2019 13:29:52 -0600 ·
Thank you Michael and Norbert.
I will look into rrdtool fetch!

Regards,

Bill Howe
user-851eeb93eef8@xymon.invalid <http://www.linkedin.com/in/whowe>;


On Fri, Mar 1, 2019 at 12:04 PM Norbert Kriegenburg <
quoted from Norbert Kriegenburg
user-501bbe9c5409@xymon.invalid> wrote:
There is no way to get this directly afaik.
But you can extract those values from your rrd files with the start and
end arg with rrdtool.

For example to get the average load for a server for the last 15 days just
do:

rrdtool fetch la.rrd AVERAGE -s now-15d -e now | gawk

'!/nan/{sum+=$2};END{printf("Average load: %.1f\n",sum/NR)}'
quoted from Norbert Kriegenburg

For a bunch of servers loop like this

for server in $list
do
rdtool fetch $XYMONRRDS/$server/la.rrd AVERAGE -s now-15d -e now|gawk
'!/nan/{sum+=$2};END{printf("Average load server %s:

%.1f\n","'"$server"'",sum/NR)}'
done

Norbert

[image: Inactive hide details for Bill Howe ---03/01/2019 04:55:12
PM---Hello, Is anyone aware of a way to generate reports via the CLI]Bill
Howe ---03/01/2019 04:55:12 PM---Hello, Is anyone aware of a way to
quoted from Norbert Kriegenburg
generate reports via the CLI that show, for

From: Bill Howe <user-851eeb93eef8@xymon.invalid>
To: Xymon Mailing List <xymon at xymon.com>
Date: 03/01/2019 04:55 PM
Subject: [Xymon] CPU Average for 1 month via CLI
Sent by: "Xymon" <xymon-bounces at xymon.com>


Hello,

Is anyone aware of a way to generate reports via the CLI that show, for
example, a host's CPU average over the last 30 days?

I can get the data in graph form via the xymon web portal's "Metrics
Reports" page, but need to gather this data point for a large number of
hosts.

I also looked at the manpage for 'xymon', and xymondboard appears to
gather current stats, but I didn't see a way to gather a date range.

Thank you,

Bill Howe

*user-851eeb93eef8@xymon.invalid* <user-851eeb93eef8@xymon.invalid>
<http://www.linkedin.com/in/whowe>;