URL monitoring in Nagios cor from command prompt
URL monitoring in Nagios cor from command prompt
Hi Team,
I am new to Nagios core. And want to monitor urls I have created service like below on nagios server
define service {
host_name DMSAPS01
service_description URL: http://10.0.1.8:9500/dsearch
check_command check_http!http://10.0.1.8:9500/dsearch
}
When I run check_http I get below command. Please help me on it
[root@DMSAMON01 libexec]# ./check_http -H 10.0.0.8 -u http://10.0.0.8:9500/dsearch
connect to address 10.0.0.8 and port 80: Connection refused
HTTP CRITICAL - Unable to open TCP socket
Thanks.
I am new to Nagios core. And want to monitor urls I have created service like below on nagios server
define service {
host_name DMSAPS01
service_description URL: http://10.0.1.8:9500/dsearch
check_command check_http!http://10.0.1.8:9500/dsearch
}
When I run check_http I get below command. Please help me on it
[root@DMSAMON01 libexec]# ./check_http -H 10.0.0.8 -u http://10.0.0.8:9500/dsearch
connect to address 10.0.0.8 and port 80: Connection refused
HTTP CRITICAL - Unable to open TCP socket
Thanks.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: URL monitoring in Nagios cor from command prompt
jyoti22 wrote:Hi Team,
I am new to Nagios core. And want to monitor urls I have created service like below on nagios server
define service {
host_name DMSAPS01
service_description URL: http://10.0.1.8:9500/dsearch
check_command check_http!http://10.0.1.8:9500/dsearch
}
When I run check_http I get below command. Please help me on it
[root@DMSAMON01 libexec]# ./check_http -H 10.0.0.8 -u http://10.0.0.8:9500/dsearch
connect to address 10.0.0.8 and port 80: Connection refused
HTTP CRITICAL - Unable to open TCP socket
Thanks.
It should be more like this
Code: Select all
./check_http -H 10.0.0.8 -u /dsearch -p 9500
Re: URL monitoring in Nagios cor from command prompt
[nagadmin@clouddms.com@DMSAZPLMON01 libexec]$ ./check_http -H 10.0.0.8 -u /dsearch -p 9500
HTTP WARNING: HTTP/1.1 404 Not Found - 246 bytes in 0.004 second response time |time=0.004413s;;;0.000000 size=246B;;;0
Please let me know what should be syntax of service.cfg file
Thanks.
HTTP WARNING: HTTP/1.1 404 Not Found - 246 bytes in 0.004 second response time |time=0.004413s;;;0.000000 size=246B;;;0
Please let me know what should be syntax of service.cfg file
Thanks.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: URL monitoring in Nagios cor from command prompt
Are you sure this URL exists and is accessible from the nagios XI server?
From the command line can you run
From the command line can you run
Code: Select all
curl -vvv http://10.0.1.8:9500/dsearch
Re: URL monitoring in Nagios cor from command prompt
URL takes time to load, I guess due to this I get warning message. I tried to increase timeout to 500 (-t 500) but still I get same error.
Kindly help
Kindly help
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: URL monitoring in Nagios cor from command prompt
A This errorjyoti22 wrote:URL takes time to load, I guess due to this I get warning message. I tried to increase timeout to 500 (-t 500) but still I get same error.
Kindly help
Code: Select all
404 Not Found
Lets run the command with a -v and please post the output
Code: Select all
./check_http -H 10.0.0.8 -u /dsearch -p 9500 -v
Re: URL monitoring in Nagios cor from command prompt
Please find the output.
[root@DMSAZPLMON01 libexec]# ./check_http -I 10.0.0.70 -u '/D2/#d2' -p 8080 -v
GET /D2/#d2 HTTP/1.0
User-Agent: check_http/v2.1.2 (nagios-plugins 2.1.2)
Connection: close
Accept: */*
http://10.0.0.70:8080/D2/#d2 is 1225 characters
STATUS: HTTP/1.1 404 Not Found
**** HEADER ****
Server: Apache-Coyote/1.1
X-UA-Compatible: chrome=1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1006
Date: Wed, 06 Sep 2017 07:58:37 GMT
Connection: close
**** CONTENT ****
<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.37 - Error report</title><st yle type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;backgrou nd-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color: white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,san s-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family: Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Taho ma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma ,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black; }A.name {color : black;}.line {height: 1px; background-color: #525D76; border: n one;}</style> </head><body><h1>HTTP Status 404 - /D2/#d2</h1><div class="line">< /div><p><b>type</b> Status report</p><p><b>message</b> <u>/D2/#d2</u></p><p><b>d escription</b> <u>The requested resource is not available.</u></p><hr class="lin e"><h3>Apache Tomcat/8.0.37</h3></body></html>
HTTP WARNING: HTTP/1.1 404 Not Found - 1225 bytes in 0.006 second response time |time=0.006242s;;;0.000000 size=1225B;;;0
When I ran same url with IE, I get desired page. Please help. Thanks.
[root@DMSAZPLMON01 libexec]# ./check_http -I 10.0.0.70 -u '/D2/#d2' -p 8080 -v
GET /D2/#d2 HTTP/1.0
User-Agent: check_http/v2.1.2 (nagios-plugins 2.1.2)
Connection: close
Accept: */*
http://10.0.0.70:8080/D2/#d2 is 1225 characters
STATUS: HTTP/1.1 404 Not Found
**** HEADER ****
Server: Apache-Coyote/1.1
X-UA-Compatible: chrome=1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1006
Date: Wed, 06 Sep 2017 07:58:37 GMT
Connection: close
**** CONTENT ****
<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.37 - Error report</title><st yle type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;backgrou nd-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color: white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,san s-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family: Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Taho ma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma ,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black; }A.name {color : black;}.line {height: 1px; background-color: #525D76; border: n one;}</style> </head><body><h1>HTTP Status 404 - /D2/#d2</h1><div class="line">< /div><p><b>type</b> Status report</p><p><b>message</b> <u>/D2/#d2</u></p><p><b>d escription</b> <u>The requested resource is not available.</u></p><hr class="lin e"><h3>Apache Tomcat/8.0.37</h3></body></html>
HTTP WARNING: HTTP/1.1 404 Not Found - 1225 bytes in 0.006 second response time |time=0.006242s;;;0.000000 size=1225B;;;0
When I ran same url with IE, I get desired page. Please help. Thanks.
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: URL monitoring in Nagios cor from command prompt
Well this is clearly a 404, which leads me to believe that the web server is only serving the page to certain hosts or IP's.jyoti22 wrote:Please find the output.
[root@DMSAZPLMON01 libexec]# ./check_http -I 10.0.0.70 -u '/D2/#d2' -p 8080 -v
GET /D2/#d2 HTTP/1.0
User-Agent: check_http/v2.1.2 (nagios-plugins 2.1.2)
Connection: close
Accept: */*
http://10.0.0.70:8080/D2/#d2 is 1225 characters
STATUS: HTTP/1.1 404 Not Found
**** HEADER ****
Server: Apache-Coyote/1.1
X-UA-Compatible: chrome=1
Content-Type: text/html;charset=utf-8
Content-Language: en
Content-Length: 1006
Date: Wed, 06 Sep 2017 07:58:37 GMT
Connection: close
**** CONTENT ****
<!DOCTYPE html><html><head><title>Apache Tomcat/8.0.37 - Error report</title><st yle type="text/css">H1 {font-family:Tahoma,Arial,sans-serif;color:white;backgrou nd-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color: white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,san s-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family: Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Taho ma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma ,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black; }A.name {color : black;}.line {height: 1px; background-color: #525D76; border: n one;}</style> </head><body><h1>HTTP Status 404 - /D2/#d2</h1><div class="line">< /div><p><b>type</b> Status report</p><p><b>message</b> <u>/D2/#d2</u></p><p><b>d escription</b> <u>The requested resource is not available.</u></p><hr class="lin e"><h3>Apache Tomcat/8.0.37</h3></body></html>
HTTP WARNING: HTTP/1.1 404 Not Found - 1225 bytes in 0.006 second response time |time=0.006242s;;;0.000000 size=1225B;;;0
When I ran same url with IE, I get desired page. Please help. Thanks.
It shouldn't matter but in a URL items after and including # are never sent to a web server.
For clarity, this loads in your browser?
http://10.0.0.70:8080/D2/
If so, you may need to speak to the person who setup the web server to determine if they have some type of filtering going on that they can add your Nagios server to as allowed.
Re: URL monitoring in Nagios cor from command prompt
It is working now. Please mark it as solved. Thanks a lot! ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)