Sometime the servers in my workplace experience some weird behavior, it happens in random physical racks around different DC's around the world. It seems like there's a networking bandwidth issues between different machine within the same rack and between one rack and anothers in the same DC. All the servers in the each rack have a mount point to an operations server in the same DC. Sometimes when the weird behavior takes place... it seems like there's not enough bandwidth between the various machines and copying files to that mount point on the operations server takes way too long.
In order to measure the problem when it happens I run the following command:
dd if=/dev/zero of=/proxy_dump/test1.dat bs=1024 count=102
The command fills a test1.dat
file on the /proxy_dump
mount point which is on the operations server.
On a server which operates properly, the output will look like that:
[root@nyproxy5 ~]# /bin/dd if=/dev/zero of=/proxy_dump/test1.dat bs=1024 count=102
102+0 records in
102+0 records out
104448 bytes (104 kB) copied, 0.003486 seconds, 30.0 MB/s
[root@nyproxy5 ~]#
On a problematic server during a networking issue:
[user@ams2proxy24 ~]$ dd if=/dev/zero of=/proxy_dump/test1.dat bs=1024 count=102
102+0 records in
102+0 records out
104448 bytes (104 kB) copied, 2.8736 s, 36.3 kB/s
[user@ams2proxy24 ~]$
So, in order to know it happens just when it does... I want to write a Nagios check which will run this command every 5 minutes or so and I want a part of it's output displayed.
The problem is that's i'm unable to redirect the output of the command in any way... not to a file and not into a variable in the script. I want to redirect it somehow in order to parse it and get just the information which interests me.
Does anybody know how to redirect the output of dd
?