Information May Be Out-of-Date
This page about licensing and maintenance is shown for reference purposes only. Information on this page is not maintained and may no longer be valid.
For recent information, please visit our Frequently Asked Questions (FAQs) page.
Creating a Custom Sensor DLL for IPCheck Server Monitor using Delphi
This custom sensor for IPCheck Server Monitor reads the available diskspace of a local drive and gives back a result.
This file (disksensordll.dpr) serves as a sample for a DLL based custom sensor created using Delphi.
The sensor requires one parameter, which is the character of the drive to check (e.g. "c").
The source and the binaries can be found in the following subfolder of your IPCheck Server Monitor installation folder:
custom\sample\delphi\dll
Instructions:
- (if necessary: edit the dpr and recompile it using Delphi)
- Copy the DLL into your CUSTOM directory
- Restart the IPCheck web server process (to scan the folder for new files)
- Create a new CUSTOM sensor
- For the Sensor setting choose your DLL file
- For Parameters enter one character for the drive to check, e.g. "c"
disksensordll.dpr
library disksensordll;
uses
SysUtils;
function perform(para,msg:pchar):integer; stdcall;
var drive:string;
driveid:byte;
freespace:integer;
m:string;
code:integer;
begin
try
//read the parameter from the command line
drive:=para;
//convert drive letter to id
driveid:=ord(drive[1])-ord('a')+1;
//read the free space in kb
freespace:=DiskFree(driveid) div 1024;
//check the free space and set result values
if freespace<1 then
begin
code:=3;
m:='Disk full';
end
else if freespace<1024 then
begin
code:=1;
m:='Only 1MB left';
end
else
begin
code:=0;
m:='Everything OK';
end;
except
//on exception return a error
freespace:=0;
code:=2;
m:='Error reading free space.';
end;
//we know the string is not longer than 255 charakters, no extra check needed
strcopy(msg,pchar(inttostr(freespace)+':'+m));
result:=code;
end;
exports
perform;
begin
end.