question

madhavigunasekar-4707 avatar image
0 Votes"
madhavigunasekar-4707 asked LeonLaude commented

SCOM linux script to kill process


Hi All

Am trying to Kill Linux process , if the process exceeds CPU threshold.

Below command works in Linux server. But when we add under Linux script in SCOM , it throws error. Please help

Killall -9 <<Processname>>

msc-operations-manager
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

LeonLaude avatar image
0 Votes"
LeonLaude answered

Hi @madhavigunasekar-4707,

There are many guides out there that explains how to accomplish this, I have prepared a few links for you that I think will help you out:

(Don't pay too much attention to the versions)


(If the reply was helpful please don't forget to upvote or accept as answer, thank you)


Best regards,
Leon

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

madhavigunasekar-4707 avatar image
0 Votes"
madhavigunasekar-4707 answered LeonLaude commented

Thanks , I have used Shell commands which works.

But this software runs only on weekends and its not installed on server. So i have tried to use Perl script below,

kill -9 ps -ef | grep '<<ProcessName>>' | grep -v grep | awk '{print $2}'

I get error when this recovery script runs,

kill: (<<PID>>) - Operation not permitted

Same command works when i run from server.

· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This error occurs when the user doesn’t have the permissions required to perform a command, make sure your Linux monitoring/action account has sufficient permissions.
You can try running the command with sudo.

0 Votes 0 ·

I have already tried with sudo , bit i get error
/etc/opt/microsoft/scx/conf/tmpdir/scxLNXTMi: line 1: Sudo: command not found

0 Votes 0 ·
LeonLaude avatar image LeonLaude madhavigunasekar-4707 ·

Depending on what Linux distribution you are running, the sudo might not be installed.

First enable su-mode:

 su -

Install sudo by running:

 apt-get install sudo -y


0 Votes 0 ·
Show more comments