Script for maintaining system load in RRD database
I want to make a script which saves the system load average over the last 1/5/15 minutes in a .rrd file every minute.
I created the rrd file as follows: Code:
rrdtool create cpu_load.rrd --start now --step 60 --no-overwrite DS:load1:GAUGE:120:U:U DS:load5:GAUGE:120:U:U DS:load15:GAUGE:120:U:U RRA:AVERAGE:0.5:1:525600 Code:
#!/bin/bash Code:
ERROR: /home/user/rrd/cpu_load.rrd: error while parsing time in get_time_from_reading - Cannot convert '' to float |
#1 you are not showing us where you set TIMESTAMP, and since the error states that is where the problem exists we need to see that code.
#2 Why are you calling AWK? Bash string handling can handle this with less overhead, memory footprint, and disk I/O. Code:
LOADS=`/bin/cat /proc/loadavg` |
Ah right, so stupid mistake, I accidentally deleted the code for timestamp!
So I get it now through Code:
TIMESTAMP=$(date +%s) Is the rrdtool update command correct? |
Quote:
Code:
#!/bin/bash |
You were given excellent advice in another thread for that memory script - all of which you appear to have chosen to ignore.
Study it and apply similar here. |
Quote:
Thanks |
And of course
Code:
read LOAD1_VALUE LOAD5_VALUE LOAD15_VALUE x < /proc/loadavg A single line -> one read, no { code } group needed. |
Quote:
|
Quote:
https://www.linuxquestions.org/quest...1/#post6396413 I wish more people would use the read command and the redirection of a code block. All shell books and tutorials should present it! |
All times are GMT -5. The time now is 09:33 PM. |