Skip to content

Instantly share code, notes, and snippets.

@nekoruri
Created April 7, 2015 09:12
Show Gist options
  • Save nekoruri/4fab0883861de6ee9bf4 to your computer and use it in GitHub Desktop.
Save nekoruri/4fab0883861de6ee9bf4 to your computer and use it in GitHub Desktop.
GrowthForecastで特定期間の値をNaNに落とす
#!/bin/bash
ids="32 33 34 35 36 42 43 44 45 46 47 48 49 50 51"
for id in $ids; do
echo $id
file_base=$(echo -n "$id" | openssl md5 -hex | awk '{print $2}')
files=$(ls -1 ${file_base}{,_s}.rrd)
for file in $files; do
echo " $file"
rrdtool dump $file \
| sed -e '/ 2015-04-07 \(14:[1-5].\|1[56]:..\|17:00\):00 JST/s/<row>.*$/<row><v>NaA<\/v><v>NaA<\/v><\/row>/' \
> $file.xml
rrdtool restore -f $file.xml $file
done
done
@nekoruri
Copy link
Author

nekoruri commented Apr 7, 2015

ファイル名は、DBのgraphsテーブルのIDをMD5してHEXしたもの。
_s無しがデフォルトで、1分グラフの値が_s付きの方。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment