VMware Cloud Community
vishal1raju
Contributor
Contributor

Monitoring Config File Changes on XML

Hi All,

I am relatively new to Hyperic and I have a requirement of monitoring changes to the configuration file which in in XML format. The requirement is - whenever a specific elements of the XML gets changed - an alert should be generated.

For example: Consider a configuration file customer.xml at c:\test\customer.xml as below .
<Customer>
<Name>Vishal</Vishal>
<SSN>12345678</SSN>
</Customer>

The requirement is, whenever the SSN is modified an alert should be geneated.

I've extended ConfigFileTrackPlugin with my CustomerConfigFileTrackPlugin.java.
and also 'DEFAULT_CONFIG_FILE' and 'DEFAULT_CONFIG_TRACK_ENABLE' are set properly.

On loading the CustomerConfigFileTrackePlugin - I've set the current SSN number in to the property as getPlugInData().setProperty("SSN",12345678) . Now, untill the agent is down - whenver a file is modified and the SSN is modified - I am able to track the change by comparing the SSN value retrived from file modified with the one stored inside the property. If the values does not match I can generate an alert.

However, If I shutdown my agent the SSN value stored inside the property is lost as it's not peristed to DB. Result of this - If some one modifies the file when agent is offline, I can't track the changes on next startup.I believe I need to store the SSN number in to the DB property by putting some code in shutdown() hookup of my plugin. On agent startup - I can compare current SSN with the one stored inside the DB. But I don't know how to persist a property in DB. Can any one help me in persisting and retireving a property in hyperc from Custom file track plugin?.

Apology for very detailed description - I wanted to provide enough information on what I am trying to achieve using Hyperic.

Many Thanks,
Vishal Shah

Message was edited by: vishal1raju

Message was edited by: vishal1raju
0 Kudos
0 Replies