Hi,
So as the title says I am looking for a way to detect if a .exe (game server) or serice stops running. Ideally i'd like to make it so as soon as the app or service crashes it then triggers a node red flow but Im pretty sure that the app in question needs to send out the "I crashed signal" so that everything can process it (which these apps can't do). What would be the best way on Windows (primarily) and Ubuntu server to do this
You could use an exec node that runs a system command to test whether there is an appropriately named process running and test the result of that.
On linux you could us the ps
command with appropriate parameters.
A cross-platform tool for observability is Telegraf. From the same people who make InfluxDB. While Telegraf works pretty seamlessly with InfluxDB (which I recommend for historic data anyway), you can also configure it to output to other endpoints. MQTT is ideal for use with Node-RED and I use this on my home automation server.
For Windows servers, you could also look at nodes that work with WMI.
So far in my testing I have been using powershell ps
in an exec node and taking the error code into a switch which works pretty well, I was curious if there was a better way
Thanks for the info, I have tried using mosquitto but couldnt find a good setup guide that went from the start (espically for ubuntu server) and I was advised (On the Node Red slack) to go with websockets for simplicity (which they are easier), I just am not sure how to do it securely.
As for WMI I have no idea how I can use that as it seems like an enterprise style setup and im only doing this for a home setup
Clearly not relevant so deleted.
I just started the flow and this is what it looks like, I don't know if there is a way to delay start as there is no input to turn it on
I don't get time to peruse the Slack channel I'm afraid and I don't know why someone advised that. The basic install of Mosquitto is pretty trivial.
Setup for security is only really needed if your traffic is happening outside a single device. If both are running on the same device, you don't need to really worry about it. As you get to that point though, you will need a certificate which realistically means that you need a registered domain.
Any network traffic outside a single device should be encrypted for safety anyway though you might choose to ignore that on your home network if you are happy with the risk. You could use something like Tailscale to create your own virtual network with encrypted channels if you really can't get a certificate. Then you can treat that network as a local one.
WMI is generally for enterprises but it is just the Windows Management interface and is designed for managing devices and services both locally and remotely. Personally though, I'd go with Telegraf as that is relatively easy to learn and you can get your outputs in various ways.
Whichever way you look at it though, having Windows in the mix does make things a fair bit more complex. Linux is much easier to handle as a server.
I think that the thing you need to recognise is that observability requires you to understand a reasonable amount about how servers work and to learn some additional tooling. This may take some time but once done, is done and everything should just work.
In the near future possibly needing to have 2 node instances communicate across the web, as for a domain registration that is fine as I already have one I use for game servers
I think that if you need the Internet involved, you should look at Tailscale as an option. It is designed for this kind of thing I think. I've not used it myself but there are other forum members who have. Indeed, one is writing a setup guide that I'm desperately trying to find time to review.
If you can send me the link to it I may give it a go (when I have spare time) and give it a review/feedback at the end
Hi
You asked:
So as the title says I am looking for a way to detect if a .exe (game server) or serice stops running. Ideally i'd like to make it so as soon as the app or service crashes it then triggers a node red flow but Im pretty sure that the app in question needs to send out the "I crashed signal" so that everything can process it (which these apps can't do). What would be the best way on Windows (primarily) and Ubuntu server to do this
I use already for years "monit".
See: Easy, proactive monitoring of processes, programs, files, directories, filesystems and hosts | Monit and also Bitbucket
Do not mix it with M/Monit, as this is a commercial implementation of Monit
Monit has its own webserver running on port 2812.
This will give you an overview of all processes running.
Monit has also a simple API, which you can use with Node-RED.
However, it is poorly documented.
See: http://Server IP address:2812/_status?format=xml
Username: "admin' and password "monit"
[
{
"id": "0df294bbd75afd6a",
"type": "inject",
"z": "8087615b120096e1",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 740,
"y": 220,
"wires": [
[
"8bb024ee56977530"
]
]
},
{
"id": "8bb024ee56977530",
"type": "http request",
"z": "8087615b120096e1",
"name": "",
"method": "GET",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://192.168.10.50:2812/_status?format=xml",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "basic",
"senderr": false,
"headers": [],
"x": 930,
"y": 220,
"wires": [
[
"6f7f615db989d5f4"
]
]
},
{
"id": "2c06f45a448fec6e",
"type": "debug",
"z": "8087615b120096e1",
"name": "debug 300",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1290,
"y": 220,
"wires": []
},
{
"id": "6f7f615db989d5f4",
"type": "xml",
"z": "8087615b120096e1",
"name": "",
"property": "payload",
"attr": "",
"chr": "",
"x": 1110,
"y": 220,
"wires": [
[
"2c06f45a448fec6e"
]
]
}
]
This is however only for Unix/linux systems
Regards
Thanks for that idea, I was hoping for an entierly Node red approach (with the possibility of the function node) too
Just because you have a hammer, not everything becomes a nail.