Sometime it's important to know to know a particular process uptime, in seconds (days, minutes, etc..)
Then value can be compared with the threshold time values set in process Threshold Profile for settings a status and/or executing IT automation task.
The logic example
- If process runs longer than 10 hours then set status Trouble and execute and optional automation taks (e.g. kill the process)
Time can be easily calculated from the ps STIME column - for example:
# ps -ef | grep postgres | awk '{print$5}' | xargs -I{} date --date='{}' +"%s"
1605312000
1605551580
1605551580
1605398400
1605398400
1605398400
1605398400
1605312000
1605312000
1605312000
1605312000
1605312000
1605559380