aqhome: added plugin which writes received values into files. used by munin.
This commit is contained in:
@@ -15,9 +15,11 @@
|
||||
|
||||
#include <aqhome/msgmanager.h>
|
||||
#include <aqhome/msg/endpoint_log.h>
|
||||
#include <aqhome/msg/endpoint_write.h>
|
||||
#include <aqhome/msg/endpoint_tty.h>
|
||||
#include <aqhome/ipc/endpoint_node_ipc_tcpd.h>
|
||||
#include <aqhome/mqtt/endpoint_mqttc.h>
|
||||
#include <aqhome/msg/msg_node.h>
|
||||
|
||||
#include <gwenhywfar/gwenhywfar.h>
|
||||
#include <gwenhywfar/args.h>
|
||||
@@ -57,6 +59,7 @@ static GWEN_MSG_ENDPOINT_MGR *_setupService(GWEN_DB_NODE *dbArgs);
|
||||
|
||||
static int _setupTty(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs);
|
||||
static int _setupLog(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs);
|
||||
static int _setupWriter(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs);
|
||||
static int _setupIpc(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs);
|
||||
static int _setupMqtt(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs);
|
||||
|
||||
@@ -217,6 +220,13 @@ GWEN_MSG_ENDPOINT_MGR *_setupService(GWEN_DB_NODE *dbArgs)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rv=_setupWriter(emgr, dbArgs);
|
||||
if (rv<0) {
|
||||
DBG_INFO(NULL, "here (%d)", rv);
|
||||
GWEN_MsgEndpointMgr_free(emgr);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
rv=_setupIpc(emgr, dbArgs);
|
||||
if (rv<0) {
|
||||
DBG_INFO(NULL, "here (%d)", rv);
|
||||
@@ -283,6 +293,27 @@ int _setupLog(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
|
||||
|
||||
|
||||
|
||||
int _setupWriter(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
|
||||
{
|
||||
const char *writeToFolder;
|
||||
|
||||
writeToFolder=GWEN_DB_GetCharValue(dbArgs, "writeToFolder", 0, NULL);
|
||||
if (writeToFolder && *writeToFolder) {
|
||||
GWEN_MSG_ENDPOINT *epWrite;
|
||||
|
||||
epWrite=AQH_WriteEndpoint_new(writeToFolder, AQH_MSGMGR_ENDPOINTGROUP_NODE);
|
||||
if (epWrite==NULL) {
|
||||
DBG_ERROR(AQH_LOGDOMAIN, "Error creating endpoint WRITE");
|
||||
return GWEN_ERROR_GENERIC;
|
||||
}
|
||||
GWEN_MsgEndpoint_SetAcceptedGroupIds(epWrite, AQH_MSG_TYPEGROUP_INFO | AQH_MSG_TYPEGROUP_VALUES);
|
||||
GWEN_MsgEndpointMgr_AddEndpoint(emgr, epWrite);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int _setupIpc(GWEN_MSG_ENDPOINT_MGR *emgr, GWEN_DB_NODE *dbArgs)
|
||||
{
|
||||
const char *tcpAddress;
|
||||
@@ -491,6 +522,17 @@ int _readArgs(int argc, char **argv, GWEN_DB_NODE *dbArgs)
|
||||
I18S("Specify DB file to read/write node database"),
|
||||
I18S("Specify DB file to read/write node database")
|
||||
},
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
|
||||
GWEN_ArgsType_Char, /* type */
|
||||
"writeToFolder", /* name */
|
||||
0, /* minnum */
|
||||
1, /* maxnum */
|
||||
"W", /* short option */
|
||||
NULL, /* long option */
|
||||
I18S("Specify folder to write received values to"),
|
||||
I18S("Specify folder to write received values to")
|
||||
},
|
||||
{
|
||||
GWEN_ARGS_FLAGS_HAS_ARGUMENT, /* flags */
|
||||
GWEN_ArgsType_Char, /* type */
|
||||
|
||||
Reference in New Issue
Block a user