Commit c1f65aed authored by Pavel Vainerman's avatar Pavel Vainerman

По аналогии с другими процессами (MySQL,SQLite) переименовал RRDStorage --> RRDServer

parent 139d4132
...@@ -262,8 +262,8 @@ AC_CONFIG_FILES([Makefile ...@@ -262,8 +262,8 @@ AC_CONFIG_FILES([Makefile
extensions/SharedMemory/Makefile extensions/SharedMemory/Makefile
extensions/SharedMemory/libUniSetSharedMemory.pc extensions/SharedMemory/libUniSetSharedMemory.pc
extensions/SharedMemoryPlus/Makefile extensions/SharedMemoryPlus/Makefile
extensions/RRDStorage/Makefile extensions/RRDServer/Makefile
extensions/RRDStorage/libUniSetRRDStorage.pc extensions/RRDServer/libUniSetRRDServer.pc
extensions/tests/Makefile extensions/tests/Makefile
python/lib/Makefile python/lib/Makefile
python/lib/pyUniSet/Makefile python/lib/pyUniSet/Makefile
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
if HAVE_EXTENTIONS if HAVE_EXTENTIONS
SUBDIRS = lib include SharedMemory IOControl LogicProcessor \ SUBDIRS = lib include SharedMemory IOControl LogicProcessor \
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \ ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP DBServer-MySQL DBServer-SQLite \
RRDStorage SharedMemoryPlus tests RRDServer SharedMemoryPlus tests
#SMDBServer #SMDBServer
#SharedMemoryPlus #SharedMemoryPlus
#UDPExchange #UDPExchange
......
bin_PROGRAMS = @PACKAGE@-rrdstorage bin_PROGRAMS = @PACKAGE@-rrdserver
RRD_VER=@LIBVER@ RRD_VER=@LIBVER@
lib_LTLIBRARIES = libUniSetRRDStorage.la lib_LTLIBRARIES = libUniSetRRDServer.la
libUniSetRRDStorage_la_LDFLAGS = -version-info $(RRD_VER) libUniSetRRDServer_la_LDFLAGS = -version-info $(RRD_VER)
libUniSetRRDStorage_la_LIBADD = $(top_builddir)/lib/libUniSet.la \ libUniSetRRDServer_la_LIBADD = $(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la \ $(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la \
$(top_builddir)/extensions/lib/libUniSetExtensions.la \ $(top_builddir)/extensions/lib/libUniSetExtensions.la \
$(SIGC_LIBS) $(RRD_LIBS) $(SIGC_LIBS) $(RRD_LIBS)
libUniSetRRDStorage_la_CXXFLAGS = -I$(top_builddir)/extensions/include \ libUniSetRRDServer_la_CXXFLAGS = -I$(top_builddir)/extensions/include \
-I$(top_builddir)/extensions/SharedMemory \ -I$(top_builddir)/extensions/SharedMemory \
$(SIGC_CFLAGS) $(RRD_CFLAGS) $(SIGC_CFLAGS) $(RRD_CFLAGS)
libUniSetRRDStorage_la_SOURCES = RRDStorage.cc libUniSetRRDServer_la_SOURCES = RRDServer.cc
@PACKAGE@_rrdstorage_SOURCES = main.cc @PACKAGE@_rrdserver_SOURCES = main.cc
@PACKAGE@_rrdstorage_LDADD = libUniSetRRDStorage.la $(top_builddir)/lib/libUniSet.la \ @PACKAGE@_rrdserver_LDADD = libUniSetRRDServer.la $(top_builddir)/lib/libUniSet.la \
$(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la \ $(top_builddir)/extensions/SharedMemory/libUniSetSharedMemory.la \
$(top_builddir)/extensions/lib/libUniSetExtensions.la \ $(top_builddir)/extensions/lib/libUniSetExtensions.la \
$(SIGC_LIBS) $(RRD_LIBS) $(SIGC_LIBS) $(RRD_LIBS)
@PACKAGE@_rrdstorage_CXXFLAGS = -I$(top_builddir)/extensions/include \ @PACKAGE@_rrdserver_CXXFLAGS = -I$(top_builddir)/extensions/include \
-I$(top_builddir)/extensions/SharedMemory \ -I$(top_builddir)/extensions/SharedMemory \
$(SIGC_CFLAGS) $(RRD_CFLAGS) $(SIGC_CFLAGS) $(RRD_CFLAGS)
...@@ -27,7 +27,7 @@ devel_include_HEADERS = *.h ...@@ -27,7 +27,7 @@ devel_include_HEADERS = *.h
devel_includedir = $(pkgincludedir)/extensions devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSetRRDStorage.pc pkgconfig_DATA = libUniSetRRDServer.pc
all-local: all-local:
ln -sf ../RRDStorage/$(devel_include_HEADERS) ../include ln -sf ../RRDServer/$(devel_include_HEADERS) ../include
...@@ -5,13 +5,13 @@ extern "C" { ...@@ -5,13 +5,13 @@ extern "C" {
#include <cmath> #include <cmath>
#include <sstream> #include <sstream>
#include "Exceptions.h" #include "Exceptions.h"
#include "RRDStorage.h" #include "RRDServer.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
using namespace std; using namespace std;
using namespace UniSetTypes; using namespace UniSetTypes;
using namespace UniSetExtensions; using namespace UniSetExtensions;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
RRDStorage::RRDStorage( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmId, SharedMemory* ic, RRDServer::RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmId, SharedMemory* ic,
const string prefix, DebugStream& log ): const string prefix, DebugStream& log ):
UObject_SK(objId,cnode), UObject_SK(objId,cnode),
shm( new SMInterface(shmId,&ui,objId,ic) ), shm( new SMInterface(shmId,&ui,objId,ic) ),
...@@ -25,7 +25,7 @@ prefix(prefix) ...@@ -25,7 +25,7 @@ prefix(prefix)
{ {
ostringstream err; ostringstream err;
err << myname << "(init): empty rrd list..."; err << myname << "(init): empty rrd list...";
RRDStorage::dlog[Debug::CRIT] << err.str() << endl; RRDServer::dlog[Debug::CRIT] << err.str() << endl;
throw NameNotFound(err.str()); throw NameNotFound(err.str());
} }
...@@ -34,15 +34,15 @@ prefix(prefix) ...@@ -34,15 +34,15 @@ prefix(prefix)
initRRD(it1,tmID); initRRD(it1,tmID);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
RRDStorage::~RRDStorage() RRDServer::~RRDServer()
{ {
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void RRDStorage::step() void RRDServer::step()
{ {
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
void RRDStorage::initRRD( xmlNode* cnode, int tmID ) void RRDServer::initRRD( xmlNode* cnode, int tmID )
{ {
UniXML::iterator it(cnode); UniXML::iterator it(cnode);
...@@ -57,8 +57,8 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -57,8 +57,8 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
int lastup = it.getPIntProp("lastup",0); int lastup = it.getPIntProp("lastup",0);
bool overwrite = it.getPIntProp("overwrite",0); bool overwrite = it.getPIntProp("overwrite",0);
if( RRDStorage::dlog.debugging(Debug::INFO) ) if( RRDServer::dlog.debugging(Debug::INFO) )
RRDStorage::dlog[Debug::INFO] << myname << "(init): add rrd: file='" << fname RRDServer::dlog[Debug::INFO] << myname << "(init): add rrd: file='" << fname
<< " " << ff << "='" << fv << " " << ff << "='" << fv
<< "' create='" << cf << "'" << "' create='" << cf << "'"
<< " step=" << rrdstep << " step=" << rrdstep
...@@ -71,7 +71,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -71,7 +71,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): rrd='" << fname << "' Unknown RRA list"; err << myname << "(init): rrd='" << fname << "' Unknown RRA list";
RRDStorage::dlog[Debug::CRIT] << err.str(); RRDServer::dlog[Debug::CRIT] << err.str();
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -82,7 +82,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -82,7 +82,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): rrd='" << fname << "' Unkown RRA item.. <item rra='...'"; err << myname << "(init): rrd='" << fname << "' Unkown RRA item.. <item rra='...'";
RRDStorage::dlog[Debug::CRIT] << err.str(); RRDServer::dlog[Debug::CRIT] << err.str();
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -93,7 +93,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -93,7 +93,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): Not found RRA items..."; err << myname << "(init): Not found RRA items...";
RRDStorage::dlog[Debug::CRIT] << err.str() << endl; RRDServer::dlog[Debug::CRIT] << err.str() << endl;
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -105,7 +105,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -105,7 +105,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): Not found section <sensors>"; err << myname << "(init): Not found section <sensors>";
RRDStorage::dlog[Debug::CRIT] << err.str(); RRDServer::dlog[Debug::CRIT] << err.str();
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -114,7 +114,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -114,7 +114,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): section <sensors> empty?!"; err << myname << "(init): section <sensors> empty?!";
RRDStorage::dlog[Debug::CRIT] << err.str(); RRDServer::dlog[Debug::CRIT] << err.str();
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -133,7 +133,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -133,7 +133,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): Unknown create parameters ('" << cf << "')"; err << myname << "(init): Unknown create parameters ('" << cf << "')";
RRDStorage::dlog[Debug::CRIT] << err.str(); RRDServer::dlog[Debug::CRIT] << err.str();
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -147,7 +147,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -147,7 +147,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): Unknown SensorID for '" << dsname << "'"; err << myname << "(init): Unknown SensorID for '" << dsname << "'";
RRDStorage::dlog[Debug::CRIT] << err.str(); RRDServer::dlog[Debug::CRIT] << err.str();
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -159,7 +159,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -159,7 +159,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): Not found RRD items..."; err << myname << "(init): Not found RRD items...";
RRDStorage::dlog[Debug::CRIT] << err.str() << endl; RRDServer::dlog[Debug::CRIT] << err.str() << endl;
throw SystemError(err.str()); throw SystemError(err.str());
} }
...@@ -179,8 +179,8 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -179,8 +179,8 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
// Собственно создаём RRD // Собственно создаём RRD
if( !overwrite && file_exist(fname) ) if( !overwrite && file_exist(fname) )
{ {
if( RRDStorage::dlog.debugging(Debug::INFO) ) if( RRDServer::dlog.debugging(Debug::INFO) )
RRDStorage::dlog[Debug::INFO] << myname << "(init): ignore create file='" << fname RRDServer::dlog[Debug::INFO] << myname << "(init): ignore create file='" << fname
<< "'. File exist... overwrite=0." << endl; << "'. File exist... overwrite=0." << endl;
} }
else else
...@@ -190,7 +190,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -190,7 +190,7 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
{ {
ostringstream err; ostringstream err;
err << myname << "(init): Can`t create RRD ('" << fname << "'): err: " << string(rrd_get_error()); err << myname << "(init): Can`t create RRD ('" << fname << "'): err: " << string(rrd_get_error());
RRDStorage::dlog[Debug::CRIT] << err.str() << endl; RRDServer::dlog[Debug::CRIT] << err.str() << endl;
throw SystemError(err.str()); throw SystemError(err.str());
} }
} }
...@@ -206,39 +206,39 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID ) ...@@ -206,39 +206,39 @@ void RRDStorage::initRRD( xmlNode* cnode, int tmID )
} }
/* catch( Exception& ex ) /* catch( Exception& ex )
{ {
RRDStorage::dlog[Debug::CRIT] << myname << "(init) " << ex << std::endl; RRDServer::dlog[Debug::CRIT] << myname << "(init) " << ex << std::endl;
} }
catch( ... ) catch( ... )
{ {
RRDStorage::dlog[Debug::CRIT] << myname << "(init): catch ..." << std::endl; RRDServer::dlog[Debug::CRIT] << myname << "(init): catch ..." << std::endl;
} }
*/ */
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
void RRDStorage::help_print( int argc, const char* const* argv ) void RRDServer::help_print( int argc, const char* const* argv )
{ {
cout << " Default prefix='rrd'" << endl; cout << " Default prefix='rrd'" << endl;
cout << "--prefix-name - ID for rrdstorage. Default: RRDStorage1. " << endl; cout << "--prefix-name - ID for rrdstorage. Default: RRDServer1. " << endl;
cout << "--prefix-confnode - configuration section name. Default: <NAME name='NAME'...> " << endl; cout << "--prefix-confnode - configuration section name. Default: <NAME name='NAME'...> " << endl;
cout << "--prefix-heartbeat-id name - ID for heartbeat sensor." << endl; cout << "--prefix-heartbeat-id name - ID for heartbeat sensor." << endl;
cout << "--prefix-heartbeat-max val - max value for heartbeat sensor." << endl; cout << "--prefix-heartbeat-max val - max value for heartbeat sensor." << endl;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
RRDStorage* RRDStorage::init_rrdstorage( int argc, const char* const* argv, RRDServer* RRDServer::init_rrdstorage( int argc, const char* const* argv,
UniSetTypes::ObjectId icID, SharedMemory* ic, UniSetTypes::ObjectId icID, SharedMemory* ic,
const std::string prefix ) const std::string prefix )
{ {
string name = conf->getArgParam("--" + prefix + "-name","RRDStorage"); string name = conf->getArgParam("--" + prefix + "-name","RRDServer");
if( name.empty() ) if( name.empty() )
{ {
UniSetExtensions::dlog[Debug::CRIT] << "(RRDStorage): Unknown name. Usage: --" << prefix << "-name" << endl; UniSetExtensions::dlog[Debug::CRIT] << "(RRDServer): Unknown name. Usage: --" << prefix << "-name" << endl;
return 0; return 0;
} }
ObjectId ID = conf->getObjectID(name); ObjectId ID = conf->getObjectID(name);
if( ID == UniSetTypes::DefaultObjectId ) if( ID == UniSetTypes::DefaultObjectId )
{ {
UniSetExtensions::dlog[Debug::CRIT] << "(RRDStorage): Not found ID for '" << name UniSetExtensions::dlog[Debug::CRIT] << "(RRDServer): Not found ID for '" << name
<< " in '" << conf->getObjectsSection() << "' section" << endl; << " in '" << conf->getObjectsSection() << "' section" << endl;
return 0; return 0;
} }
...@@ -247,15 +247,15 @@ RRDStorage* RRDStorage::init_rrdstorage( int argc, const char* const* argv, ...@@ -247,15 +247,15 @@ RRDStorage* RRDStorage::init_rrdstorage( int argc, const char* const* argv,
xmlNode* cnode = conf->getNode(confname); xmlNode* cnode = conf->getNode(confname);
if( !cnode ) if( !cnode )
{ {
UniSetExtensions::dlog[Debug::CRIT] << "(RRDStorage): " << name << "(init): Not found <" + confname + ">" << endl; UniSetExtensions::dlog[Debug::CRIT] << "(RRDServer): " << name << "(init): Not found <" + confname + ">" << endl;
return 0; return 0;
} }
UniSetExtensions::dlog[Debug::INFO] << "(RRDStorage): name = " << name << "(" << ID << ")" << endl; UniSetExtensions::dlog[Debug::INFO] << "(RRDServer): name = " << name << "(" << ID << ")" << endl;
return new RRDStorage(ID,cnode,icID,ic,prefix); return new RRDServer(ID,cnode,icID,ic,prefix);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void RRDStorage::askSensors( UniversalIO::UIOCommand cmd ) void RRDServer::askSensors( UniversalIO::UIOCommand cmd )
{ {
UObject_SK::askSensors(cmd); UObject_SK::askSensors(cmd);
...@@ -269,13 +269,13 @@ void RRDStorage::askSensors( UniversalIO::UIOCommand cmd ) ...@@ -269,13 +269,13 @@ void RRDStorage::askSensors( UniversalIO::UIOCommand cmd )
} }
catch( std::exception& ex ) catch( std::exception& ex )
{ {
RRDStorage::dlog[Debug::CRIT] << myname << "(askSensors): " << ex.what() << endl; RRDServer::dlog[Debug::CRIT] << myname << "(askSensors): " << ex.what() << endl;
} }
} }
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void RRDStorage::sysCommand( UniSetTypes::SystemMessage* sm ) void RRDServer::sysCommand( UniSetTypes::SystemMessage* sm )
{ {
UObject_SK::sysCommand(sm); UObject_SK::sysCommand(sm);
if( sm->command == SystemMessage::StartUp || sm->command == SystemMessage::WatchDog ) if( sm->command == SystemMessage::StartUp || sm->command == SystemMessage::WatchDog )
...@@ -288,13 +288,13 @@ void RRDStorage::sysCommand( UniSetTypes::SystemMessage* sm ) ...@@ -288,13 +288,13 @@ void RRDStorage::sysCommand( UniSetTypes::SystemMessage* sm )
} }
catch( std::exception& ex ) catch( std::exception& ex )
{ {
RRDStorage::dlog[Debug::CRIT] << myname << "(askTimer): " << ex.what() << endl; RRDServer::dlog[Debug::CRIT] << myname << "(askTimer): " << ex.what() << endl;
} }
} }
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void RRDStorage::sensorInfo( UniSetTypes::SensorMessage* sm ) void RRDServer::sensorInfo( UniSetTypes::SensorMessage* sm )
{ {
for( RRDList::iterator it=rrdlist.begin(); it!=rrdlist.end(); ++it ) for( RRDList::iterator it=rrdlist.begin(); it!=rrdlist.end(); ++it )
{ {
...@@ -306,7 +306,7 @@ void RRDStorage::sensorInfo( UniSetTypes::SensorMessage* sm ) ...@@ -306,7 +306,7 @@ void RRDStorage::sensorInfo( UniSetTypes::SensorMessage* sm )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void RRDStorage::timerInfo( UniSetTypes::TimerMessage* tm ) void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
{ {
for( RRDList::iterator it=rrdlist.begin(); it!=rrdlist.end(); ++it ) for( RRDList::iterator it=rrdlist.begin(); it!=rrdlist.end(); ++it )
{ {
...@@ -318,8 +318,8 @@ void RRDStorage::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -318,8 +318,8 @@ void RRDStorage::timerInfo( UniSetTypes::TimerMessage* tm )
for( DSMap::iterator s=it->dsmap.begin(); s!=it->dsmap.end(); ++s ) for( DSMap::iterator s=it->dsmap.begin(); s!=it->dsmap.end(); ++s )
v << ":" << s->second.value; v << ":" << s->second.value;
if( RRDStorage::dlog.debugging(Debug::INFO) ) if( RRDServer::dlog.debugging(Debug::INFO) )
RRDStorage::dlog[Debug::INFO] << myname << "(update): '" << it->filename << "' " << v.str() << endl; RRDServer::dlog[Debug::INFO] << myname << "(update): '" << it->filename << "' " << v.str() << endl;
rrd_clear_error(); rrd_clear_error();
const char* argv = v.str().c_str(); const char* argv = v.str().c_str();
...@@ -327,7 +327,7 @@ void RRDStorage::timerInfo( UniSetTypes::TimerMessage* tm ) ...@@ -327,7 +327,7 @@ void RRDStorage::timerInfo( UniSetTypes::TimerMessage* tm )
{ {
ostringstream err; ostringstream err;
err << myname << "(update): Can`t update RRD ('" << it->filename << "'): err: " << string(rrd_get_error()); err << myname << "(update): Can`t update RRD ('" << it->filename << "'): err: " << string(rrd_get_error());
RRDStorage::dlog[Debug::CRIT] << err.str() << endl; RRDServer::dlog[Debug::CRIT] << err.str() << endl;
} }
break; break;
......
#ifndef _RRDStorage_H_ #ifndef _RRDServer_H_
#define _RRDStorage_H_ #define _RRDServer_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#include "UObject_SK.h" #include "UObject_SK.h"
#include "SMInterface.h" #include "SMInterface.h"
...@@ -7,13 +7,22 @@ ...@@ -7,13 +7,22 @@
#include "extensions/Extensions.h" #include "extensions/Extensions.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
/*! /*!
\page page_RRDServer Реализация RRD хранилища
- \ref sec_RRD_Comm
- \ref sec_RRD_Conf
\section sec_RRD_Comm Общее описание RRDServer
"RoundRobinDatabase" - реализация циклического хранилища. "RoundRobinDatabase" - реализация циклического хранилища.
Процесс реализует циклическое хранение данных (от датчиков) и позволяет Процесс реализует циклическое хранение данных (от датчиков) и позволяет
конфигурировать любое количество rrd-баз и входящих в них "источников". конфигурировать любое количество rrd-баз и входящих в них "источников".
\section sec_RRD_Conf Настройка RRDServer
Пример секции конфигурации: Пример секции конфигурации:
\code \code
<RRDStorage1 name="RRDStorage1"> <RRDServer1 name="RRDServer1">
<rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0"> <rrd filename="rrdtest.rrd" filter_field="rrd" filter_value="1" step="5" ds_field="rrd1_ds" overwrite="0">
<item rra="RRA:AVERAGE:0.5:1:4320"/> <item rra="RRA:AVERAGE:0.5:1:4320"/>
<item rra="RRA:MAX:0.5:1:4320"/> <item rra="RRA:MAX:0.5:1:4320"/>
...@@ -22,16 +31,16 @@ ...@@ -22,16 +31,16 @@
<item rra="RRA:AVERAGE:0.5:1:4320"/> <item rra="RRA:AVERAGE:0.5:1:4320"/>
<item rra="RRA:MAX:0.5:1:4320"/> <item rra="RRA:MAX:0.5:1:4320"/>
</rrd> </rrd>
</RRDStorage1> </RRDServer1>
\endcode \endcode
Где: Где:
\b filename - имя создаваемого rrd-файла - \b filename - имя создаваемого rrd-файла
\b filter_field - поле у датчика, определяющее, что его нужно сохранять в БД - \b filter_field - поле у датчика, определяющее, что его нужно сохранять в БД
\b filter_value - значение filter_field, определяющее, что датчик нужно сохранять в БД - \b filter_value - значение \b filter_field, определяющее, что датчик нужно сохранять в БД
\b ds_field - поле определяющее, параметр задающий формат хранения. Если \a ds_field не задано, - \b ds_field - поле определяющее, параметр задающий формат хранения. Если \a ds_field не задано,
то будет браться filter_field+filter_value+'_ds'. то будет браться filter_field+filter_value+'_ds'.
\b step - период обновления данных (в секундах) - \b step - период обновления данных (в секундах)
\b overwrite - [0,1]. Пересоздавать ли БД, если файл уже существует. - \b overwrite - [0,1]. Пересоздавать ли БД, если файл уже существует.
При этом в секции <sensors> у датчиков прописываются параметры относящиеся к источнику: При этом в секции <sensors> у датчиков прописываются параметры относящиеся к источнику:
\code \code
...@@ -45,16 +54,16 @@ ...@@ -45,16 +54,16 @@
</sensors> </sensors>
\endcode \endcode
*/ */
class RRDStorage: class RRDServer:
public UObject_SK public UObject_SK
{ {
public: public:
RRDStorage( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmID, SharedMemory* ic=0, RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="rrd", DebugStream& log=UniSetExtensions::dlog ); const std::string prefix="rrd", DebugStream& log=UniSetExtensions::dlog );
virtual ~RRDStorage(); virtual ~RRDServer();
/*! глобальная функция для инициализации объекта */ /*! глобальная функция для инициализации объекта */
static RRDStorage* init_rrdstorage( int argc, const char* const* argv, static RRDServer* init_rrdstorage( int argc, const char* const* argv,
UniSetTypes::ObjectId shmID, SharedMemory* ic=0, UniSetTypes::ObjectId shmID, SharedMemory* ic=0,
const std::string prefix="rrd" ); const std::string prefix="rrd" );
...@@ -62,7 +71,7 @@ class RRDStorage: ...@@ -62,7 +71,7 @@ class RRDStorage:
static void help_print( int argc, const char* const* argv ); static void help_print( int argc, const char* const* argv );
protected: protected:
RRDStorage(); RRDServer();
virtual void askSensors( UniversalIO::UIOCommand cmd ); virtual void askSensors( UniversalIO::UIOCommand cmd );
virtual void sensorInfo( UniSetTypes::SensorMessage* sm ); virtual void sensorInfo( UniSetTypes::SensorMessage* sm );
...@@ -105,5 +114,5 @@ class RRDStorage: ...@@ -105,5 +114,5 @@ class RRDStorage:
std::string prefix; std::string prefix;
}; };
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#endif // _RRDStorage_H_ #endif // _RRDServer_H_
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@ ...@@ -3,9 +3,9 @@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
Name: libUniSetRRDStorage Name: libUniSetRRDServer
Description: Support library for UniSetRRDStorage Description: Support library for UniSetRRDServer
Requires: libUniSetExtensions librrd Requires: libUniSetExtensions librrd
Version: @VERSION@ Version: @VERSION@
Libs: -L${libdir} -lUniSetRRDStorage Libs: -L${libdir} -lUniSetRRDServer
Cflags: -I${includedir}/uniset Cflags: -I${includedir}/uniset
#include <sstream> #include <sstream>
#include "RRDStorage.h" #include "RRDServer.h"
#include "Configuration.h" #include "Configuration.h"
#include "Debug.h" #include "Debug.h"
#include "ObjectsActivator.h" #include "ObjectsActivator.h"
...@@ -17,7 +17,7 @@ int main( int argc, const char** argv ) ...@@ -17,7 +17,7 @@ int main( int argc, const char** argv )
cout << "--confile filename - configuration file. Default: configure.xml" << endl; cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--rrdstorage-logfile filename - logfilename. Default: rrdstorage.log" << endl; cout << "--rrdstorage-logfile filename - logfilename. Default: rrdstorage.log" << endl;
cout << endl; cout << endl;
RRDStorage::help_print(argc, argv); RRDServer::help_print(argc, argv);
return 0; return 0;
} }
...@@ -51,7 +51,7 @@ int main( int argc, const char** argv ) ...@@ -51,7 +51,7 @@ int main( int argc, const char** argv )
return 1; return 1;
} }
RRDStorage* db = RRDStorage::init_rrdstorage(argc,argv,shmID); RRDServer* db = RRDServer::init_rrdstorage(argc,argv,shmID);
if( !db ) if( !db )
{ {
dlog[Debug::CRIT] << "(rrdstorage): init не прошёл..." << endl; dlog[Debug::CRIT] << "(rrdstorage): init не прошёл..." << endl;
...@@ -65,9 +65,9 @@ int main( int argc, const char** argv ) ...@@ -65,9 +65,9 @@ int main( int argc, const char** argv )
act.broadcast( sm.transport_msg() ); act.broadcast( sm.transport_msg() );
unideb(Debug::ANY) << "\n\n\n"; unideb(Debug::ANY) << "\n\n\n";
unideb[Debug::ANY] << "(main): -------------- RRDStorage START -------------------------\n\n"; unideb[Debug::ANY] << "(main): -------------- RRDServer START -------------------------\n\n";
dlog(Debug::ANY) << "\n\n\n"; dlog(Debug::ANY) << "\n\n\n";
dlog[Debug::ANY] << "(main): -------------- RRDStorage START -------------------------\n\n"; dlog[Debug::ANY] << "(main): -------------- RRDServer START -------------------------\n\n";
act.run(false); act.run(false);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment