Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - ophelie6989

#1
General Support / Questions about UPS
January 19, 2010, 05:37:25 PM
Hi,
i would like to manage UPS that are link to computer where an Agent is installed. I would like to have the infornations when the UPS is connected ( that s mean that power is gone off), and i would like to have also the informations about how many time that the UPS can still works?


How can i do that with the console? I have create a new data collection but it don t work.

Thank you
#2
General Support / Re: XML file
January 15, 2010, 04:25:17 PM
With the fake package it works! Than you.
#3
General Support / Re: XML file
January 14, 2010, 10:32:29 PM
Thank you , i am going to try to create a fake package
#4
General Support / XML file
January 13, 2010, 11:49:31 PM
Hi, i would like to know if it was possible to deploy an xml file on an agent with the NetXMS Console?

Thank you very much
#5
General Support / Re: Questions about Netxms Console
January 13, 2010, 11:48:02 PM
Thank you very much
#6
General Support / Questions about Netxms Console
January 06, 2010, 06:01:46 PM
Hello,

  • I would like to know how i can do to send alarms or events in the form of SNMP Trap from the Agent?
  • Also, i would like to know how we can retrieve a custom attribute when we are on the server and that we receive an event. And how we can show it in the event log?


Thank you very much
#7
General / Re: problem with development
January 04, 2010, 06:19:54 PM
Hi, thank you and Happy New Year!!
I have done what you said to me but the message send from the agent didn t work again.

I have that:
-----------Envoi du message a l agent-----------
code du message : A

-----------Reception du message de l agent-----------
ยจ

When i send CMD_GETPAREMETER, i receive ".." with the code that i show you previously.

How can i do to see the parameters?

Thank you again
#8
General / Re: problem with development
December 22, 2009, 06:56:20 PM
Thank you, i have tried what you told me. For the reception of a message from the agent i have done that:


CSCPMessage *pMsg2=new CSCPMessage(); //classe
   CSCP_MESSAGE *pRawMsg2;//structure
   CSCP_BUFFER *pMsgBuffer;//structure buffer
   
   int iErr;
   TCHAR szBuffer[128];

 
   // Initialize raw message receiving function
   pMsgBuffer = (CSCP_BUFFER *)malloc(sizeof(CSCP_BUFFER));
   RecvNXCPMessage(socketId, pRawMsg2, pMsgBuffer, RECEIVER_BUFFER_SIZE,0,0,0);
   
   // Allocate space for raw message
   pRawMsg2 = (CSCP_MESSAGE *)malloc(RECEIVER_BUFFER_SIZE);
   pMsg2 = new CSCPMessage(pRawMsg2);
 
   
   DWORD rcc = pMsg2->GetVariableLong(VID_RCC);
 
   if (rcc == ERR_SUCCESS)
    {
       
        char buffer[256];
       
       pMsg2->GetVariableStr(VID_VALUE, buffer, 256);
       // Now buffer contains value of requested parameter
       
          int compteur;
        for(compteur=0;compteur<256;compteur++)
        {
   
               printf("%c\n",buffer[compteur]);
   
            }//fin du for
       
       
    }// fin if


But i always don t managed to read informations. I have done a prinft  to see what informations are in the buffer but when i compiled nothing appeared in the buffer.
What do i have to do in order to see the informations that i received from the Agent
#9
General / Re: problem with development
December 01, 2009, 05:17:23 PM
Thank you, it was what i had done. I have send to the Agent the code 0x0097 in order to get the server informations. But which variable did i have to read from the message object for having the information about the server?

Thank you very much
#10
General / Re: problem with development
November 25, 2009, 09:59:03 PM
In fact i am not sure that the fonction SendFileOverNXCP is used to send a message to the agent.


  • How can i do to send a message to the agent and to receive it? I have used RecvNXCPMessage but i dont arrive to see the message sent by the agent.
  • What are the steps for the sending and the reception of message?


Thank you very much
#11
General / Re: problem with development
November 25, 2009, 09:17:23 PM
Thank you, i am going to use the fonction SendFileOverNXCP to send a message to the agent and RecvNXCPMessage to receive a message from the agent.
#12
General / Re: problem with development
November 24, 2009, 10:53:36 PM
ok thank you. i have seen that RecvNXCPMessage take in parameters a CSCP_ENCRYPTION_CONTEXT. That means that the message that i receive from the agent is crypted and that i have to decrypted it?
Thank you
#13
General / Re: problem with development
November 24, 2009, 06:10:35 PM
Thank you, but i dont understand the difference between RecvCSCPMessage() and RecvNXCPMessage()? I have used the fonction

BOOL AgentConnection::SendMessage(CSCPMessage *pMsg)
{
  CSCP_MESSAGE *pRawMsg;
  BOOL bResult;

  pRawMsg = pMsg->CreateMessage();
  bResult = (SendEx(m_hSocket, (char *)pRawMsg, ntohl(pRawMsg->dwSize), 0) == (int)ntohl(pRawMsg->dwSize));
  free(pRawMsg);
  return bResult;
}

to send a message to the agent and RecvCSCPMessage to receive a message from an agent. I have just seen the fonction Send NXCPMessage.
Which fonction do i have to use to send and receive a message?

Thank you very much
#14
General / Re: problem with development
November 23, 2009, 06:40:14 PM
Thank you, i have changed my code in consequences. I have done a sending and a receiving from the agent. I have again a question. I would like to know how i can test and display the message that i received from the agent by the fonction RecvCSCPMessage?
Thank you very much
#15
General / Re: problem with development
November 18, 2009, 10:15:20 PM
Hi,
I have another questions , in order to test just the sending, i have created a file named client3.cpp which enable to connect with the agent.I also added in the fonction that is in the file Agent and which enable to send a message to the agent;
   /*--Sending--*/
   CSCPMessage *pMsg;
   CSCP_MESSAGE *pRawMsg;
   BOOL bResult;

   pRawMsg = pMsg->CreateMessage();
   bResult = (SendEx(m_hSocket, (char *)pRawMsg, ntohl(pRawMsg->dwSize), 0) == (int)ntohl(pRawMsg->dwSize));
   free(pRawMsg);
   return bResult;


In order to test. I create also a header where i have included the class and structure that i needed.



#ifndef _CSCPMessage_h_
#define _CSCPMessage_h_

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "nms_common.h"
//#include "netxms-regex.h"
#define VID_RCC                     ((float)28)    /* RCC == Request Completion Code */
#define CMD_REQUEST_COMPLETED       0x001D
#define CMD_KEEPALIVE               0x0003

typedef struct
{
   DWORD dwBufSize;
   DWORD dwBufPos;
   char szBuffer[10000000];
} CSCP_BUFFER;


/*--Structure CSCP_DF--*/
typedef struct
{
   DWORD dwVarId;       // Variable identifier
   BYTE  bType;         // Data type
   BYTE  bPadding;      // Padding
   WORD wInt16;
   union
   {
      DWORD dwInteger;
      //QWORD qwInt64;
      double dFloat;
      struct
      {
         DWORD dwLen;
         WORD szValue[1];
      } string;
   } data;
} CSCP_DF;


/*--Structure CSCP_MESSAGE--*/
typedef struct
{
   WORD wCode;       // Message (command) code
   WORD wFlags;      // Message flags
   DWORD dwSize;     // Message size (including header) in bytes
   DWORD dwId;       // Unique message identifier
   DWORD dwNumVars;  // Number of variables in message
   CSCP_DF df[1];    // Data fields
} CSCP_MESSAGE;

/*--Classe CSCPMessage--*/
class LIBNETXMS_EXPORTABLE CSCPMessage
{
private:
   WORD m_wCode;
   WORD m_wFlags;
   DWORD m_dwId;
   DWORD m_dwNumVar;    // Number of variables
   CSCP_DF **m_ppVarList;   // List of variables
   int m_nVersion;      // Protocol version

   void *Set(DWORD dwVarId, BYTE bType, const void *pValue, DWORD dwSize = 0);
   void *Get(DWORD dwVarId, BYTE bType);
   DWORD FindVariable(DWORD dwVarId);
public:
   CSCPMessage(int nVersion = NXCP_VERSION);
   CSCPMessage(CSCPMessage *pMsg);
   CSCPMessage(CSCP_MESSAGE *pMsg, int nVersion = NXCP_VERSION);
   CSCPMessage(const char *xml);
   ~CSCPMessage();

   CSCP_MESSAGE *CreateMessage(void);
   char *CreateXML(void);
   void ProcessXMLToken(void *state, const char **attrs);
   void ProcessXMLData(void *state);

   WORD GetCode(void) { return m_wCode; }
   void SetCode(WORD wCode) { m_wCode = wCode; }

   DWORD GetId(void) { return m_dwId; }
   void SetId(DWORD dwId) { m_dwId = dwId; }

   BOOL IsVariableExist(DWORD dwVarId) { return (FindVariable(dwVarId) != INVALID_INDEX) ? TRUE : FALSE; }
   BOOL IsEndOfSequence(void) { return (m_wFlags & MF_END_OF_SEQUENCE) ? TRUE : FALSE; }
   BOOL IsReverseOrder(void) { return (m_wFlags & MF_REVERSE_ORDER) ? TRUE : FALSE; }

   void SetVariable(DWORD dwVarId, WORD wValue) { Set(dwVarId, CSCP_DT_INT16, &wValue); }
   void SetVariable(DWORD dwVarId, DWORD dwValue) { Set(dwVarId, CSCP_DT_INTEGER, &dwValue); }
   void SetVariable(DWORD dwVarId, QWORD qwValue) { Set(dwVarId, CSCP_DT_INT64, &qwValue); }
   void SetVariable(DWORD dwVarId, double dValue) { Set(dwVarId, CSCP_DT_FLOAT, &dValue); }
   void SetVariable(DWORD dwVarId, const TCHAR *pszValue) { Set(dwVarId, CSCP_DT_STRING, pszValue); }
   void SetVariable(DWORD dwVarId, BYTE *pValue, DWORD dwSize) { Set(dwVarId, CSCP_DT_BINARY, pValue, dwSize); }
   void SetVariableToInt32Array(DWORD dwVarId, DWORD dwNumElements, DWORD *pdwData);
   BOOL SetVariableFromFile(DWORD dwVarId, const TCHAR *pszFileName);

   DWORD GetVariableLong(DWORD dwVarId);
   QWORD GetVariableInt64(DWORD dwVarId);
   WORD GetVariableShort(DWORD dwVarId);
   LONG GetVariableShortAsInt32(DWORD dwVarId);
   double GetVariableDouble(DWORD dwVarId);
   TCHAR *GetVariableStr(DWORD dwVarId, TCHAR *szBuffer = NULL, DWORD dwBufSize = 0);
   DWORD GetVariableBinary(DWORD dwVarId, BYTE *pBuffer, DWORD dwBufSize);
   DWORD GetVariableInt32Array(DWORD dwVarId, DWORD dwNumElements, DWORD *pdwBuffer);

   void DeleteAllVariables(void);

   void DisableEncryption(void) { m_wFlags |= MF_DONT_ENCRYPT; }
   void SetEndOfSequence(void) { m_wFlags |= MF_END_OF_SEQUENCE; }
   void SetReverseOrderFlag(void) { m_wFlags |= MF_REVERSE_ORDER; }
   
};
//
// Message waiting queue class
//

class LIBNETXMS_EXPORTABLE MsgWaitQueue
{
private:
   MUTEX m_mutexDataAccess;
   CONDITION m_condStop;
   CONDITION m_condNewMsg;
   DWORD m_dwMsgHoldTime;
   DWORD m_dwNumElements;
   WAIT_QUEUE_ELEMENT *m_pElements;
   THREAD m_hHkThread;

   void Lock(void) { MutexLock(m_mutexDataAccess, INFINITE); }
   void Unlock(void) { MutexUnlock(m_mutexDataAccess); }
   void HousekeeperThread(void);
   void *WaitForMessageInternal(WORD wIsBinary, WORD wCode, DWORD dwId, DWORD dwTimeOut);
   
   static THREAD_RESULT THREAD_CALL MWQThreadStarter(void *);

public:
   MsgWaitQueue();
   ~MsgWaitQueue();

   void Put(CSCPMessage *pMsg);
   void Put(CSCP_MESSAGE *pMsg);
   CSCPMessage *WaitForMessage(WORD wCode, DWORD dwId, DWORD dwTimeOut)
   {
      return (CSCPMessage *)WaitForMessageInternal(0, wCode, dwId, dwTimeOut);
   }
   CSCP_MESSAGE *WaitForRawMessage(WORD wCode, DWORD dwId, DWORD dwTimeOut)
   {
      return (CSCP_MESSAGE *)WaitForMessageInternal(1, wCode, dwId, dwTimeOut);
   }
   
   void Clear(void);
   void SetHoldTime(DWORD dwHoldTime) { m_dwMsgHoldTime = dwHoldTime; }
};


#endif   /* _CSCPMessage_h_ */


I include in it the link to "nms_common.h" for the definition of the type DWORD, word ETC.

In my makefile, i have integrated the file message.c
When i compile, it didn t work.



g++ client3.cpp -c -I /usr/local/include -I ./include -o client3.o
In file included from client3.cpp:11:
include/CSCPMessage.h:59: error: syntax error before `{' token
include/CSCPMessage.h:71: error: syntax error before `public'
In file included from client3.cpp:11:
include/CSCPMessage.h:4:1: unterminated #ifndef
*** Error code 1


There is a problem with the class CSCPMessage. Do i have forget a header to include?
I also wanted to know what is LIBNETXMS_EXPORTABLE?
I searched in the header nms util but i dont understand the using of it.

Sorry to disturb you :-\
Thank you