1234567891011121314151617181920212223242526272829303132333435363738394041(*
* Copyright (C) 2006-2009 Citrix Systems Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 only. with the special
* exception on linking described in file LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)(*
* RRD Unix module
* This module provides Unix tools for dealing with RRDs
*)(**
* @group Performance Monitoring
*)letfinally=Xapi_stdext_pervasives.Pervasiveext.finallyletwith_out_channel_outputfdf=letoc=Unix.out_channel_of_descrfdinfinally(fun()->letoutput=Xmlm.make_output(`Channeloc)infoutput)(fun()->flushoc)letxml_to_fdrrdfd=with_out_channel_outputfd(Rrd.xml_to_outputrrd)letjson_to_fdrrdfd=letpayload=Rrd.json_to_stringrrd|>Bytes.unsafe_of_stringinletlen=Bytes.lengthpayloadinUnix.writefdpayload0len|>ignoreletto_fd?(json=false)rrdfd=(ifjsonthenjson_to_fdelsexml_to_fd)rrdfd