Running linux shell command in scom via task or monitor

Hi, I want to run a linux systemctl status command in scom for a specific service. The monitor doesn’t work en when I make a task for that command the scx output for ‘systemctl’ alone is correct and for ‘systemctl status …’ is nothing.
What can be the problem? Running the same command on the linux server gave me the correct output.

Hi Luc

I don’t remember any specific problems here - I can build a Linux box and do some testing. Are you able to share what OS you are using and what version?

Cheers

Graham

Hi Graham,
It is a linux redhat 7.9.

Kind regards,
Luc.

As an update for everyone (and to see if anyone can finally resolve it for us).

  1. SystemCtl status firewalld works fine

  1. SystemCtl status <> - when xx has a . or - in it then the task returns - “No output available” - output is available when run directly on the Linux server.

I’ve tried:

  • Escaping with apostrophe and quotes
  • Running inside bash -c
  • Wrapping the XML inside CDATA tags

We could re-write as a script but that would be messy. Does someone know a way to get around parsing issues here?

Code as follows

     <Monitoring>

                                <Tasks>

                                                <Task ID="Example.Class.RHEL79.SystemCtlStatusFirewalld.Task" Accessibility="Public" Enabled="true" Target="Example.RHEL79.MyApp.Class" Timeout="120" Remotable="true">

                                                                <Category>Custom</Category>

                                                                <ProbeAction ID="PA" TypeID="MUL!Microsoft.Unix.WSMan.Invoke.ProbeAction">

                                                                <TargetSystem>$Target/Host/Property[Type="MUL!Microsoft.Unix.Computer"]/PrincipalName$</TargetSystem>

                                                                                <Uri>http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx</Uri>

                                                                                <Selector />

                                                                                <InvokeAction>ExecuteShellCommand</InvokeAction>

                                                                                <Input>&lt;p:ExecuteShellCommand_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem"&gt;&lt;p:command&gt;systemctl status firewalld&lt;/p:command&gt;&lt;p:timeout&gt;120&lt;/p:timeout&gt;&lt;/p:ExecuteShellCommand_INPUT&gt;</Input>

                                                                </ProbeAction>

                                                </Task>

                                </Tasks>

                </Monitoring>

                <LanguagePacks>

                                <LanguagePack ID="ENU" IsDefault="true">

                                                <DisplayStrings>

                                                                <DisplayString ElementID="Example.Class.RHEL79.SystemCtlStatusFirewalld.Task">

                                                                                <Name>SystemCtl Status Firewalld Task</Name>

                                                                </DisplayString>

                                                </DisplayStrings>

                                                <KnowledgeArticles></KnowledgeArticles>

                                </LanguagePack>

                </LanguagePacks>

Thanks