microsoft / SCXcore

System Center Cross Platform Provider for Operations Manager
Microsoft Public License
36 stars 31 forks source link

OS release version not updating #167

Closed gl2014 closed 3 years ago

gl2014 commented 3 years ago

Hello, our Redhat 7 (agent 1.6.2-343) and Redhat 8 (agent 1.6.6-0) correctly provide the OS release version when the agent is installed by the management server (SCOM2016) . When we update our system, the release version changes in /etc/redhat-release, but this is not updated in SCOM. The version I see when running 'winrm enumerate http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_OperatingSystem?__cimnamespace=root/scx' ... is also still the old one.

It seems the info provided by the agent comes from the file '/etc/opt/microsoft/scx/conf/scx-release', which doens't get updated even after a couple of weeks.

To solve the issue manually, I have to: execute '/opt/microsoft/scx/bin/tools/GetLinuxOS.sh' to update the 'scx-release' file (not sure it's the way to go) restart the 'omid.service' (At that point, up to date info is available using winrm) wait the next scheduled discovery on the management server.

Would it be possible that the agent updates this info automatically?

Best regards,

JumpingYang001 commented 3 years ago

@gl2014 try run /opt/microsoft/scx/bin/tools/GetLinuxOS.sh , it seems only be called while installation, not very sure.

gl2014 commented 3 years ago

Hello, Thanks for your reply. Sorry, copy/paste issue. In my solve description, it's indeed execute '/opt/microsoft/scx/bin/tools/GetLinuxOS.sh', I just corrected it in my comment. That script updates the scx-release file correctly, a restart of the service seems to be needed for the updated info to be taken into account. Would it be possible to be checked and updated automatically?

JumpingYang001 commented 3 years ago

@gl2014 I checked the code if /etc/opt/microsoft/scx/conf/scx-release doesn't exist and /opt/microsoft/scx/bin/tools/GetLinuxOS.sh, our code will run /opt/microsoft/scx/bin/tools/GetLinuxOS.sh.

every time below providers be queried above code will be triggered. SCX_UnixProcessStatisticalInformation_Class_Provider.cpp SCX_Agent_Class_Provider.cpp SCX_UnixProcess_Class_Provider.cpp

so needn't to restart omi, just queries will be trigger, but need to remove /etc/opt/microsoft/scx/conf/scx-release ... otherwise it will not be triggered.

gl2014 commented 3 years ago

Thanks, after deleting the release file, an updated version has been automatically created. So I just have to schedule a script to compare the scx-release with redhat-release and delete the scx-release if the version doens't match. That said, the value in the OperatingSystem provider seems not to be updated unless I restart the omi service. Did you mean running a query like '"winrm enumerate http://schemas.microsoft.com/wbem/wscim/1/cim-schema/2/SCX_UnixProcess?__cimnamespace=root/scx' would have been enough? I tried it but no change.

JumpingYang001 commented 3 years ago

@gl2014 I check the code, the updates of OS provider will only be refreshed when OS provider first time loaded in omiagent process: https://github.com/microsoft/SCXcore/blob/05401d35c9c45ad84de6eff7ebaf90e7e6615b40/source/code/providers/support/osprovider.cpp#L56 , and as I know if there is no any new query in 2~3 minutes, any provider will be unloaded.

I mean restart omi is way, another way is to wait 2 minutes without any new OS provider query, and the provider will be unloaded, after that you query OS provider again, it will update.

gl2014 commented 3 years ago

Hello, thanks for the feedback. I'll schedule check in SCOM comparing the info in scx-release and redhat-release, then if it differs delete the scx-release file and restart omi service

Klaas- commented 2 years ago

Hi, I don't think this is actually fixed, the OS reported in heartbeat won't change unless I delete /etc/opt/microsoft/scx/conf/scx-release and restart the agents

JumpingYang001 commented 2 years ago

@Klaas- if there is no this file /etc/opt/microsoft/scx/conf/disablereleasefileupdates, the scx-release will be updated when every time GetLinuxOS.sh is called. https://github.com/microsoft/pal/blob/master/source/code/scxsystemlib/common/GetLinuxOS.sh#L331

when restart the agents, new queries will come and GetLinuxOS.sh will be called.