Monitor web page content change check

Started by Kelvin Sin, December 19, 2010, 05:07:50 PM

Previous topic - Next topic

Kelvin Sin

Dear all,

In monitored web page, it contains value in <lastdataintime> field as shown below.


<lastdataintime>16:21:17 18/12/2010</lastdataintime>


My task is to monitor if there is any change for this value -16:21:17 18/12/2010

Email alert will be sent if the value of XML tag "<lastdataintime>" is unchanged every 3 minutes.

Is it possible to monitor change of web page content?

I would be appreicate if you have any hints about configuration.

Regards,
Kelvin Sin

Victor Kirhenshtein

Hi!

At a first glance, looks like you will need some external script. With built-in mechanisms, you can only check for entire page changes using ECS subagent. This subagent provides parameter which returns hash for given URL - so you can detect change in that page, but you cannot determine what part of the page was changed.

Best regards,
Victor

Kelvin Sin

Dear Victor

Detect change in that page doesn't help for me. It is because i need to detect portion of change in web page. Is there any idea about writing external script, please? Please advice.

Regards,
Kelvin Sin

Victor Kirhenshtein

You can use wget to get content of a web page. For example, the following externa parameter returns version listed on NetXMS download page (https://www.netxms.org/download):


ExternalParameter = WebVersion:wget -qO- https://www.netxms.org/download | perl -e 'while(<>) { chomp $$_; if ($$_ =~ /stable version is ([0-9\.]+)\,/) { print "$$1\n"; } }'


Please note, that original shell command looks like


wget -qO- https://www.netxms.org/download | perl -e 'while(<>) { chomp $_; if ($_ =~ /stable version is ([0-9\.]+)\,/) { print "$1\n"; } }'


but you need to duplicate $ symbol, because it is used for macro expansion in external parameter configuration.

Result of this parameter looks like following:


netxms:~ # nxget 10.0.0.90 WebVersion
1.0.8
netxms:~ #


Best regards,
Victor

Kelvin Sin

Dear Victor

Thank you for your reply. Where do i insert external parameter in NetXMS? Do i put it in DCI?
I would be appreicated if you could instruct more detail information. Thank you.

P.S. I am running windows server 2003 OS in server side.

Regards,
Kelvin Sin

Victor Kirhenshtein

Hi!

You can add additional parameters to agent using ExternalParameter config file option. For example, you can add to nxagentd.conf on some node


ExternalParameter = WebVersion:wget -qO- https://www.netxms.org/download | perl -e 'while(<>) { chomp $$_; if ($$_ =~ /stable version is ([0-9\.]+)\,/) { print "$$1\n"; } }'


After that, agent will provide additional parameter named WebVersion. You can get value of this parameter by creating new DCI on this node, and create thresholds to detect value changes.

Best regards,
Victor