NetXMS Support Forum

English Support => General Support => Topic started by: JMC Software on May 23, 2014, 01:07:17 PM

Title: Use logwatch parameter in data collection
Post by: JMC Software on May 23, 2014, 01:07:17 PM
Hello,

I have configured logwatch to parse the content of my windows server application event log.
I can now collect over DCI Number of records processed and Number of records matched.
And i can fire an alarm over my event policy rule where i can see the parsed parameter content (it is a float value).
Is it possible to configure a DCI that will collect this value?

Thanks for any help.

Regards
Title: Re: Use logwatch parameter in data collection
Post by: Victor Kirhenshtein on May 23, 2014, 06:52:41 PM
Hi!

Yes, it's possible. You can create "situation" object and in event processing policy set situation's attribute. Then you can create DCI with source "Internal" and parameter "Dummy" and in transformation script read value from situation's attribute. Sample script to access situation can be found here: https://www.netxms.org/documentation/adminguide/event-processing.html#situations (https://www.netxms.org/documentation/adminguide/event-processing.html#situations).

Best regards,
Victor
Title: Re: Use logwatch parameter in data collection
Post by: JMC Software on May 24, 2014, 09:46:57 AM
Create Victor

Thanks it works.
Title: Re: Use logwatch parameter in data collection
Post by: JMC Software on May 24, 2014, 06:10:27 PM
Hello Victor,

It seems i have still something going wrong.
My DCI History is still 0.0.

I have the Event that works well an reads the Application Event Log.
To check it i have an action that writes the value as an Event in Netxms and the values are correct.
I have also the action that updates the situation, an the value is also updated correctly.
If i test my transformation in the DCI it shows also the right value, so it can access the situation correctly.
But the DCI itselfs stores all the time 0.0.

Is this a Bug or are i missing something?

Thanks for your feedback.

Regards

José
Title: Re: Use logwatch parameter in data collection
Post by: Victor Kirhenshtein on May 24, 2014, 07:34:05 PM
Hi!

Try to change DCI data type to string - will it show correct history then?

Best regards,
Victor
Title: Re: Use logwatch parameter in data collection
Post by: JMC Software on May 24, 2014, 07:39:23 PM
Yesss it shows....
I was thinking it recognize the datatype itself.
Can i make a strong type convert in transformation script?

Thanks again.

Regards

José
Title: Re: Use logwatch parameter in data collection
Post by: Victor Kirhenshtein on May 24, 2014, 08:02:24 PM
Hi!

Actually that means that server did not recognize string value as floating point number. You can try to set data type to float and use explicit cast with real(), like


return real(res)


It is also possible that your locale expects floating point numbers to have , instead of .

Best regards,
Victor
Title: Re: Use logwatch parameter in data collection
Post by: JMC Software on May 24, 2014, 08:28:48 PM
Hello Victor,

return real(res)

Doesn't work also.

Have you any other suggestions.

Thanks and Regards

José