Writing new protocols using Javascript or Lua ?

Issue #902 new
Massimo Sala created an issue

I wrote a few new protocols (mssql, pgsql, socks5, vnc, x11) I donated freely to Tildeslash.

It is fun but is also a little time consuming.

And there are so many network protocols!

What about the idea to add to Monit a scripting engine, so the users (system admins) can write new protocols as scripts?

For example, a new “fake” protocol Javascript:

host … tcp port … protocol Javascript filename memcache.js

Monit doesn’t know the protocol memcache : it loads the file and executes the script.

For Javascript, there are many javascript libraries. At the moment IMHO the top ones are (ordered by name):

Lua ... there is only Lua, there are few competent people, compared to those who know Javascript.

And talking to other users, it seems the Lua' project follows the "cathedral" style, style exposed in the book

https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar

IMHO it isn’t a good design, in the long run.

However I am open to talk about pros and cons of Javascript vs Lua as scripting facilities.

If the matter will interest me, I can - freely - develop this new “protocol” and public release the source code to Tildeslash.

Massimo

Comments (1)

  1. Henning Bopp

    I really like this idea.

    The question regarding the language is indeed hard to answer. I use JS for close to 20 years now on a daily basis but would not recommend it for monit. It's kind of bloated, the current eco-system is even more bloated and essentially not targeted to the user group monit is targeting. Also the non-blocking event loop JS uses does - from my pov - not match needs here.

    I would therefore go in for lua. It's already there in many daemons (like nginx [openResty], MySQL, PostgreSQL, RSpamd and others) and seems to run just fine there. And to me it is more appealing to new users.

    I agree that the cathedral approach will never get me excited, but the way it is developed and extended (good amount of plugins, active mailing list, etc.) suits monits needs far better. Fore sure there are more node-modules, but I'm not starting the quantity-over-quality discussion here... ;)

    Just one more thing: I do not really think that there are this much competent people around with JS when it comes to TCP handshakes, RFC compliance and other low-level skills!

    If this gets implemented, it would also be awesome if those scripts could be used with "check program". Could be a real help reducing hacky bash scripts. ;)

  2. Log in to comment