如何将许多RRD文件导出到XML文件
我有一组旧的RRD文件,因此我需要将它们转换为XML文件,然后在新服务器中再次转换为RRD文件。为了从整个目录创建XML文件,我使用了以下简单bash脚本。
#!/bin/bash
cd /varcacti/rra
for i in ./traffic_in*;
do
/usr/local/rrdtool/bin/rrdtool dump $i /home/newuser/rrd_dump_xml/$i.xml;
done
这提供了一组XML文件,但扩展名并不是我实际需要的。这提供了,
traffic_in_1111.rrd>>>traffic_in_1111.rrd.xml
但是我需要friffate_in_1111.rrd>>> clocals_in_1111.xml
。有人可以帮助我修改我的代码吗?
I have set of old rrd files, so I need to convert them to xml files and again to rrd files in a new server. In order to create xml files from whole directory, I have used following simple bash script.
#!/bin/bash
cd /varcacti/rra
for i in ./traffic_in*;
do
/usr/local/rrdtool/bin/rrdtool dump $i /home/newuser/rrd_dump_xml/$i.xml;
done
This provides a set of xml files but the extension is not what I required actually. This provides,
traffic_in_1111.rrd>>>traffic_in_1111.rrd.xml
But I need traffic_in_1111.rrd>>>traffic_in_1111.xml
. can someone help me to modify my code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要
从字符串末端删除RRD扩展名。
您可能希望更具体地说明您要循环的文件:
You want
which removes the rrd extension from the end of the string.
You might want to be more specific with the files you're looping over: