Rrdtool fetch traffic.rrd


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Rrdtool fetch traffic.rrd
# 1  
Old 07-10-2015
Rrdtool fetch traffic.rrd

Hi, i'm beginer in programmer

I need a script for read file.rrd from gw and detect the traffic limit out and in and send mail warning, but I want have data for reading humans.

I need convert numbers In, Out in Mbps/s

I found this command with awk, but a want in shell

Ex:

Code:
[170]> rrdtool fetch gw_traffic_in_284.rrd AVERAGE -r 300 -s -1h | awk '{printf("%s,%8.2f,%8.2f \n",strftime("%c",$1),$2,$3) } '
Wed 31 Dec 1969 09:00:00 PM BRT,    0.00,    0.00 
Wed 31 Dec 1969 09:00:00 PM BRT,    0.00,    0.00 
Fri 10 Jul 2015 07:40:00 AM BRT,1116652.67,3080062.87 
Fri 10 Jul 2015 07:45:00 AM BRT,1200892.61,2998480.57 
Fri 10 Jul 2015 07:50:00 AM BRT,1048915.63,4203195.82 
Fri 10 Jul 2015 07:55:00 AM BRT,952065.70,3190727.92 
Fri 10 Jul 2015 08:00:00 AM BRT,1428149.07,2839789.27 
Fri 10 Jul 2015 08:05:00 AM BRT,1256617.13,3290977.03 
Fri 10 Jul 2015 08:10:00 AM BRT,1231392.44,2940315.11 
Fri 10 Jul 2015 08:15:00 AM BRT,1207364.64,3181967.30 
Fri 10 Jul 2015 08:20:00 AM BRT,1182385.48,2964647.83 
Fri 10 Jul 2015 08:25:00 AM BRT,1360848.01,3149540.40 
Fri 10 Jul 2015 08:30:00 AM BRT,1060095.91,2853057.13 
Fri 10 Jul 2015 08:35:00 AM BRT,     nan,     nan 
Fri 10 Jul 2015 08:40:00 AM BRT,     nan,     nan

Thanks

Moderator's Comments:
Mod Comment Please use code tags

Last edited by jim mcnamara; 07-10-2015 at 09:06 AM..
# 2  
Old 07-10-2015
So, you require this output using another method? Or do you need something else? Can you please explain what you need.

Also we need to see sample output of rrdtool to help you at all.
# 3  
Old 07-10-2015
Yes, I want this output using shellscript and detect over limit defined in script and send warning mail.

The script has to deal with the traffic values of input and output for Mbps / s

Sample outprint from rrdtool fetch is:

Code:
[172]> rrdtool fetch /usr/local/cacti/rra/gw1_gc_traffic_in_284.rrd AVERAGE -r 300 -s -1h 
                     traffic_in         traffic_out

1436528100: 1.1250047849e+06 3.1314646692e+06
1436528400: 1.3876584112e+06 2.9220966787e+06
1436528700: 1.3133471637e+06 3.1660403672e+06
1436529000: 9.4883384335e+05 2.9144044545e+06
1436529300: 9.1177325293e+05 3.1121635913e+06
1436529600: 1.2453337586e+06 2.9249713178e+06
1436529900: 1.1314101180e+06 3.7632825058e+06
1436530200: 1.1444321559e+06 3.8615344208e+06
1436530500: 1.2826847139e+06 4.2649438309e+06
1436530800: 1.1904438758e+06 4.5972507903e+06
1436531100: 1.0910768134e+06 4.2025452739e+06
1436531400: -nan -nan
1436531700: -nan -nan


Last edited by Don Cragun; 07-10-2015 at 04:34 PM.. Reason: Add CODE tags.
# 4  
Old 07-10-2015
Since it look like maybe you have cacti you might want to invetigate the "theold" plugin for cacti. Then you can easily setup alerts from cacti for things. If that's what you want.

I'm just taking a guess and trying (maybe) to get you to your solution in a better/faster way (?)
# 5  
Old 07-10-2015
Exact is the best solution, but I do not have admin access cacti in my work and I will not have

My boss said if I could create a script to do this by rrdtool

The only way would be to create this script, to read the file, set a limit on mbps, calculate the maximum limit and warn you if you exceed.

Thanks for the tip, but I need to find a way to learn and do this.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Python-rrdtool try except rrdtool.error module object has no attribute error

I have this code that gives this error on Linux and will be grateful if you can help import rrdtool try: ret_asd = rrdtool.update(myfile.rrd,'N:%s:%s' %(metric1, metric2)); except rrdtool.error, e: print e When i run the above i get the below error except... (1 Reply)
Discussion started by: kaf3773
1 Replies

2. Infrastructure Monitoring

JFFNMS: RRD files for imterface id 2190 has not been created by the Poller Process yet

hi, When we tried to add host in jffnms and marked all interfaces, it worked well with newly added hosts for linux. However if its solaris, we cannot see CPU interface. The error in the graph is RRD files for interface id 2190 has not been created by the Poller Process yet. Pls advise. ... (0 Replies)
Discussion started by: lhareigh890
0 Replies

3. Red Hat

Why do we use RRDtool in MRTG?

Hi Guys, Why do we use RRDtool in MRTG? I have implemented MRTG for some routers, I have read some notes about RRDTOOL also but don't know what is use of these tool. Any one one please explain me the use of RRDTOOL in their own words? (1 Reply)
Discussion started by: manalisharmabe
1 Replies

4. Shell Programming and Scripting

Script that will be a cron job to export rrd files for cacti server

I wrote a quick little script that will eventually end up as a cron job to export rrd files for my cacti server. Here is the script: #!/bin/bash rm -rf /backup/cacti_xml/* cd /var/www/html/rra ls -1 *.rrd | awk '{print "rrdtool dump "$1" > /backup/cacti_xml/"$1".xml"}' | sh -x Is there... (5 Replies)
Discussion started by: TheBigAmbulance
5 Replies

5. IP Networking

RRD graph explain

Hi all, I have a graph sent from customer. And i just know this is created using rrdtool after search the web. Based on this graph, 1. I read that it can be set, but is it possible to know what is the time step for each point in this graph? is it 5 minutes or something? 2. Let says it is 5... (4 Replies)
Discussion started by: wilsonSurya
4 Replies

6. Infrastructure Monitoring

moving rrd data to mysql

All I currently run an application called OpenNMS. This is a free enterprise grade NMS. Its current framework uses RRDs to collect performance/node level data such as cpu load via snmp. all data is stored in these RRDs. I was wondering if anyone out there has had a chance or a need to move the... (2 Replies)
Discussion started by: pupp
2 Replies
Login or Register to Ask a Question