Re: Monit using ethtool

2018-03-14 Thread Mehul Ved
Here's a quick and dirty sample bash script you can write to check the values 
https://gist.github.com/mehulved/8c3bde2f7c33a980b8cbea8485b67639



 From: monit-general  
on behalf of Kevin Smith 
Sent: Wednesday, March 14, 2018 11:00:13 PM
To: This is the general mailing list for monit (monit-general@nongnu.org)
Subject: Monit using ethtool


Any examples out there of monitoring network stats with monit via ethtool?

Like if I wanted to track if a counter when up for one of the error counters in 
‘ethtool –S | grep error’



Thanks!


NOTICE: This email message is for the sole use of the intended recipient(s) and 
may contain confidential and privileged information. Any unauthorized use, 
disclosure or distribution is prohibited. If you are not the intended 
recipient, please contact the sender by reply email and destroy all copies of 
the original message.
-- 
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Re: M/Monit Network Settings

2017-07-05 Thread Mehul Ved
In the port field try 80 or 443, as relevant?


From: monit-general <monit-general-bounces+mehul.ved=nexsales@nongnu.org> 
on behalf of Saagar Deshpande <saa...@edo.com>
Sent: Wednesday, July 5, 2017 1:58:51 AM
To: This is the general mailing list for monit
Subject: Re: M/Monit Network Settings

Guillaume,

Indeed, the data collection is working properly. My question is centered around 
overriding the network settings.
Below is an example of what I see. When I set the address as: 
www.foobar.com/monit<http://www.foobar.com/monit>
I see the error as "Host not specified in the URL" and the connection fails.
My monit instances are set up being nginx via subpath, but as you can see in 
the screenshot,
m/monit is simply appending the port onto the end of the URL.
Do I need to use sub-domain instead?


[Inline image 1]

Best,
Saagar

On Tue, Jul 4, 2017 at 3:05 AM, Guillaume François 
<guillaume.francoi...@gmail.com<mailto:guillaume.francoi...@gmail.com>> wrote:
Hello Saagar,

I saw the misunderstanding.

The Monit network setting comes from the configuration of the "remote" Monit 
agent.

From my understanding, it is use by M/Monit to send "commands" to the remote 
Monit agent. In the case it cannot successfully connect, commands issued from 
M/Monit are not executed on the remote Monit agent.
This is only mandatory if you want to perform remote actions from M/Monit 
console. It doesn't block the collection of data.

If you want to change the connection information, you are able to override it 
for some data (see screenshot)

[cid:ii_j4pel5bz0_15d0d0ae1aea523c]
​
Does it answer your need ?

Best Regards.


2017-07-04 11:12 GMT+02:00 Mehul Ved 
<mehul@nexsales.com<mailto:mehul@nexsales.com>>:
I have the same kind of setup. Here's what I have done:
- Left the connector as it is
-START server.xml-

-END server.xml-

- In apache.conf I have proxied it as follows
-START APACHE CONFIG-
ProxyPass /mmonit  http://10.0.0.3:8090 nocanon
ProxyPassReverse  /mmonit http://10.0.0.3:8090
ProxyRequests Off
AllowEncodedSlashes NoDecode

# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie 
/etc/apache2/mods-enabled/proxy.conf in Ubuntu)
http://10.0.0.3:8090/*>
  Order deny,allow
  Allow from all

-END APACHE CONFIG-

For nginx, it is even simpler
-START NGINX CONFIG-
location /mmonit/ {
proxy_pass https://10.0.0.3:8090/;
}
-END NGINX CONFIG-

From: monit-general 
<monit-general-bounces+mehul.ved=nexsales@nongnu.org<mailto:nexsales@nongnu.org>>
 on behalf of Saagar Deshpande <saa...@edo.com<mailto:saa...@edo.com>>
Sent: Tuesday, July 4, 2017 1:56:30 PM
To: monit-general@nongnu.org<mailto:monit-general@nongnu.org>
Subject: Re: M/Monit Network Settings

Guillaume -

I took a look at the documentation, and if I understand correctly, this is 
providing instruction on setting up the connector for m/monit itself.
However, my issue is as follows: I would like to configure the Monit Network 
Settings for a host in m/monit such that the address is something like 
foobar.com/monit<http://foobar.com/monit> and the port is left null. 
Essentially, I would like m/monit to understand that I am using a sub-path 
without a port so that it can connect to the monit instances (and then be able 
to run start/stop operations via the m/monit web interface). Whenever I put in 
a network address such as "foobar.com/monit<http://foobar.com/monit>", m/monit 
is unable to resolve this into an address.

I hope this clarifies what I'm trying to accomplish.

- Saagar

On Tue, Jul 4, 2017 at 1:13 AM, Saagar Deshpande 
<saa...@edo.com<mailto:saa...@edo.com>> wrote:
Thanks Guillaume, I'll give that a look!

On Mon, Jul 3, 2017 at 8:52 AM, Saagar Deshpande 
<saa...@edo.com<mailto:saa...@edo.com>> wrote:
Dear monit-general,

I am setting up m/monit and have configured m/monit and monit behind nginx via 
proxy_pass. nginx is providing SSL to our other applications and also prevents 
unnecessary exposure to the ports that m/monit and monit are listening on.

When the proxy_pass is enabled, all traffic to https://www.foobar.com/monit is 
directed to monit and all traffic to https://www.foobar.com/mmonit is directed 
to m/monit . As such, I would like to understand how exactly to configure the 
network settings for m/monit so that a port is not required. Is this possible? 
The UI seems to append the port number to the end of the URL in all situations.

Best,
Saagar

--
Saagar Deshpande
Senior Software Engineer
973-454-4815<tel:(973)%20454-4815>
saa...@edo.com<mailto:saa...@edo.com>



--
Saagar Deshpande
Senior Software Engineer
973-454-4815<tel:(973)%20454-4815>
saa...@edo.com&

Re: M/Monit Network Settings

2017-07-04 Thread Mehul Ved
I have the same kind of setup. Here's what I have done:
- Left the connector as it is
-START server.xml-

-END server.xml-

- In apache.conf I have proxied it as follows
-START APACHE CONFIG-
ProxyPass /mmonit  http://10.0.0.3:8090 nocanon
ProxyPassReverse  /mmonit http://10.0.0.3:8090
ProxyRequests Off
AllowEncodedSlashes NoDecode

# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie 
/etc/apache2/mods-enabled/proxy.conf in Ubuntu)
http://10.0.0.3:8090/*>
  Order deny,allow
  Allow from all

-END APACHE CONFIG-

For nginx, it is even simpler
-START NGINX CONFIG-
location /mmonit/ {
proxy_pass https://10.0.0.3:8090/;
}
-END NGINX CONFIG-

From: monit-general  
on behalf of Saagar Deshpande 
Sent: Tuesday, July 4, 2017 1:56:30 PM
To: monit-general@nongnu.org
Subject: Re: M/Monit Network Settings

Guillaume -

I took a look at the documentation, and if I understand correctly, this is 
providing instruction on setting up the connector for m/monit itself.
However, my issue is as follows: I would like to configure the Monit Network 
Settings for a host in m/monit such that the address is something like 
foobar.com/monit and the port is left null. 
Essentially, I would like m/monit to understand that I am using a sub-path 
without a port so that it can connect to the monit instances (and then be able 
to run start/stop operations via the m/monit web interface). Whenever I put in 
a network address such as "foobar.com/monit", m/monit 
is unable to resolve this into an address.

I hope this clarifies what I'm trying to accomplish.

- Saagar

On Tue, Jul 4, 2017 at 1:13 AM, Saagar Deshpande 
> wrote:
Thanks Guillaume, I'll give that a look!

On Mon, Jul 3, 2017 at 8:52 AM, Saagar Deshpande 
> wrote:
Dear monit-general,

I am setting up m/monit and have configured m/monit and monit behind nginx via 
proxy_pass. nginx is providing SSL to our other applications and also prevents 
unnecessary exposure to the ports that m/monit and monit are listening on.

When the proxy_pass is enabled, all traffic to https://www.foobar.com/monit is 
directed to monit and all traffic to https://www.foobar.com/mmonit is directed 
to m/monit . As such, I would like to understand how exactly to configure the 
network settings for m/monit so that a port is not required. Is this possible? 
The UI seems to append the port number to the end of the URL in all situations.

Best,
Saagar

--
Saagar Deshpande
Senior Software Engineer
973-454-4815
saa...@edo.com



--
Saagar Deshpande
Senior Software Engineer
973-454-4815
saa...@edo.com



--
Saagar Deshpande
Senior Software Engineer
973-454-4815
saa...@edo.com
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Re: Syntax for else if

2016-06-20 Thread Mehul Ved
Alright. That explains. Thank you. But, is there a reason why else is not 
supported? Or if else will be added to this in the future?


From: monit-general <monit-general-bounces+mehul.ved=nexsales@nongnu.org> 
on behalf of Martin Pala <mart...@tildeslash.com>
Sent: Thursday, June 16, 2016 9:47:40 PM
To: This is the general mailing list for monit
Subject: Re: Syntax for else if

The "if x restarts within y cycles then ..." statement doesn't support the 
"else" part: 
https://mmonit.com/monit/documentation/monit.html#SERVICE-RESTART-LIMIT

Best regards,
Martin


On 16 Jun 2016, at 16:59, Mehul Ved 
<mehul@nexsales.com<mailto:mehul@nexsales.com>> wrote:

Here's what I have configured:

  if 2 restarts within 10 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"

but when I do monit validate it throws following error:

  /etc/monit/conf.d/frontendLogger.conf:19: syntax error 'else'

The else in the above configuration is the 19th line.

Here's the whole file, in case it helps

- START -
check process frontendLogger matching frontendLogger
  start program = "/bin/systemctl start frontendLogger"
  stop program = "/bin/systemctl stop frontendLogger"
  restart program = "/bin/systemctl restart frontendLogger"
  group nodejs
  if failed host 127.0.0.1 port 10500 protocol http
request /ping
content = "PONG"
with timeout 2 seconds
for 2 times in 4 cycles
then restart
  if failed host vr.com<http://vr.com/> port 443 type TCPSSL protocol http
request /logger/ping
content = "PONG"
with timeout 2 seconds
for 2 times within 4 cycles
then restart
  if 2 restarts within 10 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if does not exist for 3 times in 10 cycles then exec 
"/usr/local/bin/pagerduty-trigger frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if changed pid for 3 times in 10 cycles then exec 
"/usr/local/bin/pagerduty-trigger frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if memory > 70 MB for 3 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if cpu > 1% for 3 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
- END -


From: monit-general 
<monit-general-bounces+mehul.ved=nexsales@nongnu.org<mailto:monit-general-bounces+mehul.ved=nexsales@nongnu.org>>
 on behalf of Rui Lapa <rui.l...@ruilapa.net<mailto:rui.l...@ruilapa.net>>
Sent: Thursday, June 16, 2016 4:49 PM
To: This is the general mailing list for monit
Subject: Re: Syntax for else if


ELSE IF SUCCEEDED THEN

not

ELSE IF  THEN

On Thu, Jun 16, 2016 at 11:17 AM, Mehul Ved 
<mehul@nexsales.com<mailto:mehul@nexsales.com>> wrote:
Hello,
  I am configuring pagerduty integration with monit and have run into a 
roadblock while setting it up. As per the pagerduty documentation,
- to trigger a new incident, we need to add

if does not exist for 3 cycles
then exec "/etc/monit/pagerduty-trigger crond"

which works fine.

- to automatically mark the issue as resolved, we need to add

else if passed for 3 cycles
then exec "/etc/monit/pagerduty-resolve crond"

but this causes syntax error.

So, I looked up the monit documentation at 
https://mmonit.com/monit/documentation/monit.html and it shows the following 
syntax:

IF  THEN  [ELSE IF SUCCEEDED THEN ]

and this causes validation error as well.

I went through the changelog as well as the issue list on bitbucket but failed 
to find any information on the same. Has anything changed? Did I miss something 
here?
documentation - M/Monit<https://mmonit.com/monit/documentation/monit.html>
mmonit.com<http://mmonit.com/>
Version 5.18. NAME; SYNOPSIS; DESCRIPTION; WHAT TO MONITOR? GENERAL OPERATION. 
Options; Arguments; THE MONIT CONTROL FILE. Service checks. Process; File; 
Fifo; Filesystem



--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Re: Syntax for else if

2016-06-16 Thread Mehul Ved
$ monit -V

This is Monit version 5.18
Built with ssl, with pam and with large files
Copyright (C) 2001-2016 Tildeslash Ltd. All Rights Reserved.



From: monit-general <monit-general-bounces+mehul.ved=nexsales@nongnu.org> 
on behalf of Martin Pala <mart...@tildeslash.com>
Sent: Thursday, June 16, 2016 4:51:04 PM
To: This is the general mailing list for monit
Subject: Re: Syntax for else if

The following test configuration file works fine (tested with monit 5.18):

--8<--
set daemon 5

set httpd port 2812 allow localhost

check process "httpd" matching "httpd"
  if does not exist for 3 cycles
then exec "/etc/monit/pagerduty-trigger crond"
  else if passed for 3 cycles
then exec "/etc/monit/pagerduty-resolve crond"
--8<--

Which monit version do you use? (monit -V)

Best regards,
Martin


> On 16 Jun 2016, at 12:17, Mehul Ved <mehul@nexsales.com> wrote:
>
> Hello,
>   I am configuring pagerduty integration with monit and have run into a 
> roadblock while setting it up. As per the pagerduty documentation,
> - to trigger a new incident, we need to add
> if does not exist for 3 cycles
> then exec "/etc/monit/pagerduty-trigger crond"
>
> which works fine.
>
> - to automatically mark the issue as resolved, we need to add
> else if passed for 3 cycles
> then exec "/etc/monit/pagerduty-resolve crond"
>
> but this causes syntax error.
>
> So, I looked up the monit documentation at 
> https://mmonit.com/monit/documentation/monit.html and it shows the following 
> syntax:
> IF  THEN  [ELSE IF SUCCEEDED THEN ]
> and this causes validation error as well.
> I went through the changelog as well as the issue list on bitbucket but 
> failed to find any information on the same. Has anything changed? Did I miss 
> something here?
> documentation - M/Monit
> mmonit.com
> Version 5.18. NAME; SYNOPSIS; DESCRIPTION; WHAT TO MONITOR? GENERAL 
> OPERATION. Options; Arguments; THE MONIT CONTROL FILE. Service checks. 
> Process; File; Fifo; Filesystem
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Re: Syntax for else if

2016-06-16 Thread Mehul Ved
Here's what I have configured:

  if 2 restarts within 10 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"

but when I do monit validate it throws following error:

  /etc/monit/conf.d/frontendLogger.conf:19: syntax error 'else'

The else in the above configuration is the 19th line.

Here's the whole file, in case it helps

- START -
check process frontendLogger matching frontendLogger
  start program = "/bin/systemctl start frontendLogger"
  stop program = "/bin/systemctl stop frontendLogger"
  restart program = "/bin/systemctl restart frontendLogger"
  group nodejs
  if failed host 127.0.0.1 port 10500 protocol http
request /ping
content = "PONG"
with timeout 2 seconds
for 2 times in 4 cycles
then restart
  if failed host vr.com port 443 type TCPSSL protocol http
request /logger/ping
content = "PONG"
with timeout 2 seconds
for 2 times within 4 cycles
then restart
  if 2 restarts within 10 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if does not exist for 3 times in 10 cycles then exec 
"/usr/local/bin/pagerduty-trigger frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if changed pid for 3 times in 10 cycles then exec 
"/usr/local/bin/pagerduty-trigger frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if memory > 70 MB for 3 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
  if cpu > 1% for 3 cycles then exec "/usr/local/bin/pagerduty-trigger 
frontendlogger"
  else if succeeded then exec "/usr/local/bin/pagerduty-trigger frontendlogger"
- END -


From: monit-general <monit-general-bounces+mehul.ved=nexsales@nongnu.org> 
on behalf of Rui Lapa <rui.l...@ruilapa.net>
Sent: Thursday, June 16, 2016 4:49 PM
To: This is the general mailing list for monit
Subject: Re: Syntax for else if


ELSE IF SUCCEEDED THEN

not

ELSE IF  THEN

On Thu, Jun 16, 2016 at 11:17 AM, Mehul Ved 
<mehul@nexsales.com<mailto:mehul@nexsales.com>> wrote:

Hello,

  I am configuring pagerduty integration with monit and have run into a 
roadblock while setting it up. As per the pagerduty documentation,

- to trigger a new incident, we need to add

if does not exist for 3 cycles
then exec "/etc/monit/pagerduty-trigger crond"

which works fine.


- to automatically mark the issue as resolved, we need to add

else if passed for 3 cycles
then exec "/etc/monit/pagerduty-resolve crond"

but this causes syntax error.


So, I looked up the monit documentation at 
https://mmonit.com/monit/documentation/monit.html and it shows the following 
syntax:

IF  THEN  [ELSE IF SUCCEEDED THEN ]

and this causes validation error as well.

I went through the changelog as well as the issue list on bitbucket but failed 
to find any information on the same. Has anything changed? Did I miss something 
here?

documentation - M/Monit<https://mmonit.com/monit/documentation/monit.html>
mmonit.com<http://mmonit.com>
Version 5.18. NAME; SYNOPSIS; DESCRIPTION; WHAT TO MONITOR? GENERAL OPERATION. 
Options; Arguments; THE MONIT CONTROL FILE. Service checks. Process; File; 
Fifo; Filesystem



--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Syntax for else if

2016-06-16 Thread Mehul Ved
Hello,

  I am configuring pagerduty integration with monit and have run into a 
roadblock while setting it up. As per the pagerduty documentation,

- to trigger a new incident, we need to add

if does not exist for 3 cycles
then exec "/etc/monit/pagerduty-trigger crond"

which works fine.


- to automatically mark the issue as resolved, we need to add

else if passed for 3 cycles
then exec "/etc/monit/pagerduty-resolve crond"

but this causes syntax error.


So, I looked up the monit documentation at 
https://mmonit.com/monit/documentation/monit.html and it shows the following 
syntax:

IF  THEN  [ELSE IF SUCCEEDED THEN ]

and this causes validation error as well.

I went through the changelog as well as the issue list on bitbucket but failed 
to find any information on the same. Has anything changed? Did I miss something 
here?

documentation - M/Monit
mmonit.com
Version 5.18. NAME; SYNOPSIS; DESCRIPTION; WHAT TO MONITOR? GENERAL OPERATION. 
Options; Arguments; THE MONIT CONTROL FILE. Service checks. Process; File; 
Fifo; Filesystem


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Ordering of syntax check option

2014-06-17 Thread Mehul Ved
Hi,

  My monit file is in /etc/monit/monitrc, which isn't the usual path so when I 
run

 $ monit -t

it fails to file the control file, which is the correct behaviour.

To fix this, I tried

 $ monit -c /etc/monit/monitrc -t

which worked, as expected. But, when I did

 $ monit -t -c /etc/monit/monitrc

it gives the following error

 'monit: Cannot find the control file at ~/.monitrc, /etc/monitrc, 
/usr/local/etc/monitrc or at ./monitrc'

The above is unexpected. Does the order of the options have to matter? I 
believe this is a bug. If so, I'll file a bug report.


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

Using monit with Outlook 365 SMTP servers

2014-05-14 Thread Mehul Ved
I am trying to setup notifications from monit using Outlook 365 SMTP servers. 
They use TLS v1.1. The relevant lines in monitrc are as follows:

set mailserver smtp.office365.com port 587
  username mehul@nexsales.com password abcdef
  using tlsv11

but in the logs, it gives following error:

[GMT May 14 08:30:40] error: Sendmail: Authentication failed -- no 
supported authentication methods found


This configuration works with my email client. Am I missing out on something? 
Is this the correct way to setup TLS v1.1, I couldn't find documentation to 
setup TLS v1.1 for notifications.


The version of monit I'm using is

$ monit -V

This is Monit version 5.8?

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

RE: Using monit with Outlook 365 SMTP servers

2014-05-14 Thread Mehul Ved
From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com

 The original TLSv1.0 works both in Monit and on Office365 side = as a 
 workaround you can use 
 tlsv1 option instead of tlsv11:

 set mailserver smtp.office365.com port 587
   username mehul@nexsales.com password abcdef
   using tlsv1

Hi Martin,
  Thank you. This indeed works.
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


RE: restarting ffmpeg process

2014-05-08 Thread Mehul Ved
?


From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Anthony 
Griffiths neuron...@gmail.com
Sent: Thursday, May 08, 2014 3:49 PM
To: This is the general mailing list for monit
Subject: Re: restarting ffmpeg process

 that's gmail doing the top posting, sorry I can't help it because gmail 
 doesn't give you the  option of where your text is placed, it just gives a 
 reply box and that's all, however thankyou  for your further advice which 
 I'm going to try on another server.

It does. There are 3 dots at the bottom, if you click on them, it show you the 
whole text. After which you can reply inline.
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

RE: Process being restarted by monit validate even if it is running

2014-03-10 Thread Mehul Ved
I stopped monit daemon and ran monit -vI and that didn't restart the services. 
Even after restarting monit daemon, this time validate went fine. 
I'm not sure what changed or how to reproduce the issue. I'm setting up monit 
on another machine and will check what happens there.

From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com
Sent: Friday, March 07, 2014 5:01 PM
To: This is the general mailing list for monit
Subject: Re: Process being restarted by monit validate even if it is running

You can use pattern based check for processes which don't have pidfile (no need 
to create wrapper which will write the pidfile):

check process v2api matching /usr/local/bin/node 
/usr/local/share/nodeapis/server.js
...

The as uid root should be removed from start+stop script (as you described, 
Monit is running as root already).

For debugging, stop Monit and and start it again in foreground (-I = capital 
i) with -v option:

monit -vI

Monit will log details about each test to console.

Regards,
Martin



On 07 Mar 2014, at 12:21, Mehul Ved mehul@nexsales.com wrote:

 # ls -ld /var/run
 lrwxrwxrwx 1 root root 4 Jul  5  2013 /var/run - /run

 # ls -ld /var/run/node/
 drwxr-xr-x 2 root root 120 Mar  7 08:52 /var/run/node/

 # ls -l /var/run/node/v2.pid
 -rw-r--r-- 1 root root 4 Mar  7 08:52 /var/run/node/v2.pid

 # lsof -i :2812
 COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
 monit   14382 root6u  IPv4 70768563  0t0  TCP localhost:2812 (LISTEN)

 I am running monit as root and also monit validate is run from root login.

 I had added as uid root specifically because I was having problem reading 
 pidfile without that. Probably redundant now.
 Another thing I should have made clear. This is only happening only for 
 processes that I have written a start/stop script. My script gets the pid of 
 the process and echo's it into the given file. To the best of my knowledge 
 that's the correct thing to do with a pidfile. And considering that monit is 
 getting the pid correctly, I believe that part is fine. It even manages to 
 stop the program correctly, which would have failed if the program wasn't 
 running with correct pid.

 I am failing to figure out as to why monit doesn't see that process running. 
 Any suggested debugging steps I can follow?

 
 From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
 monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
 Pala mart...@tildeslash.com
 Sent: Friday, March 07, 2014 4:26 PM
 To: This is the general mailing list for monit
 Subject: Re: Process being restarted by monit validate even if it is running

 Hi,

 is Monit running as root or as different user?

 If it is running as root, then the as uid root in stop/start programs is 
 not necessary:

start program = /usr/local/bin/nodeinit v2 start as uid root

 If it is running as different user (which may be the reason for adding as 
 uid root, but that most probably won't work, as the user won't have 
 permission to switch to root unless the binary is setuid or sudo is used), 
 then it is possible that Monit cannot read the pidfile, please check the 
 permissions of the whole path to the pidfile and the pidfile itself:

ls -ld /var/run
ls -ld /var/run/node
ls -l /var/run/node/v2.pid

 You can run Monit in debug mode to get more details about the test progress:

monit -vI


 Regards,
 Martin


 On 07 Mar 2014, at 10:03, Mehul Ved mehul@nexsales.com wrote:

 Hi,
  I have a process which I am monitoring with following rules

 check process v2api with pidfile /var/run/node/v2.pid
  start program = /usr/local/bin/nodeinit v2 start
as uid root
  stop program = /usr/local/bin/nodeinit v2 stop
as uid root
  if failed host 127.0.0.1 port 10400 protocol http
request /api/v2/ping
with timeout 10 seconds
then restart
  if 5 restarts within 10 cycles then alert

 Before running monit validate, I checked the pidfile of the process

 # grep [0-9]* /var/run/node/
 /var/run/node/v2.pid:31566

 # cat /var/run/node/v2.pid
 31566

 I also verified with ps on the process id

 # ps aux | grep 31566
 root 31566  0.3  1.7 605684 29820 ?Sl   05:24   0:01 
 /usr/local/bin/node /usr/local/share/nodeapis/server.js


 Now when I run

 # monit validate --verbose
 'v2api' Error testing process id [31566] -- No such process
 'v2api' process is not running
 Does not exist notification is sent to mehul@nexsales.com
 'v2api' trying to restart
 'v2api' stop: /usr/local/bin/nodeinit
 'v2api' Error testing process id [31566] -- No such process
 /usr/local/bin/nodeinit: line 80: kill: (31566) - No such process
 Killed v2 process with pid 31566
 monit: pidfile '/var/run/node/v2.pid' does not exist
 monit

Process being restarted by monit validate even if it is running

2014-03-07 Thread Mehul Ved
Hi,

  I have a process which I am monitoring with following rules


check process v2api with pidfile /var/run/node/v2.pid
  start program = /usr/local/bin/nodeinit v2 start
as uid root
  stop program = /usr/local/bin/nodeinit v2 stop
as uid root
  if failed host 127.0.0.1 port 10400 protocol http
request /api/v2/ping
with timeout 10 seconds
then restart
  if 5 restarts within 10 cycles then alert

Before running monit validate, I checked the pidfile of the process

# grep [0-9]* /var/run/node/
/var/run/node/v2.pid:31566

# cat /var/run/node/v2.pid
31566

I also verified with ps on the process id

# ps aux | grep 31566
root 31566  0.3  1.7 605684 29820 ?Sl   05:24   0:01 
/usr/local/bin/node /usr/local/share/nodeapis/server.js


Now when I run

# monit validate --verbose
'v2api' Error testing process id [31566] -- No such process
'v2api' process is not running
Does not exist notification is sent to mehul@nexsales.com
'v2api' trying to restart
'v2api' stop: /usr/local/bin/nodeinit
'v2api' Error testing process id [31566] -- No such process
/usr/local/bin/nodeinit: line 80: kill: (31566) - No such process
Killed v2 process with pid 31566
monit: pidfile '/var/run/node/v2.pid' does not exist
monit: pidfile '/var/run/node/v2.pid' does not exist
'v2api' start: /usr/local/bin/nodeinit
monit: pidfile '/var/run/node/v2.pid' does not exist
v2 has started with PID: 1150

It complains that the process is not running.

I am using the development version of monit that Martin linked to a couple of 
days back, with websocket support.

# monit --version
This is Monit version 5.8
Copyright (C) 2001-2014 Tildeslash Ltd. All Rights Reserved.

?






--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

RE: Process being restarted by monit validate even if it is running

2014-03-07 Thread Mehul Ved
# ls -ld /var/run
lrwxrwxrwx 1 root root 4 Jul  5  2013 /var/run - /run

# ls -ld /var/run/node/
drwxr-xr-x 2 root root 120 Mar  7 08:52 /var/run/node/

# ls -l /var/run/node/v2.pid 
-rw-r--r-- 1 root root 4 Mar  7 08:52 /var/run/node/v2.pid

# lsof -i :2812
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
monit   14382 root6u  IPv4 70768563  0t0  TCP localhost:2812 (LISTEN)

I am running monit as root and also monit validate is run from root login. 

I had added as uid root specifically because I was having problem reading 
pidfile without that. Probably redundant now.
Another thing I should have made clear. This is only happening only for 
processes that I have written a start/stop script. My script gets the pid of 
the process and echo's it into the given file. To the best of my knowledge 
that's the correct thing to do with a pidfile. And considering that monit is 
getting the pid correctly, I believe that part is fine. It even manages to stop 
the program correctly, which would have failed if the program wasn't running 
with correct pid. 

I am failing to figure out as to why monit doesn't see that process running. 
Any suggested debugging steps I can follow?


From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com
Sent: Friday, March 07, 2014 4:26 PM
To: This is the general mailing list for monit
Subject: Re: Process being restarted by monit validate even if it is running

Hi,

is Monit running as root or as different user?

If it is running as root, then the as uid root in stop/start programs is not 
necessary:

start program = /usr/local/bin/nodeinit v2 start as uid root

If it is running as different user (which may be the reason for adding as uid 
root, but that most probably won't work, as the user won't have permission to 
switch to root unless the binary is setuid or sudo is used), then it is 
possible that Monit cannot read the pidfile, please check the permissions of 
the whole path to the pidfile and the pidfile itself:

ls -ld /var/run
ls -ld /var/run/node
ls -l /var/run/node/v2.pid

You can run Monit in debug mode to get more details about the test progress:

monit -vI


Regards,
Martin


On 07 Mar 2014, at 10:03, Mehul Ved mehul@nexsales.com wrote:

 Hi,
   I have a process which I am monitoring with following rules

 check process v2api with pidfile /var/run/node/v2.pid
   start program = /usr/local/bin/nodeinit v2 start
 as uid root
   stop program = /usr/local/bin/nodeinit v2 stop
 as uid root
   if failed host 127.0.0.1 port 10400 protocol http
 request /api/v2/ping
 with timeout 10 seconds
 then restart
   if 5 restarts within 10 cycles then alert

 Before running monit validate, I checked the pidfile of the process

 # grep [0-9]* /var/run/node/
 /var/run/node/v2.pid:31566

 # cat /var/run/node/v2.pid
 31566

 I also verified with ps on the process id

 # ps aux | grep 31566
 root 31566  0.3  1.7 605684 29820 ?Sl   05:24   0:01 
 /usr/local/bin/node /usr/local/share/nodeapis/server.js


 Now when I run

 # monit validate --verbose
 'v2api' Error testing process id [31566] -- No such process
 'v2api' process is not running
 Does not exist notification is sent to mehul@nexsales.com
 'v2api' trying to restart
 'v2api' stop: /usr/local/bin/nodeinit
 'v2api' Error testing process id [31566] -- No such process
 /usr/local/bin/nodeinit: line 80: kill: (31566) - No such process
 Killed v2 process with pid 31566
 monit: pidfile '/var/run/node/v2.pid' does not exist
 monit: pidfile '/var/run/node/v2.pid' does not exist
 'v2api' start: /usr/local/bin/nodeinit
 monit: pidfile '/var/run/node/v2.pid' does not exist
 v2 has started with PID: 1150

 It complains that the process is not running.

 I am using the development version of monit that Martin linked to a couple of 
 days back, with websocket support.

 # monit --version
 This is Monit version 5.8
 Copyright (C) 2001-2014 Tildeslash Ltd. All Rights Reserved.

 ​






 --
 To unsubscribe:
 https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

RE: Websockets monitoring

2014-03-05 Thread Mehul Ved
Hi Martin,
  I tried using the new version of monit but it fails on `monit validate` for 
websockets

$ which monit
/usr/local/bin/monit

$ monit --version
This is Monit version 5.8
Copyright (C) 2001-2014 Tildeslash Ltd. All Rights Reserved.

The lines I've added:

 if failed host dev.deltamktgresearch.com port 10301 protocol websocket
host dev.deltamktgresearch.com
request /
origin http://www.websocket.org;
version 13
then alert

$ monit validate --verbose
'wsserver' zombie check succeeded [status_flag=]
'wsserver' succeeded connecting to INET[dev.deltamktgresearch.com:10301/] via 
TCP
'wsserver' failed protocol test [WEBSOCKET] at 
INET[dev.deltamktgresearch.com:10301/] via TCP -- WEBSOCKET: pong error -- 
opcode 0x1


Using location ws://dev.deltamktgresearch.com:10301 in location box on 
http://websocket.org works perfectly. It responds with who which is correct. 
Is there a way to set send/expect to check for the correct response?

From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com
Sent: Monday, March 03, 2014 2:29 PM
To: This is the general mailing list for monit
Subject: Re: Websockets monitoring

Hi,

we have implemented the websocket protocol test, example usage:

check host websocket.org with address echo.websocket.org
if failed port 80 protocol websocket
  host echo.websocket.org
  request /
  origin http://www.websocket.com;
  version 13
then alert

The test connects to websocket, performs ping/pong test and closes the 
connection.

If you want to test it, you can get the development Monit version here: 
https://bitbucket.org/tildeslash/monit/get/master.tar.gz

Compilation:

tar -xzf master.tar.gz
cd tildeslash-monit-*
./bootstrap  ./configure  make

The monit binary will be in current directory, you can install it to 
/usr/local/bin using make install

Regards,
Martin


On 24 Feb 2014, at 07:23, Mehul Ved mehul@nexsales.com wrote:

 Hi,
   I have a node.js service that works as a websocket server. I am working on 
 monitoring it using monit. I haven't been able to find any information about 
 using websockets with monit either in the group archives or using google 
 search. Has anybody worked on this before?
   Is it possible to monitor websockets in monit currently without adding in a 
 websocket client script in between? I can definitely do that but wanted to 
 check if there's a better way to do it without any additional component.
 --
 To unsubscribe:
 https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


RE: Websockets monitoring

2014-03-05 Thread Mehul Ved
Hi Martin,
  It's a custom application developed by us in node.js. I'll speak to my 
developer and ensure that our application is made RFC compliant. That would be 
a much cleaner solution.

I'm attaching the pcap file.

From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com
Sent: Wednesday, March 05, 2014 3:58 PM
To: This is the general mailing list for monit
Subject: Re: Websockets monitoring

Hi,

it seems that your websocket server doesn't support ping/pong (part of 
websocket specification: RFC 6455) and instead sent some text frame in response 
to ping ... either the text frame contains some error description, websocket 
ping request is prohibited or the server is not RFC 6455 compliant.

The problem can be in the test configuration ... the version 13, origin 
http://www.websocket.org; works with the demo echo websocket server operate by 
websocket.org. Each websocket application has its own version and 13 may be 
invalid in your case. Also the origin is part of websocket security model and 
origin http://www.websocket.org; is basically settings for websocket.org's 
service ... not general value - but if it was not accepted by the server, it 
should return 403 error as response to HTTP upgrade request, which it didn't 
(101 was received, otherwise there will be different error in log).

The websocket.org demo with location works for 
ws://dev.deltamktgresearch.com:10301, but their echo test doesn't use ping - it 
sends just text frame ... such test is not generic and may fail in other 
websocket implementations (connect+ping/pong+close should be generic for every 
RFC compliant server).

We can simplify the test and rely only on websocket connection (http upgrade 
request) + websocket close ... this should work on all websocket servers, even 
those which don't support ping/pong.

Please can you get a network trace of the test? You can use for example 
tcpdump/tshark/wireshark/snoop, tcpdump on the machine where Monit is running:

tcpdump -s 0 -i any -w websocket.pcap port 10301

If there is also regular traffic which you don't want to expose to mailing 
list, either filter out only the Monit session packets or send the file 
directly to me.


Regards,
Martin




On 05 Mar 2014, at 09:32, Mehul Ved mehul@nexsales.com wrote:

 Hi Martin,
  I tried using the new version of monit but it fails on `monit validate` for 
 websockets

 $ which monit
 /usr/local/bin/monit

 $ monit --version
 This is Monit version 5.8
 Copyright (C) 2001-2014 Tildeslash Ltd. All Rights Reserved.

 The lines I've added:

 if failed host dev.deltamktgresearch.com port 10301 protocol websocket
host dev.deltamktgresearch.com
request /
origin http://www.websocket.org;
version 13
then alert

 $ monit validate --verbose
 'wsserver' zombie check succeeded [status_flag=]
 'wsserver' succeeded connecting to INET[dev.deltamktgresearch.com:10301/] via 
 TCP
 'wsserver' failed protocol test [WEBSOCKET] at 
 INET[dev.deltamktgresearch.com:10301/] via TCP -- WEBSOCKET: pong error -- 
 opcode 0x1


 Using location ws://dev.deltamktgresearch.com:10301 in location box on 
 http://websocket.org works perfectly. It responds with who which is 
 correct. Is there a way to set send/expect to check for the correct response?
 
 From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
 monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
 Pala mart...@tildeslash.com
 Sent: Monday, March 03, 2014 2:29 PM
 To: This is the general mailing list for monit
 Subject: Re: Websockets monitoring

 Hi,

 we have implemented the websocket protocol test, example usage:

 check host websocket.org with address echo.websocket.org
if failed port 80 protocol websocket
  host echo.websocket.org
  request /
  origin http://www.websocket.com;
  version 13
then alert

 The test connects to websocket, performs ping/pong test and closes the 
 connection.

 If you want to test it, you can get the development Monit version here: 
 https://bitbucket.org/tildeslash/monit/get/master.tar.gz

 Compilation:

tar -xzf master.tar.gz
cd tildeslash-monit-*
./bootstrap  ./configure  make

 The monit binary will be in current directory, you can install it to 
 /usr/local/bin using make install

 Regards,
 Martin


 On 24 Feb 2014, at 07:23, Mehul Ved mehul@nexsales.com wrote:

 Hi,
  I have a node.js service that works as a websocket server. I am working on 
 monitoring it using monit. I haven't been able to find any information about 
 using websockets with monit either in the group archives or using google 
 search. Has anybody worked on this before?
  Is it possible to monitor websockets in monit currently without adding in a 
 websocket client script in between? I can definitely

Re: Websockets monitoring

2014-03-05 Thread Mehul Ved
Sure, you can use it for testing.

On Mar 5, 2014 5:04 PM, Martin Pala mart...@tildeslash.com wrote:

 Thanks for the trace.

 It seems that your server responds with pong (in packet no. 11), but before 
 that, it sends chat text frame with who prompt (in packet no. 9):

 No.     Time        Source                Destination           Protocol 
 Length Info
       4 0.000384    127.0.0.1             127.0.0.1             HTTP     309  
   GET / HTTP/1.1

 No.     Time        Source                Destination           Protocol 
 Length Info
       6 0.001237    127.0.0.1             127.0.0.1             HTTP     197  
   HTTP/1.1 101 Switching Protocols

 No.     Time        Source                Destination           Protocol 
 Length Info
       8 0.001303    127.0.0.1             127.0.0.1             WebSocket 70  
    WebSocket Ping [FIN]

 WebSocket
     1...  = Fin: True
     .000  = Reserved: 0x00
      1001 = Opcode: Ping (9)
     0...  = Mask: False
     .000  = Payload length: 0

 No.     Time        Source                Destination           Protocol 
 Length Info
       9 0.002225    127.0.0.1             127.0.0.1             WebSocket 75  
    WebSocket Text [FIN]

     WebSocket
     1...  = Fin: True
     .000  = Reserved: 0x00
      0001 = Opcode: Text (1)
     0...  = Mask: False
     .000 0101 = Payload length: 5
     Payload
         Text: who

 No.     Time        Source                Destination           Protocol 
 Length Info
      11 0.003986    127.0.0.1             127.0.0.1             WebSocket 70  
    WebSocket Pong [FIN]

     WebSocket
     1...  = Fin: True
     .000  = Reserved: 0x00
      1010 = Opcode: Pong (10)
     0...  = Mask: False
     .000  = Payload length: 0


 At this point Monit expects response to its own request, so the protocol test 
 failed.

 The server response is OK, we just need to allow server messages (such as 
 this prompt) not related to our own ping request. The websocket.org's service 
 works differently ... it's not chat service, just echo, so it doesn't send 
 any prompt.

 Will fix the test. 

 Can i use your websocket servis (from the previous email) to verify the test 
 works with it?

 Regards,
 Martin



 On 05 Mar 2014, at 12:13, Mehul Ved mehul@nexsales.com wrote:

 Hi Martin,
  It's a custom application developed by us in node.js. I'll speak to my 
 developer and ensure that our application is made RFC compliant. That would 
 be a much cleaner solution.

 I'm attaching the pcap file.
 
 From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
 monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of 
 Martin Pala mart...@tildeslash.com
 Sent: Wednesday, March 05, 2014 3:58 PM
 To: This is the general mailing list for monit
 Subject: Re: Websockets monitoring

 Hi,

 it seems that your websocket server doesn't support ping/pong (part of 
 websocket specification: RFC 6455) and instead sent some text frame in 
 response to ping ... either the text frame contains some error description, 
 websocket ping request is prohibited or the server is not RFC 6455 compliant.

 The problem can be in the test configuration ... the version 13, origin 
 http://www.websocket.org; works with the demo echo websocket server operate 
 by websocket.org. Each websocket application has its own version and 13 may 
 be invalid in your case. Also the origin is part of websocket security model 
 and origin http://www.websocket.org; is basically settings for 
 websocket.org's service ... not general value - but if it was not accepted 
 by the server, it should return 403 error as response to HTTP upgrade 
 request, which it didn't (101 was received, otherwise there will be 
 different error in log).

 The websocket.org demo with location works for 
 ws://dev.deltamktgresearch.com:10301, but their echo test doesn't use ping - 
 it sends just text frame ... such test is not generic and may fail in other 
 websocket implementations (connect+ping/pong+close should be generic for 
 every RFC compliant server).

 We can simplify the test and rely only on websocket connection (http upgrade 
 request) + websocket close ... this should work on all websocket servers, 
 even those which don't support ping/pong.

 Please can you get a network trace of the test? You can use for example 
 tcpdump/tshark/wireshark/snoop, tcpdump on the machine where Monit is 
 running:

    tcpdump -s 0 -i any -w websocket.pcap port 10301

 If there is also regular traffic which you don't want to expose to mailing 
 list, either filter out only the Monit session packets or send the file 
 directly to me.


 Regards,
 Martin




 On 05 Mar 2014, at 09:32, Mehul Ved mehul@nexsales.com wrote:

 Hi Martin,
 I tried using the new version of monit but it fails on `monit validate` for 
 websockets

 $ which monit
 /usr/local/bin/monit

 $ monit --version
 This is Monit

RE: Websockets monitoring

2014-03-05 Thread Mehul Ved
Hi Martin,

 Awesome, that works perfectly. Thank you.

​


From: Martin Pala mart...@tildeslash.com
Sent: Thursday, March 06, 2014 1:26 AM
To: Mehul Ved
Cc: This is the general mailing list for monit
Subject: Re: Websockets monitoring

Hi,

the websocket test is fixed to support non-pong frames sent by server (such as 
the mentioned chat prompt). Tested with your websocket service, works fine.

You can get the latest code with fix here: 
https://bitbucket.org/tildeslash/monit/get/master.tar.gz


Regards,
Martin



On 05 Mar 2014, at 13:05, Mehul Ved 
mehul@nexsales.commailto:mehul@nexsales.com wrote:

Sure, you can use it for testing.

On Mar 5, 2014 5:04 PM, Martin Pala 
mart...@tildeslash.commailto:mart...@tildeslash.com wrote:

Thanks for the trace.

It seems that your server responds with pong (in packet no. 11), but before 
that, it sends chat text frame with who prompt (in packet no. 9):

No. TimeSourceDestination   Protocol Length 
Info
  4 0.000384127.0.0.1 127.0.0.1 HTTP 309
GET / HTTP/1.1

No. TimeSourceDestination   Protocol Length 
Info
  6 0.001237127.0.0.1 127.0.0.1 HTTP 197
HTTP/1.1 101 Switching Protocols

No. TimeSourceDestination   Protocol Length 
Info
  8 0.001303127.0.0.1 127.0.0.1 WebSocket 70
 WebSocket Ping [FIN]

WebSocket
1...  = Fin: True
.000  = Reserved: 0x00
 1001 = Opcode: Ping (9)
0...  = Mask: False
.000  = Payload length: 0

No. TimeSourceDestination   Protocol Length 
Info
  9 0.002225127.0.0.1 127.0.0.1 WebSocket 75
 WebSocket Text [FIN]

WebSocket
1...  = Fin: True
.000  = Reserved: 0x00
 0001 = Opcode: Text (1)
0...  = Mask: False
.000 0101 = Payload length: 5
Payload
Text: who

No. TimeSourceDestination   Protocol Length 
Info
 11 0.003986127.0.0.1 127.0.0.1 WebSocket 70
 WebSocket Pong [FIN]

WebSocket
1...  = Fin: True
.000  = Reserved: 0x00
 1010 = Opcode: Pong (10)
0...  = Mask: False
.000  = Payload length: 0


At this point Monit expects response to its own request, so the protocol test 
failed.

The server response is OK, we just need to allow server messages (such as this 
prompt) not related to our own ping request. The 
websocket.orghttp://websocket.org/'s service works differently ... it's not 
chat service, just echo, so it doesn't send any prompt.

Will fix the test.

Can i use your websocket servis (from the previous email) to verify the test 
works with it?

Regards,
Martin



On 05 Mar 2014, at 12:13, Mehul Ved 
mehul@nexsales.commailto:mehul@nexsales.com wrote:

Hi Martin,
 It's a custom application developed by us in node.js. I'll speak to my 
developer and ensure that our application is made RFC compliant. That would be 
a much cleaner solution.

I'm attaching the pcap file.

From: 
monit-general-bounces+mehul.ved=nexsales@nongnu.orgmailto:monit-general-bounces+mehul.ved=nexsales@nongnu.org
 
monit-general-bounces+mehul.ved=nexsales@nongnu.orgmailto:monit-general-bounces+mehul.ved=nexsales@nongnu.org
 on behalf of Martin Pala 
mart...@tildeslash.commailto:mart...@tildeslash.com
Sent: Wednesday, March 05, 2014 3:58 PM
To: This is the general mailing list for monit
Subject: Re: Websockets monitoring

Hi,

it seems that your websocket server doesn't support ping/pong (part of 
websocket specification: RFC 6455) and instead sent some text frame in response 
to ping ... either the text frame contains some error description, websocket 
ping request is prohibited or the server is not RFC 6455 compliant.

The problem can be in the test configuration ... the version 13, origin 
http://www.websocket.orghttp://www.websocket.org/ works with the demo echo 
websocket server operate by websocket.orghttp://websocket.org/. Each 
websocket application has its own version and 13 may be invalid in your case. 
Also the origin is part of websocket security model and origin 
http://www.websocket.orghttp://www.websocket.org/ is basically settings for 
websocket.orghttp://websocket.org/'s service ... not general value - but if 
it was not accepted by the server, it should return 403 error as response to 
HTTP upgrade request, which it didn't (101 was received, otherwise there will 
be different error in log).

The websocket.orghttp://websocket.org/ demo with location works for 
ws://dev.deltamktgresearch.com:10301/owa/?wa=wsignin1.0, but their echo test 
doesn't use ping - it sends just text frame ... such test is not generic and 
may fail in other websocket implementations

RE: Websockets monitoring

2014-03-03 Thread Mehul Ved
Hi Martin,
 Thanks for the websocket implementation. I'll try it out and provide feedback.


From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com
Sent: Monday, March 03, 2014 2:29 PM
To: This is the general mailing list for monit
Subject: Re: Websockets monitoring

Hi,

we have implemented the websocket protocol test, example usage:

check host websocket.org with address echo.websocket.org
if failed port 80 protocol websocket
  host echo.websocket.org
  request /
  origin http://www.websocket.com;
  version 13
then alert

The test connects to websocket, performs ping/pong test and closes the 
connection.

If you want to test it, you can get the development Monit version here: 
https://bitbucket.org/tildeslash/monit/get/master.tar.gz

Compilation:

tar -xzf master.tar.gz
cd tildeslash-monit-*
./bootstrap  ./configure  make

The monit binary will be in current directory, you can install it to 
/usr/local/bin using make install

Regards,
Martin


On 24 Feb 2014, at 07:23, Mehul Ved mehul@nexsales.com wrote:

 Hi,
   I have a node.js service that works as a websocket server. I am working on 
 monitoring it using monit. I haven't been able to find any information about 
 using websockets with monit either in the group archives or using google 
 search. Has anybody worked on this before?
   Is it possible to monitor websockets in monit currently without adding in a 
 websocket client script in between? I can definitely do that but wanted to 
 check if there's a better way to do it without any additional component.
 --
 To unsubscribe:
 https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


Environment variables with start program

2014-02-20 Thread Mehul Ved
Hi,

I have a node.js services that I want to be monitored by monit. I have written 
a bash script to start and stop these services. The script works fine when run 
from my bash console. But, it fails when run through monit, as explained on FAQ 
page that monit uses execv and thus environment variables are not available.


One of the workarounds that people have been using is:

/usr/bin/env KEY=value myscript.sh

Unfortunately, I can't use that since I have a lot of variables, some of which 
are quite long and thus exceed the 127 character limit.


Is there any other way I can have my environment variable available to the 
start program script?
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

RE: Environment variables with start program

2014-02-20 Thread Mehul Ved
Hi Martin,

  I did try this but it did not load the environment variables. Let me try it 
again though, if I did anything wrong back then.



From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Martin 
Pala mart...@tildeslash.com
Sent: Thursday, February 20, 2014 6:33 PM
To: This is the general mailing list for monit
Subject: Re: Environment variables with start program

Hi,

you can wrap the script in shell like this:

start program = /bin/bash -c '/etc/init.d/myprogram start'

The shell will load its profile (set environment variables).


Regards,
Martin



On 20 Feb 2014, at 12:38, Mehul Ved 
mehul@nexsales.commailto:mehul@nexsales.com wrote:


Hi,

I have a node.js services that I want to be monitored by monit. I have written 
a bash script to start and stop these services. The script works fine when run 
from my bash console. But, it fails when run through monit, as explained on FAQ 
page that monit uses execv and thus environment variables are not available.


One of the workarounds that people have been using is:

/usr/bin/env KEY=value myscript.sh

Unfortunately, I can't use that since I have a lot of variables, some of which 
are quite long and thus exceed the 127 character limit.


Is there any other way I can have my environment variable available to the 
start program script?

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general

RE: Environment variables with start program

2014-02-20 Thread Mehul Ved
Hi Martin,

  Sorry, I should have shown my script. I handled both these things. Turns out 
the problem was in the way I loaded the variables from /etc/environment file. 
They were in form of

KEY='value'

And I loaded the /etc/environment file using

# Set all the environment variables
OLDIFS=$IFS
IFS=$'\n' # We need to explicitly tell the shell to use new line as IFS else it 
will use spaces.
for LINE in $(cat /etc/environment)
do
export $LINE
done
IFS=$OLDIFS

So the variable value had quotes in it thus weren't getting discarded by the 
type check in the library we used.
Adding this here in case somebody else runs into a similar issue.

My problem is solved.

Thank You.



From: monit-general-bounces+mehul.ved=nexsales@nongnu.org 
monit-general-bounces+mehul.ved=nexsales@nongnu.org on behalf of Weedy 
weedy2...@gmail.com
Sent: Friday, February 21, 2014 8:02 AM
To: This is the general mailing list for monit
Subject: RE: Environment variables with start program


If you need THAT many variables you should source them from the start function 
of your script.

On 20 Feb 2014 17:56, Mehul Ved 
mehul@nexsales.commailto:mehul@nexsales.com wrote:

Hi Martin,

  I did try this but it did not load the environment variables. Let me try it 
again though, if I did anything wrong back then.



From: 
monit-general-bounces+mehul.ved=nexsales@nongnu.orgmailto:nexsales@nongnu.org
 
monit-general-bounces+mehul.ved=nexsales@nongnu.orgmailto:nexsales@nongnu.org
 on behalf of Martin Pala 
mart...@tildeslash.commailto:mart...@tildeslash.com
Sent: Thursday, February 20, 2014 6:33 PM
To: This is the general mailing list for monit
Subject: Re: Environment variables with start program

Hi,

you can wrap the script in shell like this:

start program = /bin/bash -c '/etc/init.d/myprogram start'

The shell will load its profile (set environment variables).


Regards,
Martin



On 20 Feb 2014, at 12:38, Mehul Ved 
mehul@nexsales.commailto:mehul@nexsales.com wrote:


Hi,

I have a node.js services that I want to be monitored by monit. I have written 
a bash script to start and stop these services. The script works fine when run 
from my bash console. But, it fails when run through monit, as explained on FAQ 
page that monit uses execv and thus environment variables are not available.


One of the workarounds that people have been using is:

/usr/bin/env KEY=value myscript.sh

Unfortunately, I can't use that since I have a lot of variables, some of which 
are quite long and thus exceed the 127 character limit.


Is there any other way I can have my environment variable available to the 
start program script?

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general