Web Site monitoring

Started by bsadler, January 18, 2007, 05:13:09 PM

Previous topic - Next topic

bsadler

I have just set up NetXMS for the first time, and I must say I am very impressed!

So far I have not run into any problems with monitoring various servers, but I do have one question about monitoring web sites:

I have a cluster of web servers that run a few different domains, and I would like to check that certain pages load periodically.

How is this done using NetXMS?  I've looked through the manual, and even played around with 'Services' a bit, but I can't quite seem to get a grasp on what the request and response fields should contain (I have tried URLs and response codes, but for some reason when I set the service to expect a response code of 200 from a server that does not even exist it returns a good status!).

Thanks in advance,

Blain

Victor Kirhenshtein

Hello!

To monitor web services, you have two options, depending on your installation:

First option - if you have added machine hosting web server in question to NetXMS as node object.

1) Create "Service" object under your web server's node object
2) Select service type "HTTP"
3) As a request, enter HOST_HEADER:REQUEST_URI, for example, to test URL https://www.netxms.org/index.html enter www.netxms.org:/index.html
4) In a response field, enter regular expression to match server's answer. Below are some examples:
4.1) Just test for code 200 (OK):

^HTTP/1\.[01] 200.*

4.2) To test that server returns code 200 and that page's content has word "netxms":

^HTTP/1\.[01] 200.*netxms.*

Second option - if you don't enter your web server as a node into NetXMS (for example, you wish to check www.ibm.com without creating a node object in your NetXMS database)

1) For the node object representing your NetXMS server, add the following DCI (source - NetXMS agent):

ServiceCheck.HTTP(server_ip_address,port,uri,host_header,response)

For example, to check https://www.netxms.org/index.html just to code 200, use

ServiceCheck.HTTP(159.148.208.90,80,/index.html,www.netxms.org,"^HTTP/1\.[01] 200.*")

This parameter will return the following values:

0 - success (server was connected and return expected response)
1 - invalid arguments was passed (most likely regular expression has incorrect syntax)
2 - cannot connect to server
3 - bad server's response

So you can set threshold for non-zero values and process it.

Please node that you need portchecker subagent to be loaded on machine running NetXMS server. On Windows installation this is default, but on UNIX you should ensure that you have something like

SubAgent = /usr/local/lib/libnsm_portCheck.so

in your agent's configuration file.

Hope this helps!

Best regards,
Victor

Victor Kirhenshtein

Hello again!

Please note that starting from version 0.2.15, you can also calculate checksum of web pages - this gives you an ability to detect page changes. To get web page checksum, you should load ECS (Extended Checksum) subagent on the node from which you wish to control web page, and then add DCI like below to that node:

ECS.HttpSHA1(URL)

for example, to calculate checksum of www.netxms.org main page, use

ECS.HttpSHA1(https://www.netxms.org)

You will get SHA1 hash for page as a string. You can set threshold on DCI to detect changes in a checksum and process raised events.

Best regards,
Victor

bsadler

Victor,

Thank you very much for your extremely helpful response!  I have tested out the first option, and it works perfectly.

Cheers,

Blain

Anth0ny

#4
Need comments for HOST_HEADER:REQUEST_URI

REQUEST_URI - is it a required part of request?

can i simple enter an URL? for example: www.netxms.org

(вообще объект типа "Сервис" может существовать самостоятельно, без привязки к какой-то конкретной ноде? вдруг мне понадобилось мониторить интернет-сервер, который мне не пренадлежит... и как Ноду его создавать не хочется)

Victor Kirhenshtein

No, you cannot use URL. For monitoring www.netxms.org, ypu should use request like


www.netxms.org:/


Service should be bound to node object. If you wish to check remote web server without creating node object, you can just create DCI for ServiceCheck.HTTP parameter on your management server and use normal threshold processing.

Best regards,
Victor

P.S. Please use English or post questions in Russian forum. No offence, just reminder :)

Anth0ny

#6
Quote from: Victor Kirhenshtein

P.S. Please use English or post questions in Russian forum. No offence, just reminder :)


I always follow to Community rules.
And my previous posts aknowledge this =)

My message in russian only a comments, not a main thing.

Thanks Viktor!
=)

eldiablo14

Hello,

I want to monitor web pages but it doesnt work on my system as you mentioned above... What can be wrong ? :S

I'm really confused...

Victor Kirhenshtein

Hi!

How do you monitor - via ServiceCheck.HTTP parameter or by creating network service object? What errors you get?

Best regards,
Victor

eldiablo14

I've tried both of them. I also checked nxget prompt.

Each time I try, NetXMS says services are down so I can't see what's wrong there..

For example please tell me step by step how can i monitor www.google.com ?

Service type, I'm choosing HTTP
Bound to IP address, I choose " Any "

At Request/Respone tab,  I'm entering
www.google.com:/

Expected response, I'm entering
^HTTP/1.[01] 200 .*

This way it says service is down but NetXMS server machine can resolve www.google.com in browsers. I'm in the office now and I'm behind a firewall but I don't think this will block it.

Please help me :(

eldiablo14

OK, now i can monitor web pages via DCI. But again there is a problem...

Web page is working and it's giving me a " 0 " value, so far good.. But when I try to test if it's working correctly it fails... I'm stopping apache service and waiting that if the value changes from 0 to 1,2,3 but no. Everytime I try to test, agent stops working and i can understand it from the last data collection, when i turn on the apache service again, agent starts to work (which i can see from the last data collection again)

This is interesting, any solutions for this ?


eldiablo14

Finally my problem solved...

This time I uninstalled 0.2.31 agent and installed 0.2.30 agent... And it worked just like you said Victor.

You may consider this as a bug of 0.2.31 agent.

Thanks !

Victor Kirhenshtein

Hi!

It's very strange. The only thing that was changed in port checker between 0.2.30 and 0.2.31 is that 0.2.31 has configurable connection timeout. On what platform you run port checker? Maybe it's platform-dependent bug.

Best regards,
Victor

eldiablo14

Hi again,

Platform I use ; Windows 2003 Server Enterprise Edition SP1 32 Bit

Rabid

I have a slight problem with using ServiceCheck.HTTP.  I am using 1.0.9 Console and 1.0.9 agent which is installed on a WinXP machine.  When I use the following string it works fine

someIP,80,/index.html,someURL,"^HTTP/1\.[01] 200.*"

where someIP is the IP of the someURL.  This will actually work correctly and if I change index.html to index2.html I get the correct response.  If I use the following string the agent ends unexpectedly.

someIP,80,/index.html,someURL,"^HTTP/1\.[01] 200.*randomWord.*"

where randomWord is located on index.html.  I just want to check for a random word located on the webpage.  Is the above the wrong syntax?