Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
6a552c9a
Commit
6a552c9a
authored
Dec 10, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
По аналогии с другими процессами (MySQL,SQLite) переименовал RRDStorage --> RRDServer
parent
a8384a95
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
27 additions
and
622 deletions
+27
-622
configure.ac
configure.ac
+2
-2
Makefile.am
extensions/RRDServer/Makefile.am
+2
-9
RRDServer.cc
extensions/RRDServer/RRDServer.cc
+14
-15
RRDServer.h
extensions/RRDServer/RRDServer.h
+4
-4
create_links.sh
extensions/RRDServer/create_links.sh
+2
-3
main.cc
extensions/RRDServer/main.cc
+3
-3
start_fg.sh
extensions/RRDServer/start_fg.sh
+0
-1
Makefile.am
extensions/RRDStorage/Makefile.am
+0
-33
RRDStorage.cc
extensions/RRDStorage/RRDStorage.cc
+0
-337
RRDStorage.h
extensions/RRDStorage/RRDStorage.h
+0
-109
create_links.sh
extensions/RRDStorage/create_links.sh
+0
-6
libUniSetRRDStorage.pc.in
extensions/RRDStorage/libUniSetRRDStorage.pc.in
+0
-11
main.cc
extensions/RRDStorage/main.cc
+0
-84
start_fg.sh
extensions/RRDStorage/start_fg.sh
+0
-5
No files found.
configure.ac
View file @
6a552c9a
...
@@ -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/RRDS
torage
/Makefile
extensions/RRDS
erver
/Makefile
extensions/RRDS
torage/libUniSetRRDStorage
.pc
extensions/RRDS
erver/libUniSetRRDServer
.pc
extensions/tests/Makefile
extensions/tests/Makefile
python/lib/Makefile
python/lib/Makefile
python/lib/pyUniSet/Makefile
python/lib/pyUniSet/Makefile
...
...
extensions/RRDServer/Makefile.am
View file @
6a552c9a
if
DISABLE_RRD
bin_PROGRAMS
=
@PACKAGE@-rrdserver
else
bin_PROGRAMS
=
@PACKAGE@-rrdserver
RRD_VER
=
@LIBVER@
RRD_VER
=
@LIBVER@
lib_LTLIBRARIES
=
libUniSetRRDServer.la
lib_LTLIBRARIES
=
libUniSetRRDServer.la
libUniSetRRDServer_la_LDFLAGS
=
-version-info
$(RRD_VER)
libUniSetRRDServer_la_LDFLAGS
=
-version-info
$(RRD_VER)
libUniSetRRDServer_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
\
...
@@ -35,5 +31,3 @@ pkgconfig_DATA = libUniSetRRDServer.pc
...
@@ -35,5 +31,3 @@ pkgconfig_DATA = libUniSetRRDServer.pc
all-local
:
all-local
:
ln
-sf
../RRDServer/
$(devel_include_HEADERS)
../include
ln
-sf
../RRDServer/
$(devel_include_HEADERS)
../include
endif
\ No newline at end of file
extensions/RRDServer/RRDServer.cc
View file @
6a552c9a
...
@@ -58,9 +58,9 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
...
@@ -58,9 +58,9 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
bool
overwrite
=
it
.
getPIntProp
(
"overwrite"
,
0
);
bool
overwrite
=
it
.
getPIntProp
(
"overwrite"
,
0
);
if
(
RRDServer
::
dlog
.
debugging
(
Debug
::
INFO
)
)
if
(
RRDServer
::
dlog
.
debugging
(
Debug
::
INFO
)
)
RRDServer
::
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
<<
endl
;
<<
endl
;
...
@@ -180,12 +180,12 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
...
@@ -180,12 +180,12 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
if
(
!
overwrite
&&
file_exist
(
fname
)
)
if
(
!
overwrite
&&
file_exist
(
fname
)
)
{
{
if
(
RRDServer
::
dlog
.
debugging
(
Debug
::
INFO
)
)
if
(
RRDServer
::
dlog
.
debugging
(
Debug
::
INFO
)
)
RRDServer
::
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
{
{
rrd_clear_error
();
rrd_clear_error
();
if
(
rrd_create_r
(
fname
.
c_str
(),
rrdstep
,
lastup
,
argc
,(
const
char
**
)
argv
)
<
0
)
if
(
rrd_create_r
(
fname
.
c_str
(),
rrdstep
,
lastup
,
argc
,(
const
char
**
)
argv
)
<
0
)
{
{
ostringstream
err
;
ostringstream
err
;
...
@@ -205,11 +205,11 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
...
@@ -205,11 +205,11 @@ void RRDServer::initRRD( xmlNode* cnode, int tmID )
rrdlist
.
push_back
(
rrd
);
rrdlist
.
push_back
(
rrd
);
}
}
/* catch( Exception& ex )
/* catch( Exception& ex )
{
{
RRDServer::dlog[Debug::CRIT] << myname << "(init) " << ex << std::endl;
RRDServer::dlog[Debug::CRIT] << myname << "(init) " << ex << std::endl;
}
}
catch( ... )
catch( ... )
{
{
RRDServer::dlog[Debug::CRIT] << myname << "(init): catch ..." << std::endl;
RRDServer::dlog[Debug::CRIT] << myname << "(init): catch ..." << std::endl;
}
}
*/
*/
...
@@ -219,13 +219,13 @@ void RRDServer::help_print( int argc, const char* const* argv )
...
@@ -219,13 +219,13 @@ 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: RRDServer1. "
<<
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
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
RRDServer
*
RRDServer
::
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"
,
"RRDServer"
);
string
name
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-name"
,
"RRDServer"
);
...
@@ -238,7 +238,7 @@ RRDServer* RRDServer::init_rrdstorage( int argc, const char* const* argv,
...
@@ -238,7 +238,7 @@ RRDServer* RRDServer::init_rrdstorage( int argc, const char* const* argv,
ObjectId
ID
=
conf
->
getObjectID
(
name
);
ObjectId
ID
=
conf
->
getObjectID
(
name
);
if
(
ID
==
UniSetTypes
::
DefaultObjectId
)
if
(
ID
==
UniSetTypes
::
DefaultObjectId
)
{
{
UniSetExtensions
::
dlog
[
Debug
::
CRIT
]
<<
"(RRDServer): 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
;
}
}
...
@@ -266,7 +266,7 @@ void RRDServer::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -266,7 +266,7 @@ void RRDServer::askSensors( UniversalIO::UIOCommand cmd )
try
try
{
{
shm
->
askSensor
(
s
->
first
,
cmd
);
shm
->
askSensor
(
s
->
first
,
cmd
);
}
}
catch
(
std
::
exception
&
ex
)
catch
(
std
::
exception
&
ex
)
{
{
RRDServer
::
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(askSensors): "
<<
ex
.
what
()
<<
endl
;
RRDServer
::
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(askSensors): "
<<
ex
.
what
()
<<
endl
;
...
@@ -285,7 +285,7 @@ void RRDServer::sysCommand( UniSetTypes::SystemMessage* sm )
...
@@ -285,7 +285,7 @@ void RRDServer::sysCommand( UniSetTypes::SystemMessage* sm )
try
try
{
{
askTimer
(
it
->
tid
,
it
->
sec
*
1000
);
askTimer
(
it
->
tid
,
it
->
sec
*
1000
);
}
}
catch
(
std
::
exception
&
ex
)
catch
(
std
::
exception
&
ex
)
{
{
RRDServer
::
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(askTimer): "
<<
ex
.
what
()
<<
endl
;
RRDServer
::
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(askTimer): "
<<
ex
.
what
()
<<
endl
;
...
@@ -321,7 +321,7 @@ void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
...
@@ -321,7 +321,7 @@ void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
if
(
RRDServer
::
dlog
.
debugging
(
Debug
::
INFO
)
)
if
(
RRDServer
::
dlog
.
debugging
(
Debug
::
INFO
)
)
RRDServer
::
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
();
if
(
rrd_update_r
(
it
->
filename
.
c_str
(),
NULL
,
1
,
&
argv
)
<
0
)
if
(
rrd_update_r
(
it
->
filename
.
c_str
(),
NULL
,
1
,
&
argv
)
<
0
)
{
{
...
@@ -335,4 +335,3 @@ void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
...
@@ -335,4 +335,3 @@ void RRDServer::timerInfo( UniSetTypes::TimerMessage* tm )
}
}
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
extensions/RRDServer/RRDServer.h
View file @
6a552c9a
...
@@ -61,9 +61,9 @@ class RRDServer:
...
@@ -61,9 +61,9 @@ class RRDServer:
RRDServer
(
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
~
RRDServer
();
virtual
~
RRDServer
();
/*! глобальная функция для инициализации объекта */
/*! глобальная функция для инициализации объекта */
static
RRDServer
*
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"
);
...
@@ -100,14 +100,14 @@ class RRDServer:
...
@@ -100,14 +100,14 @@ class RRDServer:
long
tid
;
long
tid
;
long
sec
;
long
sec
;
DSMap
dsmap
;
DSMap
dsmap
;
RRDInfo
(
const
std
::
string
&
fname
,
long
tmID
,
long
sec
,
const
DSMap
&
ds
)
:
RRDInfo
(
const
std
::
string
&
fname
,
long
tmID
,
long
sec
,
const
DSMap
&
ds
)
:
filename
(
fname
),
tid
(
tmID
),
sec
(
sec
),
dsmap
(
ds
){}
filename
(
fname
),
tid
(
tmID
),
sec
(
sec
),
dsmap
(
ds
){}
};
};
typedef
std
::
list
<
RRDInfo
>
RRDList
;
typedef
std
::
list
<
RRDInfo
>
RRDList
;
RRDList
rrdlist
;
RRDList
rrdlist
;
private
:
private
:
...
...
extensions/RRDServer/create_links.sh
View file @
6a552c9a
#!/bin/sh
#!/bin/sh
ln
-s
-f
../../Utilities/scripts/uniset-start.sh
ln
-s
-f
../../Utilities/scripts/uniset-start.sh
ln
-s
-f
../../Utilities/scripts/uniset-stop.sh stop.sh
ln
-s
-f
../../Utilities/scripts/uniset-stop.sh stop.sh
ln
-s
-f
../../Utilities/scripts/uniset-functions.sh
ln
-s
-f
../../Utilities/scripts/uniset-functions.sh
ln
-s
-f
../../conf/test.xml test.xml
ln
-s
-f
../../conf/test.xml test.xml
extensions/RRDServer/main.cc
View file @
6a552c9a
...
@@ -29,9 +29,9 @@ int main( int argc, const char** argv )
...
@@ -29,9 +29,9 @@ int main( int argc, const char** argv )
string
logfilename
(
conf
->
getArgParam
(
"--rrdstorage-logfile"
));
string
logfilename
(
conf
->
getArgParam
(
"--rrdstorage-logfile"
));
if
(
logfilename
.
empty
()
)
if
(
logfilename
.
empty
()
)
logfilename
=
"rrdstorage.log"
;
logfilename
=
"rrdstorage.log"
;
conf
->
initDebug
(
dlog
,
"dlog"
);
conf
->
initDebug
(
dlog
,
"dlog"
);
std
::
ostringstream
logname
;
std
::
ostringstream
logname
;
string
dir
(
conf
->
getLogDir
());
string
dir
(
conf
->
getLogDir
());
logname
<<
dir
<<
logfilename
;
logname
<<
dir
<<
logfilename
;
...
@@ -61,7 +61,7 @@ int main( int argc, const char** argv )
...
@@ -61,7 +61,7 @@ int main( int argc, const char** argv )
ObjectsActivator
act
;
ObjectsActivator
act
;
act
.
addObject
(
static_cast
<
class
UniSetObject
*>
(
db
));
act
.
addObject
(
static_cast
<
class
UniSetObject
*>
(
db
));
SystemMessage
sm
(
SystemMessage
::
StartUp
);
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
.
broadcast
(
sm
.
transport_msg
()
);
act
.
broadcast
(
sm
.
transport_msg
()
);
unideb
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
unideb
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
...
...
extensions/RRDServer/start_fg.sh
View file @
6a552c9a
...
@@ -3,4 +3,3 @@
...
@@ -3,4 +3,3 @@
uniset-start.sh
-f
./uniset-rrdstorage
--confile
test.xml
\
uniset-start.sh
-f
./uniset-rrdstorage
--confile
test.xml
\
--rrd-name
RRDStorage1
\
--rrd-name
RRDStorage1
\
--dlog-add-levels
info,crit,warn
--dlog-add-levels
info,crit,warn
extensions/RRDStorage/Makefile.am
deleted
100644 → 0
View file @
a8384a95
bin_PROGRAMS
=
@PACKAGE@-rrdstorage
RRD_VER
=
@LIBVER@
lib_LTLIBRARIES
=
libUniSetRRDStorage.la
libUniSetRRDStorage_la_LDFLAGS
=
-version-info
$(RRD_VER)
libUniSetRRDStorage_la_LIBADD
=
$(top_builddir)
/lib/libUniSet.la
\
$(top_builddir)
/extensions/SharedMemory/libUniSetSharedMemory.la
\
$(top_builddir)
/extensions/lib/libUniSetExtensions.la
\
$(SIGC_LIBS)
$(RRD_LIBS)
libUniSetRRDStorage_la_CXXFLAGS
=
-I
$(top_builddir)
/extensions/include
\
-I
$(top_builddir)
/extensions/SharedMemory
\
$(SIGC_CFLAGS)
$(RRD_CFLAGS)
libUniSetRRDStorage_la_SOURCES
=
RRDStorage.cc
@PACKAGE@
_rrdstorage_SOURCES
=
main.cc
@PACKAGE@
_rrdstorage_LDADD
=
libUniSetRRDStorage.la
$(top_builddir)
/lib/libUniSet.la
\
$(top_builddir)
/extensions/SharedMemory/libUniSetSharedMemory.la
\
$(top_builddir)
/extensions/lib/libUniSetExtensions.la
\
$(SIGC_LIBS)
$(RRD_LIBS)
@PACKAGE@
_rrdstorage_CXXFLAGS
=
-I
$(top_builddir)
/extensions/include
\
-I
$(top_builddir)
/extensions/SharedMemory
\
$(SIGC_CFLAGS)
$(RRD_CFLAGS)
# install
devel_include_HEADERS
=
*
.h
devel_includedir
=
$(pkgincludedir)
/extensions
pkgconfigdir
=
$(libdir)
/pkgconfig
pkgconfig_DATA
=
libUniSetRRDStorage.pc
all-local
:
ln
-sf
../RRDStorage/
$(devel_include_HEADERS)
../include
extensions/RRDStorage/RRDStorage.cc
deleted
100644 → 0
View file @
a8384a95
This diff is collapsed.
Click to expand it.
extensions/RRDStorage/RRDStorage.h
deleted
100644 → 0
View file @
a8384a95
#ifndef _RRDStorage_H_
#define _RRDStorage_H_
// -----------------------------------------------------------------------------
#include "UObject_SK.h"
#include "SMInterface.h"
#include "SharedMemory.h"
#include "extensions/Extensions.h"
// -----------------------------------------------------------------------------
/*!
"RoundRobinDatabase" - реализация циклического хранилища.
Процесс реализует циклическое хранение данных (от датчиков) и позволяет
конфигурировать любое количество rrd-баз и входящих в них "источников".
Пример секции конфигурации:
\code
<RRDStorage1 name="RRDStorage1">
<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:MAX:0.5:1:4320"/>
</rrd>
<rrd filename="rrdtest2.rrd" filter_field="rrd" filter_value="2" step="10" ds_field="rrd2_ds" overwrite="0">
<item rra="RRA:AVERAGE:0.5:1:4320"/>
<item rra="RRA:MAX:0.5:1:4320"/>
</rrd>
</RRDStorage1>
\endcode
Где:
\b filename - имя создаваемого rrd-файла
\b filter_field - поле у датчика, определяющее, что его нужно сохранять в БД
\b filter_value - значение filter_field, определяющее, что датчик нужно сохранять в БД
\b ds_field - поле определяющее, параметр задающий формат хранения. Если \a ds_field не задано,
то будет браться filter_field+filter_value+'_ds'.
\b step - период обновления данных (в секундах)
\b overwrite - [0,1]. Пересоздавать ли БД, если файл уже существует.
При этом в секции <sensors> у датчиков прописываются параметры относящиеся к источнику:
\code
<sensors>
...
<item id="54" iotype="AI" name="AI54_S" textname="AI sensor 54" rrd="1" rrd1_ds="GAUGE:20:U:U"/>
<item id="55" iotype="AI" name="AI55_S" textname="AI sensor 55" rrd="1" rrd1_ds="GAUGE:20:U:U"/>
<item id="56" iotype="AI" name="AI56_S" textname="AI sensor 56" rrd="2" rrd2_ds="COUNTER:20:U:U"/>
<item id="57" iotype="AI" name="AI57_S" textname="AI sensor 57" rrd="2" rrd2_ds="DERIVE:20:U:U"/>
...
</sensors>
\endcode
*/
class
RRDStorage
:
public
UObject_SK
{
public
:
RRDStorage
(
UniSetTypes
::
ObjectId
objId
,
xmlNode
*
cnode
,
UniSetTypes
::
ObjectId
shmID
,
SharedMemory
*
ic
=
0
,
const
std
::
string
prefix
=
"rrd"
,
DebugStream
&
log
=
UniSetExtensions
::
dlog
);
virtual
~
RRDStorage
();
/*! глобальная функция для инициализации объекта */
static
RRDStorage
*
init_rrdstorage
(
int
argc
,
const
char
*
const
*
argv
,
UniSetTypes
::
ObjectId
shmID
,
SharedMemory
*
ic
=
0
,
const
std
::
string
prefix
=
"rrd"
);
/*! глобальная функция для вывода help-а */
static
void
help_print
(
int
argc
,
const
char
*
const
*
argv
);
protected
:
RRDStorage
();
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
virtual
void
sensorInfo
(
UniSetTypes
::
SensorMessage
*
sm
);
virtual
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
);
virtual
void
sysCommand
(
UniSetTypes
::
SystemMessage
*
sm
);
virtual
void
initRRD
(
xmlNode
*
cnode
,
int
tmID
);
void
step
();
SMInterface
*
shm
;
struct
DSInfo
{
std
::
string
dsname
;
long
value
;
DSInfo
(
const
std
::
string
&
dsname
,
long
defval
)
:
dsname
(
dsname
),
value
(
defval
){}
};
typedef
std
::
map
<
UniSetTypes
::
ObjectId
,
DSInfo
>
DSMap
;
struct
RRDInfo
{
std
::
string
filename
;
long
tid
;
long
sec
;
DSMap
dsmap
;
RRDInfo
(
const
std
::
string
&
fname
,
long
tmID
,
long
sec
,
const
DSMap
&
ds
)
:
filename
(
fname
),
tid
(
tmID
),
sec
(
sec
),
dsmap
(
ds
){}
};
typedef
std
::
list
<
RRDInfo
>
RRDList
;
RRDList
rrdlist
;
private
:
std
::
string
prefix
;
};
// -----------------------------------------------------------------------------
#endif // _RRDStorage_H_
// -----------------------------------------------------------------------------
extensions/RRDStorage/create_links.sh
deleted
100755 → 0
View file @
a8384a95
#!/bin/sh
ln
-s
-f
../../Utilities/scripts/uniset-start.sh
ln
-s
-f
../../Utilities/scripts/uniset-stop.sh stop.sh
ln
-s
-f
../../Utilities/scripts/uniset-functions.sh
ln
-s
-f
../../conf/test.xml test.xml
extensions/RRDStorage/libUniSetRRDStorage.pc.in
deleted
100644 → 0
View file @
a8384a95
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libUniSetRRDStorage
Description: Support library for UniSetRRDStorage
Requires: libUniSetExtensions librrd
Version: @VERSION@
Libs: -L${libdir} -lUniSetRRDStorage
Cflags: -I${includedir}/uniset
extensions/RRDStorage/main.cc
deleted
100644 → 0
View file @
a8384a95
#include <sstream>
#include "RRDStorage.h"
#include "Configuration.h"
#include "Debug.h"
#include "ObjectsActivator.h"
#include "Extensions.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
using
namespace
UniSetExtensions
;
// -----------------------------------------------------------------------------
int
main
(
int
argc
,
const
char
**
argv
)
{
if
(
argc
>
1
&&
(
!
strcmp
(
argv
[
1
],
"--help"
)
||
!
strcmp
(
argv
[
1
],
"-h"
))
)
{
cout
<<
"--smemory-id objectName - SharedMemory objectID. Default: autodetect"
<<
endl
;
cout
<<
"--confile filename - configuration file. Default: configure.xml"
<<
endl
;
cout
<<
"--rrdstorage-logfile filename - logfilename. Default: rrdstorage.log"
<<
endl
;
cout
<<
endl
;
RRDStorage
::
help_print
(
argc
,
argv
);
return
0
;
}
try
{
string
confile
=
UniSetTypes
::
getArgParam
(
"--confile"
,
argc
,
argv
,
"configure.xml"
);
conf
=
new
Configuration
(
argc
,
argv
,
confile
);
string
logfilename
(
conf
->
getArgParam
(
"--rrdstorage-logfile"
));
if
(
logfilename
.
empty
()
)
logfilename
=
"rrdstorage.log"
;
conf
->
initDebug
(
dlog
,
"dlog"
);
std
::
ostringstream
logname
;
string
dir
(
conf
->
getLogDir
());
logname
<<
dir
<<
logfilename
;
unideb
.
logFile
(
logname
.
str
()
);
dlog
.
logFile
(
logname
.
str
()
);
ObjectId
shmID
=
DefaultObjectId
;
string
sID
=
conf
->
getArgParam
(
"--smemory-id"
);
if
(
!
sID
.
empty
()
)
shmID
=
conf
->
getControllerID
(
sID
);
else
shmID
=
getSharedMemoryID
();
if
(
shmID
==
DefaultObjectId
)
{
cerr
<<
sID
<<
"? SharedMemoryID not found in "
<<
conf
->
getControllersSection
()
<<
" section"
<<
endl
;
return
1
;
}
RRDStorage
*
db
=
RRDStorage
::
init_rrdstorage
(
argc
,
argv
,
shmID
);
if
(
!
db
)
{
dlog
[
Debug
::
CRIT
]
<<
"(rrdstorage): init не прошёл..."
<<
endl
;
return
1
;
}
ObjectsActivator
act
;
act
.
addObject
(
static_cast
<
class
UniSetObject
*>
(
db
));
SystemMessage
sm
(
SystemMessage
::
StartUp
);
act
.
broadcast
(
sm
.
transport_msg
()
);
unideb
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
unideb
[
Debug
::
ANY
]
<<
"(main): -------------- RRDStorage START -------------------------
\n\n
"
;
dlog
(
Debug
::
ANY
)
<<
"
\n\n\n
"
;
dlog
[
Debug
::
ANY
]
<<
"(main): -------------- RRDStorage START -------------------------
\n\n
"
;
act
.
run
(
false
);
return
0
;
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
dlog
[
Debug
::
CRIT
]
<<
"(rrdstorage): "
<<
ex
<<
std
::
endl
;
}
catch
(...)
{
dlog
[
Debug
::
CRIT
]
<<
"(rrdstorage): catch ..."
<<
std
::
endl
;
}
return
1
;
}
extensions/RRDStorage/start_fg.sh
deleted
100755 → 0
View file @
a8384a95
#!/bin/sh
uniset-start.sh
-f
./uniset-rrdstorage
--confile
test.xml
\
--rrd-name
RRDStorage1
\
--dlog-add-levels
info,crit,warn
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment