Creating a sensor
You can create a Scheduler sensor to collect and store data about the database server.
You must be connected to the sysadmin database as user informix or
another authorized user.
To create a sensor, use an INSERT statement to add a row into the ph_task table:
The sensor runs at the specified start
time and subsequently at the time calculated from the frequency.
Examples
The following example shows the
code for a sensor that tracks the startup environment of the database
server. The $DATA_SEQ_ID variable is the current
execution of the sensor.
INSERT INTO ph_task
(
tk_name,
tk_type,
tk_group,
tk_description,
tk_result_table,
tk_create,
tk_execute,
tk_stop_time,
tk_start_time,
tk_frequency,
tk_delete
)
VALUES
(
"mon_sysenv",
"STARTUP SENSOR",
"SERVER",
"Tracks the database servers startup environment.",
"mon_sysenv",
"create table mon_sysenv (ID integer, name varchar(250), value lvarchar(1024))",
"insert into mon_sysenv select $DATA_SEQ_ID, env_name, env_value
FROM sysmaster:sysenv",
NULL,
NULL,
NULL,
"60 0:00:00"
);
The following example shows the code for a sensor
that collects information about the amount of memory that is being
used and stores the information in the mon_memory_system table.
If that table does not exist, the task creates it. This task, which
runs every 30 minutes, deletes any data in the mon_memory_system table
that has existed for more than 30 days.
INSERT INTO ph_task
(
tk_name,
tk_group,
tk_description,
tk_result_table,
tk_create,
tk_execute,
tk_stop_time,
tk_start_time,
tk_frequency,
tk_delete
)
VALUES
("mon_memory_system",
"MEMORY",
"Server memory consumption",
"mon_memory_system",
"create table mon_memory_system (ID integer, class smallint, size int8,
used int8, free int8 )",
"insert into mon_memory_system select $DATA_SEQ_ID, seg_class, seg_size,
seg_blkused, seg_blkfree FROM sysmaster:sysseglst",
NULL,
NULL,
INTERVAL ( 30 ) MINUTE TO MINUTE,
INTERVAL ( 30 ) DAY TO DAY
);