src/modules/systemd/systemd.c
/*
 * systemd_service_state_code returns the status code for the given systemd
 * service ActiveState property value or -1 if unknown.
 */
systemd_service_state_code returns the status code for the given systemd
service ActiveState property value or -1 if unknown.
systemd_service_state_code returns the status code for the given systemd service ActiveState property value or - 1 if unknown .
int systemd_service_state_code(const char *state)
{
  const int codes[] = { 0, 2, 5, 6, 8 };
  const char *states[] = {
    "active", "activating", "deactivating", "inactive", "failed",
    NULL
  };
  if (NULL == state)
    return -1;
  for(int i = 0; states[i]; i++)
    if (0 == strncmp(state, states[i], 13))
      return codes[i];
  return -1;
}
int systemd_service_state_code ( const char * state ) { const int codes [ ] = { 0 , 2 , 5 , 6 , 8 } ; const char * states [ ] = { " " , " " , " " , " " , " " , NULL } ; if ( NULL == state ) return -1 ; for ( int i = 0 ; states [ i ] ; i ++ ) if ( 0 == strncmp ( state , states [ i ] , 13 ) ) return codes [ i ] ; return -1 ; }
systemd_service_state_code returns the status code for the given systemd
 service ActiveState property value or -1 if unknown.
systemd_service_state_code returns the status code for the given systemd service ActiveState property value or - 1 if unknown .
// Map systemd ActiveStates to status codes // Code definitions aim to roughly balance LSB initscript codes and the Zabbix // agent for Windows service status codes. // https://www.zabbix.com/documentation/3.2/manual/config/items/itemtypes/zabbix_agent/win_keys