Hi all
I've been asked to report on the usage of some devices (Windows 7 tablet computers). I have not installed any agents but I've had them in the hosts.cfg file for a couple of months.
All I need is to report on which devices have a 'conn' max of 0ms over 7, 14 and 28 days.
Any ideas how I can get this info in text format?
Thanks
CC
On Wed, March 25, 2015 6:35 pm, Colin Coe wrote:
Hi all
I've been asked to report on the usage of some devices (Windows 7 tablet computers). I have not installed any agents but I've had them in the hosts.cfg file for a couple of months.
All I need is to report on which devices have a 'conn' max of 0ms over 7, 14 and 28 days.
Any ideas how I can get this info in text format?
Well, it's definitely not *pretty*, but this (taken mostly from: http://stackoverflow.com/questions/15964917/get-a-max-number-in-a-certain-pe...) seemed to get the output needed from the raw RRD files:
[rhel6-x86-64 rrd]# for i in ls */tcp.conn.rrd ; do echo -n "${i} " ;
rrdtool graph x -s date +%s --date="1 week ago" DEF:v=${i}:sec:MAX
VDEF:vm=v,MAXIMUM PRINT:vm:%lf ; done | perl -pe 's/0x0\s/= /sg' | sort
-nr -k 3
centos3-i386.build/tcp.conn.rrd = 0.264434
b.resolvers.Level3.net/tcp.conn.rrd = 0.135559
centos4-i386.build/tcp.conn.rrd = 0.126232
rhel5-i386.build/tcp.conn.rrd = 0.118713
google-public-dns-a.google.com/tcp.conn.rrd = 0.063940
ns1.google.com/tcp.conn.rrd = 0.063380
a.resolvers.Level3.net/tcp.conn.rrd = 0.049894
google-public-dns-b.google.com/tcp.conn.rrd = 0.035567
rhel5-x86-64.build/tcp.conn.rrd = 0.016195
etc...
That's a list of everything, then just filter out numerically as needed. (Uses GNU date, but can be substituted with any epoch start/end points.)
This is definitely an area where Xymon could use some improvement. The hostgraphs.cgi(1) script is a start, but there's a lot at the display layer that could be done to gather interesting data from RRD for searching, filtering, and report presentation.
HTH,
-jc
Hi and many thanks for this.
Just trying to fit this to my needs, I actually just want a text report, no graphs so I've changed it to:
for I in ls -1 TAB*/tcp.conn.rrd; do
echo dirname $I
rrdtool fetch $I MAX -r 900 -s "12am Mar 1" -e "12am Mar 27" | egrep
-v "nan|^ *sec$|^$"
done
Now, I know from looking at the graphs in Xymon that most of the TAB* devices have a "MAX" value, however "rrdtool fetch" says that at every interval, the value is "not a number".
Any ideas what I'm doing wrong?
Thanks
CC
On Fri, Mar 27, 2015 at 5:27 AM, J.C. Cleaver <cleaver at terabithia.org> wrote:
On Wed, March 25, 2015 6:35 pm, Colin Coe wrote:
Hi all
I've been asked to report on the usage of some devices (Windows 7 tablet computers). I have not installed any agents but I've had them in the hosts.cfg file for a couple of months.
All I need is to report on which devices have a 'conn' max of 0ms over 7, 14 and 28 days.
Any ideas how I can get this info in text format?
Well, it's definitely not *pretty*, but this (taken mostly from: http://stackoverflow.com/questions/15964917/get-a-max-number-in-a-certain-pe...) seemed to get the output needed from the raw RRD files:
[rhel6-x86-64 rrd]# for i in
ls */tcp.conn.rrd; do echo -n "${i} " ; rrdtool graph x -sdate +%s --date="1 week ago"DEF:v=${i}:sec:MAX VDEF:vm=v,MAXIMUM PRINT:vm:%lf ; done | perl -pe 's/0x0\s/= /sg' | sort -nr -k 3 centos3-i386.build/tcp.conn.rrd = 0.264434 b.resolvers.Level3.net/tcp.conn.rrd = 0.135559 centos4-i386.build/tcp.conn.rrd = 0.126232 rhel5-i386.build/tcp.conn.rrd = 0.118713 google-public-dns-a.google.com/tcp.conn.rrd = 0.063940 ns1.google.com/tcp.conn.rrd = 0.063380 a.resolvers.Level3.net/tcp.conn.rrd = 0.049894 google-public-dns-b.google.com/tcp.conn.rrd = 0.035567 rhel5-x86-64.build/tcp.conn.rrd = 0.016195etc...
That's a list of everything, then just filter out numerically as needed. (Uses GNU date, but can be substituted with any epoch start/end points.)
This is definitely an area where Xymon could use some improvement. The hostgraphs.cgi(1) script is a start, but there's a lot at the display layer that could be done to gather interesting data from RRD for searching, filtering, and report presentation.
HTH,
-jc
For the start and end options to rrdtool, it's actually expecting unix epoch timestamps. That's probably why you're getting NaN.
The original command below was using GNU date to print out the timestamps (it has some surprisingly smart heuristics for interpreting human-readable date time phrases) as epochs using "+%s"
[@localhost /]$ date +%s 1427686424 [@localhost /]$ date +%s --date="1 week ago" 1427081625
Substitute the appropriate values there and I think what you have should work. (If you're doing this via script instead of a one-liner, I'd just set an earlier variable for them.)
HTH,
-jc
On Thu, March 26, 2015 6:59 pm, Colin Coe wrote:
Hi and many thanks for this.
Just trying to fit this to my needs, I actually just want a text report, no graphs so I've changed it to:
for I in
ls -1 TAB*/tcp.conn.rrd; do echodirname $Irrdtool fetch $I MAX -r 900 -s "12am Mar 1" -e "12am Mar 27" | egrep -v "nan|^ *sec$|^$" doneNow, I know from looking at the graphs in Xymon that most of the TAB* devices have a "MAX" value, however "rrdtool fetch" says that at every interval, the value is "not a number".
Any ideas what I'm doing wrong?
Thanks
CC
On Fri, Mar 27, 2015 at 5:27 AM, J.C. Cleaver <cleaver at terabithia.org> wrote:
On Wed, March 25, 2015 6:35 pm, Colin Coe wrote:
Hi all
I've been asked to report on the usage of some devices (Windows 7 tablet computers). I have not installed any agents but I've had them in the hosts.cfg file for a couple of months.
All I need is to report on which devices have a 'conn' max of 0ms over 7, 14 and 28 days.
Any ideas how I can get this info in text format?
Well, it's definitely not *pretty*, but this (taken mostly from: http://stackoverflow.com/questions/15964917/get-a-max-number-in-a-certain-pe...) seemed to get the output needed from the raw RRD files:
[rhel6-x86-64 rrd]# for i in
ls */tcp.conn.rrd; do echo -n "${i} " ; rrdtool graph x -sdate +%s --date="1 week ago"DEF:v=${i}:sec:MAX VDEF:vm=v,MAXIMUM PRINT:vm:%lf ; done | perl -pe 's/0x0\s/= /sg' | sort -nr -k 3 centos3-i386.build/tcp.conn.rrd = 0.264434 b.resolvers.Level3.net/tcp.conn.rrd = 0.135559 centos4-i386.build/tcp.conn.rrd = 0.126232 rhel5-i386.build/tcp.conn.rrd = 0.118713 google-public-dns-a.google.com/tcp.conn.rrd = 0.063940 ns1.google.com/tcp.conn.rrd = 0.063380 a.resolvers.Level3.net/tcp.conn.rrd = 0.049894 google-public-dns-b.google.com/tcp.conn.rrd = 0.035567 rhel5-x86-64.build/tcp.conn.rrd = 0.016195etc...
That's a list of everything, then just filter out numerically as needed. (Uses GNU date, but can be substituted with any epoch start/end points.)
This is definitely an area where Xymon could use some improvement. The hostgraphs.cgi(1) script is a start, but there's a lot at the display layer that could be done to gather interesting data from RRD for searching, filtering, and report presentation.
HTH,
-jc
On 30 March 2015 at 14:37, J.C. Cleaver <cleaver at terabithia.org> wrote:
For the start and end options to rrdtool, it's actually expecting unix epoch timestamps.
Actually, rrdgraph also has pretty good parsing, not necessarily requiring epoch-times. For example you can say:
-s "end-1week" -e "now-2d"
meaning "from 2 days ago to one week before then".
and
-s "-1week" -e "s+2d"
meaning "from 1 week ago to 2 days after then". ("s"="start"; "e"="end"; "-1week" = "now-1week").
Can also specify dates in human-readable form as long as they comply with the AT-STYLE time specification:
https://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html#IAT_STYLE_TIME_SPECIFICA...
I think the only error in this:
rrdtool fetch $I MAX -r 900 -s "12am Mar 1" -e "12am Mar 27" | egrep
is that you specified "12am" instead of "12:00am" and didn't specify a year. So try "12:00am Mar 1 2015" for your start time. If you don't specify a time of day, the year doesn't seem to be required, and I would expect would default to the current year.
J
On Sun, March 29, 2015 10:37 pm, Jeremy Laidman wrote:
On 30 March 2015 at 14:37, J.C. Cleaver <cleaver at terabithia.org> wrote:
For the start and end options to rrdtool, it's actually expecting unix epoch timestamps.
Actually, rrdgraph also has pretty good parsing, not necessarily requiring epoch-times. For example you can say:
-s "end-1week" -e "now-2d"
meaning "from 2 days ago to one week before then".
and
-s "-1week" -e "s+2d"
meaning "from 1 week ago to 2 days after then". ("s"="start"; "e"="end"; "-1week" = "now-1week").
Can also specify dates in human-readable form as long as they comply with the AT-STYLE time specification:
https://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html#IAT_STYLE_TIME_SPECIFICA...
I think the only error in this:
rrdtool fetch $I MAX -r 900 -s "12am Mar 1" -e "12am Mar 27" | egrep
is that you specified "12am" instead of "12:00am" and didn't specify a year. So try "12:00am Mar 1 2015" for your start time. If you don't specify a time of day, the year doesn't seem to be required, and I would expect would default to the current year.
J
Nifty! I stand corrected... Had no idea RRDtool's date parsing was that advanced :)
-jc
Many thanks guys, thanks a lot of good info.
CC
On Tue, Mar 31, 2015 at 12:13 AM, J.C. Cleaver <cleaver at terabithia.org> wrote:
On Sun, March 29, 2015 10:37 pm, Jeremy Laidman wrote:
On 30 March 2015 at 14:37, J.C. Cleaver <cleaver at terabithia.org> wrote:
For the start and end options to rrdtool, it's actually expecting unix epoch timestamps.
Actually, rrdgraph also has pretty good parsing, not necessarily requiring epoch-times. For example you can say:
-s "end-1week" -e "now-2d"
meaning "from 2 days ago to one week before then".
and
-s "-1week" -e "s+2d"
meaning "from 1 week ago to 2 days after then". ("s"="start"; "e"="end"; "-1week" = "now-1week").
Can also specify dates in human-readable form as long as they comply with the AT-STYLE time specification:
https://oss.oetiker.ch/rrdtool/doc/rrdfetch.en.html#IAT_STYLE_TIME_SPECIFICA...
I think the only error in this:
rrdtool fetch $I MAX -r 900 -s "12am Mar 1" -e "12am Mar 27" | egrep
is that you specified "12am" instead of "12:00am" and didn't specify a year. So try "12:00am Mar 1 2015" for your start time. If you don't specify a time of day, the year doesn't seem to be required, and I would expect would default to the current year.
J
Nifty! I stand corrected... Had no idea RRDtool's date parsing was that advanced :)
-jc
participants (3)
-
cleaver@terabithia.org
-
colin.coe@gmail.com
-
jlaidman@rebel-it.com.au