<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Database Structure]]></title><description><![CDATA[<p dir="auto">I have Netxms installed using a MS SQL 2005 database. The plan is to have Netxms gather all the relevant WMI and SNMP statistics and server status then have an intranet webpage developed to extract various information from the Netxms database and show the status, ie are certain servers up, SQL and IIS server transaction statistics.</p>
<p dir="auto">To achieve this a better understanding of the database fields is needed. Is there any documentation available to show the database field structure, in particular the latest values for node data collection.</p>
<p dir="auto">many thanks</p>
]]></description><link>https://forum.netxms.org/topic/485/database-structure</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 06:42:24 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/485.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 13 Oct 2008 03:34:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Database Structure on Mon, 01 Dec 2008 03:41:36 GMT]]></title><description><![CDATA[<p dir="auto">Below are working SQL commands to extract the latest value for a DCI. Note - the DCI as named for the node is queried not its ID</p>
<p dir="auto">The following SQL will list all of the idata_value’s for the DCI named 'SQL Cache Memory KB' for node 201<br />
SELECT  TOP 1   items.item_id, items.node_id, idata_201.idata_timestamp, idata_201.idata_value<br />
FROM         items INNER JOIN<br />
                      idata_201 ON items.item_id = idata_201.item_id<br />
WHERE     (items.description = 'SQL Cache Memory KB') AND (items.node_id = 201)<br />
ORDER BY idata_201.idata_value DESC, idata_201.idata_timestamp ASC</p>
<p dir="auto">The following SQL code will list the latest idata_value for the DCI named 'SQL Cache Memory KB' for node 201<br />
select A.item_id,A.ts,D.idata_value,I.description from<br />
(<br />
      select item_id,max(idata_timestamp) as ts from idata_201 group by item_id<br />
) A<br />
join idata_201 AS D on A.item_id=D.item_id and D.idata_timestamp = A.ts<br />
join items AS I on I.item_id = A.item_id<br />
where description = 'SQL Cache Memory KB'</p>
]]></description><link>https://forum.netxms.org/post/2664</link><guid isPermaLink="true">https://forum.netxms.org/post/2664</guid><dc:creator><![CDATA[toad]]></dc:creator><pubDate>Mon, 01 Dec 2008 03:41:36 GMT</pubDate></item><item><title><![CDATA[Reply to Database Structure on Mon, 10 Nov 2008 18:03:31 GMT]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">Server caches last values for each DCI, so when console displays them, data is coming directly from server's memory, not from SQL database.<br />
However, you may use something like this:</p>
<p dir="auto">If you wish to get last values for all DCIs on given node, you can use the following query:</p>
<pre><code>select A.item_id,A.ts,D.idata_value,I.description from
(
	select item_id,max(idata_timestamp) as ts from netxms.idata_14 group by item_id
) A
join netxms.idata_14 AS D on A.item_id=D.item_id and D.idata_timestamp = A.ts
join netxms.items AS I on I.item_id = A.item_id
</code></pre>
<p dir="auto">For node with id 14.</p>
<p dir="auto">You can also define the stored procedure for retrieving last values for given node:</p>
<pre><code>CREATE PROC LastValues
@Id integer
AS
EXEC ('
select A.item_id,A.ts,D.idata_value,I.description from
(
	select item_id,max(idata_timestamp) as ts from netxms.idata_' + @Id + ' group by item_id
) A
join netxms.idata_' + @Id + ' AS D on A.item_id=D.item_id and D.idata_timestamp = A.ts
join netxms.items AS I on I.item_id = A.item_id'
)
GO
</code></pre>
<p dir="auto">I'm not good in SQL, so probably there are better way to do this <img src="https://forum.netxms.org/assets/plugins/nodebb-plugin-emoji/emoji/android/1f642.png?v=72b86a538fc" class="not-responsive emoji emoji-android emoji--slightly_smiling_face" style="height:1.4em;width:auto;vertical-align:middle" title=":)" alt="🙂" /></p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/2532</link><guid isPermaLink="true">https://forum.netxms.org/post/2532</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Mon, 10 Nov 2008 18:03:31 GMT</pubDate></item><item><title><![CDATA[Reply to Database Structure on Mon, 10 Nov 2008 04:34:57 GMT]]></title><description><![CDATA[<p dir="auto">Victor - many thanks for the details on the database structure, however, I am in need to know how to structure an SQL command to fid the latest values. I see where ALL the collected data is but how do you display the latest values with differing timestamps for each item that exists in each nodes data?</p>
]]></description><link>https://forum.netxms.org/post/2522</link><guid isPermaLink="true">https://forum.netxms.org/post/2522</guid><dc:creator><![CDATA[toad]]></dc:creator><pubDate>Mon, 10 Nov 2008 04:34:57 GMT</pubDate></item><item><title><![CDATA[Reply to Database Structure on Tue, 14 Oct 2008 03:32:58 GMT]]></title><description><![CDATA[<p dir="auto">Many thanks Victor .... all the info I need much appreciated</p>
<p dir="auto">regards</p>
<p dir="auto">Geoff</p>
]]></description><link>https://forum.netxms.org/post/2433</link><guid isPermaLink="true">https://forum.netxms.org/post/2433</guid><dc:creator><![CDATA[toad]]></dc:creator><pubDate>Tue, 14 Oct 2008 03:32:58 GMT</pubDate></item><item><title><![CDATA[Reply to Database Structure on Wed, 05 Nov 2008 09:53:18 GMT]]></title><description><![CDATA[<p dir="auto">Hello!</p>
<p dir="auto">Short overview of database structure related to data collection:</p>
<p dir="auto">All collected data stored in tables idata_xx, where xx is a node object id, so each node has it's own table for data. Structure of this table is quite simple:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><strong>Field</strong></th>
<th><strong>Type</strong></th>
<th><strong>Description</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>item_id</td>
<td>integer</td>
<td>DCI id</td>
</tr>
<tr>
<td>idata_timestamp</td>
<td>integer</td>
<td>Timestamp in UNIX format (seconds since epoch)</td>
</tr>
<tr>
<td>idata_value</td>
<td>varchar(255)</td>
<td>Value</td>
</tr>
</tbody>
</table>
<p dir="auto">You can get the list of nodes from nodes table, where you probably should be interested only in id and may be primary_ip fields.<br />
Some fileds from "nodes" table:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><strong>Field</strong></th>
<th><strong>Type</strong></th>
<th><strong>Description</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>integer</td>
<td>Node object id</td>
</tr>
<tr>
<td>primary_ip</td>
<td>varchar(15)</td>
<td>Node's primary IP address</td>
</tr>
<tr>
<td>uname</td>
<td>varchar(255)</td>
<td>Node's uname (output of uname -a command)</td>
</tr>
</tbody>
</table>
<p dir="auto">Node's name, status, and comments can be obtained from "object_properties" table.<br />
Some fileds from "object_properties" table:</p>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th><strong>Field</strong></th>
<th><strong>Type</strong></th>
<th><strong>Description</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>id</td>
<td>integer</td>
<td>Object id</td>
</tr>
<tr>
<td>name</td>
<td>varchar(63)</td>
<td>Object name</td>
</tr>
<tr>
<td>status</td>
<td>integer</td>
<td>Object status</td>
</tr>
<tr>
<td>comments</td>
<td>text</td>
<td>Object comments</td>
</tr>
</tbody>
</table>
<p dir="auto">Some information on database structure can also be obtained from this topic: <a href="https://www.netxms.org/forum/index.php/topic,198.0.html" rel="nofollow ugc">https://www.netxms.org/forum/index.php/topic,198.0.html</a></p>
<p dir="auto">Hope this helps!</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/2432</link><guid isPermaLink="true">https://forum.netxms.org/post/2432</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 05 Nov 2008 09:53:18 GMT</pubDate></item></channel></rss>