monitoring from remote servers

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
kalyanpabolu
Posts: 246
Joined: Fri Jul 03, 2020 4:18 am

monitoring from remote servers

Post by kalyanpabolu »

Hi Team,

We want to check if the URLs are accessible from remote server and if it is not accessible, Nagios should send alert.
Below is the remote server:

10.1.0.29

Below is the URL:

https://chalhoub.legalsuite-apps.com/openlaw/

Now, I need to check if the URL is accessible from the remote server. If not, Nagios should send alert.
Please suggest.
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: monitoring from remote servers

Post by vtrac »

Hi,
Nagios has a built in wizard called "Website URL" that man monitor website.

Nagios XI GUI > Configure > Configuration Wizards > Website URL


Regards,
Vinh
kalyanpabolu
Posts: 246
Joined: Fri Jul 03, 2020 4:18 am

Re: monitoring from remote servers

Post by kalyanpabolu »

Hello,

We are using that wizard to monitor from Nagios. But sometimes, a URL is accessible from one location/server but not from other. So we want to monitor the accessibility from other servers.

Can we do that in Nagios?
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: monitoring from remote servers

Post by vtrac »

Hi,
I search our forum and found this ticket:
https://support.nagios.com/forum/viewto ... =6&t=35295

Looks like the above ticket is using "check_by_ssh" script, so you will need to setup ssh key first.

Example (NOTE: xxxx is name of remote login):

Code: Select all

cd /usr/local/nagios/libexec

./check_by_ssh -H 10.1.0.29 -l xxxx -C "/usr/local/nagios/libexec/check_http -H 46.105.131.117 -f ok -u '/openlaw/' -S --sni -p 443"
Regards,
Vinh
kalyanpabolu
Posts: 246
Joined: Fri Jul 03, 2020 4:18 am

Re: monitoring from remote servers

Post by kalyanpabolu »

Hello,

Thank you for your suggestion.
Can you please suggest how we can check the same for Windows server?
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: monitoring from remote servers

Post by vtrac »

Hi,
You can try searching the Nagios Exchange page:
https://exchange.nagios.org/

I also try it using NCPA "check_ncpa.py" script.

I created a test file called "check_url.ps1" and put that under "C:\Program Files (x86)\Nagios\NCPA\plugins\" folder.

check_url.ps1
(NOTE: This is just a ONE line powershell calls, just for testing purpose)

Code: Select all

(Invoke-WebRequest -UseBasicParsing -Uri https://chalhoub.legalsuite-apps.com/openlaw/).StatusDescription
I then call it from my Nagios XI command prompt.
(NOTE: x.x.x.x is my NCPA VM) ... in your case, it is your "10.1.0.29" machine.

Code: Select all

[root@VT-NagiosXI-62 ~]# /usr/local/nagios/libexec/check_ncpa.py -H x.x.x.x -t 'VT9900' -M 'plugins/check_url.ps1'
OK
If you are good at PowerShell scripting, you can add more to the script.
I am NOT a PowerShell programmer.

From here, you can create a service on Nagios XI and call your PowerShell script to check if it is accessible.


Regards,
Vinh
kalyanpabolu
Posts: 246
Joined: Fri Jul 03, 2020 4:18 am

Re: monitoring from remote servers

Post by kalyanpabolu »

hello,

I tried execution the above script but it is not working for me.

[root@vmaz-nagiosxi libexec]# /usr/local/nagios/libexec/check_ncpa.py -H 10.6.0.23 -t '[email protected]' -M 'plugins/check_url_status.ps1'
Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure
channel.
At C:\Program Files (x86)\Nagios\NCPA\plugins\check_url_status.ps1:1 char:2
+ (Invoke-WebRequest -UseBasicParsing -Uri
https://chalhoub.legalsuite-apps.com/op ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
pWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
ll.Commands.InvokeWebRequestCommand
[root@vmaz-nagiosxi libexec]#


Even I tried checking some other powershell scripts, but no luck.
Can someone from team help with the script?

Can we try some other script in place of powershell?
User avatar
vtrac
Posts: 903
Joined: Tue Oct 27, 2020 1:35 pm

Re: monitoring from remote servers

Post by vtrac »

Hi,
See if you can run the command below on your other windows PowerShell prompt:

Code: Select all

Invoke-WebRequest -UseBasicParsing -Uri https://chalhoub.legalsuite-apps.com/openlaw/
You network might be blocking it or you don't have internet.


Please NOTE that I just came up with the idea to help you get started. I'm not saying you have to use it.

You could try using python or other languages as long as you have it (them) installed.

As a support engineer, I'm not allowed to write code .... I can give you ideas to help solve an issue.

Also, please search the Nagios Exchange page, you might find something that will fit your needs.
https://exchange.nagios.org/


Regards,
Vinh
Locked