ODBC logging problem

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
Igorek
Posts: 47
Joined: Wed Jul 06, 2005 8:55 pm
Location: Russia

ODBC logging problem

Post by Igorek »

I have table `hmlog` in MySQL.
DDL:

Code: Select all

CREATE TABLE `hmlog` (
  `TestName` varchar(77),
  `Date_Time` datetime,
  `StatusID` tinyint(3) unsigned,
  `Reply` int(11)
) ENGINE=MyISAM
I use ODBC log in MySQL by MyODBC.
SQL query:

Code: Select all

INSERT INTO hmlog (TestName, Date_Time, StatusID, Reply) VALUES ('%TestName%', Now(), '%StatusID%', '%Reply_Number%')
I have SNMP test for load system:

Code: Select all

Method      = SNMP
;--- Common properties ---
Title       = load system for 5 min
Comment     = 
RelatedURL  = 
ScheduleMode= Regular
Schedule    = 
Interval    = 300
Alerts      = Alert2
ReverseAlert= No
UnknownIsBad= No
UseCommonLog= Yes
PrivLogMode = Default
CommLogMode = Reply
SyncCounters= Yes
SyncAlerts  = No
DependsOn   = list
MasterTest-Alive = 
;--- Test specific properties ---
Agent       = xx.xx.xx.xx
Community   = public
Timeout     = 2000
Retries     = 1
OID         = 1.3.6.1.4.1.2021.10.1.3.2
Condition   = MoreThan
Value       = 5
At execution of this test I receive Reply '1.2' and record in the table hmlog:
TestName = load system for 5 min
Date_Time = <date and time>
StatusID = 7
Reply = 0

When I run manually SQL query (also by MyODBC via MS Access):

Code: Select all

INSERT INTO hmlog (TestName, Date_Time, StatusID, Reply) VALUES ('load system for 5 min', Now(), '7', '1.2')
I receive record in the table hmlog:
TestName = load system for 5 min
Date_Time = <date and time>
StatusID = 7
Reply = 1

How to receive a rounding off of the Reply at ODBC log?
PS: Hostmonitor v5.71, Win2000 SP4+SecUpd
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

I assume you are using comma (,) as decimal symbol (Windows -> Start -> Settings -> Control Panel -> Regional options -> Numbers). Am I right?
In this case %Reply_Number% variable returns 0 because '1.2' is not valid number.
If your SQL server accepts such format, use %Reply% variable instead of %Reply_Number%.
Or change your system settings - use dot (.) as decimal separator

Regards
Alex
Igorek
Posts: 47
Joined: Wed Jul 06, 2005 8:55 pm
Location: Russia

Post by Igorek »

KS-Soft wrote:I assume you are using comma (,) as decimal symbol (Windows -> Start -> Settings -> Control Panel -> Regional options -> Numbers). Am I right?
No. Decimal symbol is dot(.)

I have checked up values of variables (in string type):
%Reply% = 1.20
%Reply_Number% = 0,00
%Reply_Integer% = 0
KS-Soft wrote:If your SQL server accepts such format, use %Reply% variable instead of %Reply_Number%.
Yes. It really worked.
Thanks for helping.
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

%Reply_Number% = 0,00
(,)? So, decimal separator is a comma.

Regards
Alex
Igorek
Posts: 47
Joined: Wed Jul 06, 2005 8:55 pm
Location: Russia

Post by Igorek »

KS-Soft wrote:
%Reply_Number% = 0,00
(,)? So, decimal separator is a comma.
Yes.
It's strange...
Post Reply