question

RaviBhushan-3339 avatar image
1 Vote"
RaviBhushan-3339 asked CyrAz commented

Unix Linux Two state monitoring

Hi All,

I have created two monitor for scripts through Unix/Linux two state monitor. The output value set for the alert is 15000 and for the second is 11. If it goes above this it will generate an alert, but for the threshold defined 15000 it is throwing alert even if the output is 50 and similar is going with the second monitor. It is generating alert for the value less than 11 also. Below is the screen shot
59540-image.png


![59602-image.png][3]
59604-image.png


[3]: /answers/storage/attachments/59603-image.png


Please help me on this.

Regards,
Ravi Bhushan

msc-operations-manager
image.png (16.8 KiB)
image.png (7.2 KiB)
image.png (13.8 KiB)
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.

CyrAz avatar image
0 Votes"
CyrAz answered RaviBhushan-3339 commented

Chances are you are facing a very common issue when creating workflows in the console : the fields are typed as "Strings", not "Integers". Therefore greater/lower comparision are not working as expected.
Read here : https://argonsys.com/microsoft-cloud/library/using-integers-and-other-non-string-data-types-in-rules-and-monitors/

· 3
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.

Hi @CyrilAzoulay,

I have changed the value from strings to Integers but now it is not throwing any alert. Even for much higher value the status is showing healthy but it should have raised a critical alert.

Regards,
Ravi

0 Votes 0 ·
CyrAz avatar image CyrAz RaviBhushan-3339 ·

Then maybe there is a different issue in the code. Can you post the full XML code ?

0 Votes 0 ·

60381-web.xml




I have attached the xml file.
I am getting issue with monitor error log monitoring and load monitoring. These are newly created.

Regards,
Ravi

0 Votes 0 ·
web.xml (1.5 MiB)
CyrAz avatar image
0 Votes"
CyrAz answered CyrAz edited

I had a quick look at the XML and it seems to be OK, however I also just noticed in the screenshot in your first post that StdOut contains at least two lines : a number and then a "last login" date.
So that's not an integer, and if you have a look at the Operations Manager event log in your SCOM Management Servers you'll probably find errors about the workflow failing to convert data to integer type or something like that.

From there you have two options :
- Modify the .sh scripts so they will output an integer ONLY.
- Modify the SCOM workflow to include a powershell parsing of stdout. In that case I would recommend using the Unix authoring library :
https://social.technet.microsoft.com/wiki/contents/articles/18084.scom-2012-unixlinux-monitoring-with-scripts.aspx#Handling_complex_shell_command_script_output_with_PowerShell_scripts

· 2
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.

The output was from the task which we created for the testing purpose. The original value for this is an integer value. Attached is the output of the executed script.

60677-image.png


0 Votes 0 ·
image.png (12.6 KiB)
CyrAz avatar image CyrAz RaviBhushan-3339 ·

When the agent runs a command, it runs it using the following syntax :

/bin/sh -c "command"

That may produce a different output than the one you're getting when running bash script.sh, so could you try running precisely the following command :

/bin/sh -c "/opt/MastekAutomation/KongErrorCount.sh"


0 Votes 0 ·
CyrAz avatar image
0 Votes"
CyrAz answered CyrAz commented

Also please try running it using the scom agent account, not yours; and even better try running it as a network job using ssh as this will reflect more closely the agent actual behavior :

ssh scomuser@localhost '/bin/sh -c "/opt/MastekAutomation/KongErrorCount.sh"'


· 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.

We tried with the same but still getting the same issue. In SCOM console it is giving
the output is a string "54/nLast login: (...):

0 Votes 0 ·
CyrAz avatar image CyrAz RaviBhushan-5427 ·

I'm not following, you said previously you were sure the output was an integer. If it's a string, you obviously can't make a numerical comparison

0 Votes 0 ·

The Output on unix machine is giving integer value. But on SCOM console it is giving the output as a string "54/nLast login.
70287-image.png


0 Votes 0 ·
image.png (19.9 KiB)
Show more comments