Hello, I need to write a custom dll sensor using C++. I am basing it on the documentation here:
https://www.paessler.com/manuals/prtg/custom_sensors#interface_dll
I am having trouble getting it to work with PRTG. PRTG can call the sensor and extract the message, but it says the sensor is 'down' and cannot read the value. This is the code in my header file that exposes the function:
extern "C" PRTGWrapper_API int perform(char* para, char* msg);
And this is the code in the cpp file:
using namespace std; int perform(char* para, char* msg) { try { const char* str = u8"3:Test\0"; memcpy(msg, str, sizeof(char) * 7); return 0x0; } catch (const std::exception& e) { return 0x2; } }
When I add this as a custom exe/dll sensor I can see the message "Test" underneath the sensor name, which implies that the code must be running. However each call results in an error and I cannot see the value.
Has anyone got an example of this in C++, or even in another unmanaged language like Delphi? Thanks
Add comment