Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Custom Alarm Function

From build 3044 the development baton passed to Mark Crossley. Mark has been responsible for all the Builds since. He has made the code available on GitHub. It is Mark's hope that others will join in this development, but at the very least he welcomes your ideas for future developments (see Cumulus MX Development suggestions).

Moderator: mcrossley

stefanbagnato
Posts: 159
Joined: Sun 08 May 2016 9:11 pm
Weather Station: Vantage Pro 2
Operating System: Windows Server 2019
Location: Raleigh, NC

Custom Alarm Function

Post by stefanbagnato »

Is there any possibility to create a custom alarm function? For example, if the Data Stopped alarm triggers, (for me) the issue is due to a blocked COM port (more about that in another post) and the fix is to bounce the CMX service. I have a script to bounce the service, but I am trying to figure out a trigger. Instead of having a constantly-running script reading the mxdiags looking for a COM error, a trigger via the existing alarm setting would be awesome.
User avatar
mcrossley
Posts: 12689
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Custom Alarm Function

Post by mcrossley »

A good idea, now on the todo list.
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Custom Alarm Function

Post by Phil23 »

I constantly revisit a similar concept regarding overall failures.

The two basic concepts in mind were a bit like this.

1. A heartbeat file is periodically uploaded to somewhere on hosiene.co.uk & a script running on the server decides if it need to notify the user that the stations off-line.
That idea would be immediately flawed in the case of a host failure etc; Ftp could be failing to the host but fine to hosiene.

2. A script on hosiene grabs a users realtime.txt periodically, say 15 or 30 minute intervals, or definable with an appropriate lower limit minimum.
If the request fails or doesn't compare appropriately a notification is sent.

Both ideas would obviously need to be server based & keep within bandwidth limitations.

Cheers

Phil.

Edit:- Light bulb moment as usual on hitting submit....

Alternate location for the server side scripts to be hosted & run from could be beteljuice.co.uk :idea:
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
freddie
Posts: 2433
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 22.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Custom Alarm Function

Post by freddie »

Phil23 wrote: Wed 15 Sep 2021 10:07 pm I constantly revisit a similar concept regarding overall failures.

The two basic concepts in mind were a bit like this.

1. A heartbeat file is periodically uploaded to somewhere on hosiene.co.uk & a script running on the server decides if it need to notify the user that the stations off-line.
That idea would be immediately flawed in the case of a host failure etc; Ftp could be failing to the host but fine to hosiene.

2. A script on hosiene grabs a users realtime.txt periodically, say 15 or 30 minute intervals, or definable with an appropriate lower limit minimum.
If the request fails or doesn't compare appropriately a notification is sent.

Both ideas would obviously need to be server based & keep within bandwidth limitations.

Cheers

Phil.

Edit:- Light bulb moment as usual on hitting submit....

Alternate location for the server side scripts to be hosted & run from could be beteljuice.co.uk :idea:
A good idea - the external monitoring bit - but as you point out it is prone to host/internet connection failures, so I think a centralised monitor is unworkable.

What I do is periodically check access to the port that the MX interface is running on, which I have found to be extremely reliable. It's not a complex script - just a simple one-liner. I put it directly in my crontab and set it to run every 5 minutes and it will drop you an email if the connection is unavailable.

Code: Select all

nc -zw 2 IP.ADDR.OF.MX 8998 && { echo "CumulusMX up" ; } || { `mail -r xxxx@hosiene.co.uk -s "[LAN monitor]: CumulusMX check" yyyy@hosiene.co.uk <<< 'CumulusMX is down'` ; }
'nc' is netcat. If you don't have it installed, use the following:

Code: Select all

sudo apt install netcat
Other package managers use different commands to install.
Freddie
Image
stefanbagnato
Posts: 159
Joined: Sun 08 May 2016 9:11 pm
Weather Station: Vantage Pro 2
Operating System: Windows Server 2019
Location: Raleigh, NC

Re: Custom Alarm Function

Post by stefanbagnato »

Yeah I do like the idea. However, for some folks (myself included) it wouldn't be that useful. Everything is local; physical server, CMX db, web server, etc.

My idea (hope?) was just the support for a custom function. Like the ability to call a batch file or ps script. Then I can make it do whatever magic I'd like ;)
freddie
Posts: 2433
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 22.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Custom Alarm Function

Post by freddie »

The drawback of a custom function is that it won't tell you if MX stops running - as it will be MX triggering your magic.

This idea (using nc or some other external utility) is purely for alerting you when MX stops running.
Freddie
Image
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Custom Alarm Function

Post by Phil23 »

stefanbagnato wrote: Thu 16 Sep 2021 12:43 pm Yeah I do like the idea. However, for some folks (myself included) it wouldn't be that useful. Everything is local; physical server, CMX db, web server, etc.
If you are locally hosting a publicly visible website, then wouldn't something like the 2nd idea would make sense.

The initial idea is not so much a CMX not working watchdog, more a case of simply my Website is not updating.

That could be for a variety of reasons in the chain.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Custom Alarm Function

Post by Phil23 »

So if a service running on another Webhost somewhere was to grab my realtime.txt file every hour or two,
That would serve as a time stamp & could be compared with now and then in need be trigger an email etc.

Does that create difficulties from the point of view of cross site scripting?

Developing something like this is way out of my skill sets & have no idea what can and cannot be done from a hosts side.

Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
freddie
Posts: 2433
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 22.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Custom Alarm Function

Post by freddie »

It's a simple enough proposal. It won't be affected by XSS if you code it appropriately. I would implement it internally to your LAN if it was just a lack of updates that you wished to notice. The only reason I would do it from another web host out in the wild was if you wanted to notice lack of access to your whole website - but there are providers out there who already offer this service.
Freddie
Image
stefanbagnato
Posts: 159
Joined: Sun 08 May 2016 9:11 pm
Weather Station: Vantage Pro 2
Operating System: Windows Server 2019
Location: Raleigh, NC

Re: Custom Alarm Function

Post by stefanbagnato »

Phil23 wrote: Thu 16 Sep 2021 8:37 pm If you are locally hosting a publicly visible website, then wouldn't something like the 2nd idea would make sense.

The initial idea is not so much a CMX not working watchdog, more a case of simply my Website is not updating.

That could be for a variety of reasons in the chain.
Yes, this is true. IMO I think this has morphed into multiple ideas, which is awesome. My initial premise was simply related to when there is an issue with data making it to CMX, and the subsequent actions taken. However, the CMX -> Website link is equally important as well, as you stated.
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Custom Alarm Function

Post by Phil23 »

Ok,

Interesting real life example came up yesterday while attending one of my client's sites.

The Spare Parts Guy hits me with "When are you going to Fix your Weather Pages?".

I told him it was fine, he argued it was stuck on the 15th @ 18°C.
Opened the Gauges page in his browser & showed him it was fine.
He added that yes, the gauges worked OK & all the others were broken.
Tried hard refreshes & confirmed he was right.

Checked the same on my phone & again he's right.
Back home I find a 2nd instance has loaded due to a script timing issue (maybe).
Restarted & all was back to being fine.

So the state it was in had Realtime FTP still running fine, but the 10 minute interval process & upload was what had broken.

So in effect that creates a fault in my suggestion above that just the Realtime.txt could be used as the basis of a watchdog.

Although I check my station repeatedly each day, my link button point to the gauges page & I mostly simply take a glance then get back to what I'm doing.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Custom Alarm Function

Post by dazza1223 »

freddie wrote: Thu 16 Sep 2021 7:41 am
Phil23 wrote: Wed 15 Sep 2021 10:07 pm I constantly revisit a similar concept regarding overall failures.

The two basic concepts in mind were a bit like this.

1. A heartbeat file is periodically uploaded to somewhere on hosiene.co.uk & a script running on the server decides if it need to notify the user that the stations off-line.
That idea would be immediately flawed in the case of a host failure etc; Ftp could be failing to the host but fine to hosiene.

2. A script on hosiene grabs a users realtime.txt periodically, say 15 or 30 minute intervals, or definable with an appropriate lower limit minimum.
If the request fails or doesn't compare appropriately a notification is sent.

Both ideas would obviously need to be server based & keep within bandwidth limitations.

Cheers

Phil.

Edit:- Light bulb moment as usual on hitting submit....

Alternate location for the server side scripts to be hosted & run from could be beteljuice.co.uk :idea:
A good idea - the external monitoring bit - but as you point out it is prone to host/internet connection failures, so I think a centralised monitor is unworkable.

What I do is periodically check access to the port that the MX interface is running on, which I have found to be extremely reliable. It's not a complex script - just a simple one-liner. I put it directly in my crontab and set it to run every 5 minutes and it will drop you an email if the connection is unavailable.

Code: Select all

nc -zw 2 IP.ADDR.OF.MX 8998 && { echo "CumulusMX up" ; } || { `mail -r xxxx@hosiene.co.uk -s "[LAN monitor]: CumulusMX check" yyyy@hosiene.co.uk <<< 'CumulusMX is down'` ; }
'nc' is netcat. If you don't have it installed, use the following:

Code: Select all

sudo apt install netcat
Other package managers use different commands to install.
i came across this and i think i will use it but i put all my email in and the ip off cmx but im not getting the email when i stop cmx
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
freddie
Posts: 2433
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 22.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Custom Alarm Function

Post by freddie »

Do you have the "mail" program installed?
Freddie
Image
User avatar
dazza1223
Posts: 860
Joined: Sun 25 Jan 2015 8:41 pm
Weather Station: Davis Vantage Pro 2 plus
Operating System: Raspberry pi 4 (4gb)
Location: Worthing
Contact:

Re: Custom Alarm Function

Post by dazza1223 »

Yes I installed this

sudo apt install netcat
Have fun and keep learning

dazza :D

https://www.davisworthing.co.uk

Image
freddie
Posts: 2433
Joined: Wed 08 Jun 2011 11:19 am
Weather Station: Davis Vantage Pro 2 + Ecowitt
Operating System: GNU/Linux Ubuntu 22.04 LXC
Location: Alcaston, Shropshire, UK
Contact:

Re: Custom Alarm Function

Post by freddie »

That installs netcat (nc). I mean the mail program.

What does mail -V return?
Freddie
Image
Post Reply