NetXMS Support Forum

English Support => General Support => Topic started by: Ian on January 07, 2014, 10:03:29 AM

Title: Database row count
Post by: Ian on January 07, 2014, 10:03:29 AM
Hello good day to all. Newbie here. Can I just ask if NetXMS has the capability to monitor the database row count? Thank you for this software and hope for continuous improvement.  :)
Title: Re: Database row count
Post by: Victor Kirhenshtein on January 07, 2014, 07:09:45 PM
Hi!

Yes, you can use either ODBCquery or dbquery subagent to execute SQL queries periodically. ODBCquery subagent description is here: http://wiki.netxms.org/wiki/Subagent:ODBCQuery (http://wiki.netxms.org/wiki/Subagent:ODBCQuery).

For DBquery, agent configuration file can be like this:


# standard stuff here ...
SubAgent = dbquery.nsm

*DBQUERY
Database = id=db1;driver=mysql.ddr;server=127.0.0.1;dbname=mydb;login=user;password=pass


Then to get number of records in table t1, you can use parameter

DB.Query(db1,"SELECT count(*) FROM t1")

Please note that DBquery is a new subagent intended to replace ODBCquery, but it's not 100% ready yet.

Best regards,
Victor
Title: Re: Database row count
Post by: Ian on January 08, 2014, 04:00:36 AM
Thanks Victor for the quick reply. Will try it now :)