Monitoring Linux Processes (their status, resource usage, etc ) via SSH?
Hello,
Is there anything already developed that allows the monitoring of Linux Processes via SSH. I know it's possible via SNMP (however, if possible we would like to avoid configuring SNMP individually per server).
Yesterday I was searching in the Exchange module &* found the 'Linux_SSH_ServiceStatus' but it doesn't work & doesn't seem to capture processes resource usage.
Does anyone had this need in the past?
I'm not that into Linux therefore, I'm not sure how to/if it's possible to have a datasource for this.
Thank you!
Regards,
Vitor_Santos
11 comments
John_Lockie
Austin, could not agree more! We have a scheduler platform that relies on processes running on remote systems in order to be able to execute. They're not even registered as services (in Linux). And if the process fails the job fails. We would prefer to know if a job will fail before it runs, so monitoring the process is (so far) the best solution we can come up with.
On another note: I really wish LogicMonitor would support webhooks....
John_Lockie
Very cool - thank you all so much! We are building this out now :)/emoticons/smile@2x.png 2x" title=":)" width="20" /> will try to post back our solution.
LM User
Really like this mechanism!
AustinC
I can't figure out how to edit my post, so here's some additional guidance for how these work (which probably means it's already overly-complicated :)/emoticons/smile@2x.png 2x" title=":)" width="20" /> BUT, we have been entirely hands off with this ever since I wrote this 2 years ago, outside of adding a process here and there, so it works!
How it Works
Active Discovery runs every 15 minutes and queries each device for all of its running processes.
The script pulls down the
process.groupProcessesToMonitorandprocess.deviceProcessesToMonitor, and combines them with theuniversalProcessesto get a comprehensive list of processes for which to check devices.The script indexes each running process by the configured regex, while also capturing the PIDs associated with all of the processes that are running
The script then combines the
hrSWRunPathwith thehrSWRunParametersto get the full process run stringThe script then runs through each discovered process and uses a simple
=~to validate if any given process matches a process that is running on the device.All discovered processes have a property associated with them that includes the PID in the property key, along with the run path of all matched processes.
PIDs which match the corresponding RegEx are added together, so that we can detect when a process restarts. This can be overridden by adding the exact same process regex to the 'process.universalProcessesRestartToIgnore' property
LM User
Sorry, here's the original if you want to compare to @Austin Culbertson's.
Discovery Script:
Collection Script:
I have these discovery filters setup to make it easy to pick and choose which processes are monitored based on properties set on the group/resource:
I also group by user because that's often helpful:
AustinC
Looks like I was further along than I expected :)/emoticons/smile@2x.png 2x" title=":)" width="20" />
I've published both an SSH and an SNMP version:
Locator Code: 9YLFYE - LinuxRegexProcessMonitoring_withAD_SSH
Locator Code: JDCMLM - LinuxRegexProcessMonitoring_withAD_SNMP
Let me know if you have any problems locating these. These are the first datasources I've published, so I'm not sure the best way to facilitate it.
AustinC
I have got a better solution for Linux process monitoring that I've been meaning to upload to the exchange (both SNMP and SSH). It gets a little over-bearing using Regular Expressions, but we've used it to great effect after we migrated into LogicMonitor. I have to do a bunch of cleanup for it to anonymize it and make it clear how to use it, but I'll see if I can finish it up this week. It was developed with multi-instance Active Discovery in mind, because adding instances manually is a huge no-no to me ?
That being said, my personal belief is that process monitoring is wholly insufficient for monitoring the state of your hosts and processes (good for collecting metrics, though). I would encourage folks to investigate how they can introspect the health of their process/services via whatever means available when possible (Think: performing a DB query instead of monitoring for MySQL/Postgres; Running `service <name> status` commands instead of simply checking if the process is running, etc). This takes a little more work, but is ABSOLUTELY worth the time investment.
I'll update this thread when I think I've got this uploaded.
John_Lockie
That link is dead....updated link maybe? Sorry to resurrect and old thread.
Vitor_Santos
OPHey Stuart,
I've deployed & it works just fine!
Thanks a lot for the sharing.
Vitor_Santos
OPThanks for the sharing Stuart.
I'll deploy that in our environment & further advise ?
LM User
https://github.com/sweenig/lmcommunity/tree/master/ProcessMonitoring/Linux_SSH_Processes_Select