zabbix-module-systemd icon indicating copy to clipboard operation
zabbix-module-systemd copied to clipboard

Not supported item when Service is on inactive state.

Open rubenbperez opened this issue 7 years ago • 3 comments

Hi, I have a little issue when a system is in inactive state, the module gives me back a ZBX_NOTSUPPORTED: Failed to lookup object path:

1707:20180420:150015.966 In update_cpustats() 1707:20180420:150015.966 End of update_cpustats() 1707:20180420:150015.967 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]' 1707:20180420:150016.967 __zbx_zbx_setproctitle() title:'collector [processing data]' 1707:20180420:150016.967 In update_cpustats() 1707:20180420:150016.967 End of update_cpustats() 1707:20180420:150016.967 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]' 1708:20180420:150016.968 __zbx_zbx_setproctitle() title:'listener #1 [processing request]' 1708:20180420:150016.968 Requested [systemd.service.info[elasticsearchcurator,state]] 1708:20180420:150016.968 [systemd] org.freedesktop.systemd1.NoSuchUnit: Unit elasticsearchcurator.service not loaded. 1708:20180420:150016.968 Sending back [ZBX_NOTSUPPORTED: Failed to lookup object path] 1708:20180420:150016.968 __zbx_zbx_setproctitle() title:'listener #1 [waiting for connection]' 1707:20180420:150017.967 __zbx_zbx_setproctitle() title:'collector [processing data]' 1707:20180420:150017.967 In update_cpustats() 1707:20180420:150017.967 End of update_cpustats() 1707:20180420:150017.967 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]' 1707:20180420:150018.967 __zbx_zbx_setproctitle() title:'collector [processing data]' 1707:20180420:150018.968 In update_cpustats() 1707:20180420:150018.968 End of update_cpustats() 1707:20180420:150018.968 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]' 1707:20180420:150019.968 __zbx_zbx_setproctitle() title:'collector [processing data]' 1707:20180420:150019.968 In update_cpustats() 1707:20180420:150019.968 End of update_cpustats() 1707:20180420:150019.968 __zbx_zbx_setproctitle() title:'collector [idle 1 sec]' 1707:20180420:150020.968 __zbx_zbx_setproctitle() title:'collector [processing data]' 1707:20180420:150020.968 In update_cpustats() 1707:20180420:150020.968 End of update_cpustats()

Any idea?

Thank you.

rubenbperez avatar Apr 20 '18 17:04 rubenbperez

It might be related to this issue: https://github.com/systemd/systemd/issues/3807. In this case, an inactive service is actually unloaded.

From the output above, it appears the systemd API is claiming there is no elasticsearchcurator.service service unit. The module is simply reporting this.

What result do you see for $ systemctl status elasticsearchcurator.service when the service is inactive?

cavaliercoder avatar Apr 20 '18 18:04 cavaliercoder

Thanks for you fast answer.

This also happens to system services in Ubuntu 16.04.

$ systemctl show elasticsearchcurator.service | grep State
LoadState=loaded
ActiveState=inactive
SubState=dead
UnitFileState=disabled
StateChangeTimestampMonotonic=0
$ systemctl status elasticsearchcurator.service 
● elasticsearchcurator.service - ElasticSearchCurator. Cure it all.
   Loaded: loaded (/etc/systemd/system/elasticsearchcurator.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

rubenbperez avatar Apr 20 '18 18:04 rubenbperez

Finally I used this solution: https://github.com/systemd/systemd/issues/1929

Doc: https://dbus.freedesktop.org/doc/api/html/group__DBusPendingCall.html#ga5a738928c2369fef093ce00658903d06

I hope for non side-effects for the change (I didn't read full code).

EDIT:

There's a little problem. With the above change, it always gives back an object path which means every string is a service (this makes systemd_unit_is_service function to always return true). To Solve this problem I made a double check: When ActiveState is checked I also check for LoadState which may give me the existance of the service. After checking this, I created a new Code (255) to show No Such Service.

rubenbperez avatar Apr 22 '18 19:04 rubenbperez