서비스 확인

imRAD 서비스(데몬) 상태를 확인하려면 user mode에서 show service를 실행하세요.

LYSH@MyHostName# show service
name            status      version         enablement  runtime-log   uptime
dhcpv4          active      6.1.2059.137    linked      enabled       since Thu 2021-04-08 16:11:35 KST; 1 weeks 4 days ago
dhcpv6          active      6.1.2059.137    linked      enabled       since Mon 2021-04-05 14:55:22 KST; 2 weeks 1 days ago
failover        inactive    6.1.1939.49     linked      enabled       -
logexp          active      1.1.2043.208    linked      enabled       since Mon 2021-03-29 09:21:54 KST; 3 weeks 1 days ago
radiusd         active      3.0.21.1751     linked      enabled       since Tue 2021-04-13 14:53:06 KST; 1 weeks 0 days ago
smgr            active      6.0.2060.1      linked      enabled       since Tue 2021-03-23 16:01:00 KST; 3 weeks 6 days ago
startup         active      1.1.1955.1      enabled     enabled       since Mon 2021-02-01 08:07:05 KST; 2 months 17 days ago

"status"는 서비스의 상태를 나타내며 active, reloading, inactive, failed, activating, 또는 deactivating 중 하나로 표시됩니다. 현재 서비스가 실행 중이면 "active"로 표시되며 정상적으로 중지된 경우 "Inactive"로 표시됩니다. 만일 서비스가 비정상적으로 종료되면 "failed"로 표시됩니다.[1]

"enablement"는 서비스가 자동시작(enabled) 혹은 수동시작(linked)인지를 의미합니다.[1] 자동시작은 장비가 재부팅 이후 서비스가 자동으로 시작된다는 의미입니다.

서비스가 운영중인 상태에서 자신의 동작에 대해 로그를 기록 할 수 있는데 그 로그를 "Runtime Log"라 합니다. 이러한 로그는 "사용함"으로 설정되어야만 기록되는데 그 상태를 "runtime-log"에서 표시합니다. "Runtime Log"에 대한 자세한 사항은 아래 세션을 참고하세요.

"uptime"은 서비스가 얼마나 오래동안 동작 중인지 혹은 비정상 종료된 경우 언제 서비스가 중지되었는지를 표시합니다.

systemctl status {name} 또는 show service status {name} 명령어를 실행하면 특정 서비스에 대해 자세한 상태 정보를 출력 할 수 있습니다.

LYSH@MyHostName# systemctl status smgr
● smgr.service - System Management service
     Loaded: loaded (/lib/systemd/system/smgr.service; linked; vendor preset: enabled)
     Active: active (running) since Tue 2021-03-23 16:01:00 KST; 3 weeks 6 days ago
   Main PID: 203770 (ly_smgr)
      Tasks: 1 (limit: 9387)
     Memory: 28.9M
     CGroup: /system.slice/smgr.service
             └─203770 /usr/bin/php7.2 /usr/sbin/ly_smgr sys

서비스 이름을 제외하고 show service status 명령어를 실행하면 모든 실행 중인 서비스의 상태를 확인 할 수 있습니다.

LYSH@MyHostName# show service status
● MyHostName
   State: degraded
    Jobs: 0 queued
  Failed: 1 units
   Since: Mon 2021-02-01 08:07:01 KST; 2 months 24 days ago
  CGroup: /
          ├─1282556 bpfilter_umh
          ├─user.slice
          │ └─user-1000.slice
          │   ├─user@1000.service …
          │   │ └─init.scope
          │   │   ├─3743524 /lib/systemd/systemd --user
          │   │   └─3743526 (sd-pam)
          ├─init.scope
          │ └─1 /sbin/init
          └─system.slice
            ├─irqbalance.service
            │ └─777 /usr/sbin/irqbalance --foreground
            ├─dhcpv4.service
            │ └─3865233 /usr/sbin/ly_dhcpv4 --daemon --ipv4
            ├─apache2.service
             .....................


서비스 제어

시작, 중지, 재시작

user mode에서 systemctl 명령어를 이용해 서비스를 제어 할 수 있으며 제어가 가능한 서비스 목록은 다음과 같습니다. 각 서비스에 대한 설명은 imRAD services를 참고하세요.

  • smgr
  • dhcpv4
  • dhcpv6
  • failover
  • startup
  • logexp
  • radiusd
  • mysql
  • apache2
  • rsyslog
LYSH@MyHostName# systemctl start smgr		// Starting the smgr service.
LYSH@MyHostName# show service			// display all services

LYSH@MyHostName# systemctl stop smgr		// Stopping the smgr service.
LYSH@MyHostName# show service			// display all services

LYSH@MyHostName# systemctl restart smgr		// Restarting the smgr service.
LYSH@MyHostName# show service			// display all services
Enable and Link

systemctl enable 또는 systemctl link 명령어를 이용해 서비스 시작 상태를 자동 혹은 수동으로 변경 할 수 있습니다.

LYSH@MyHostName# systemctl enable failover
name            status      version         enablement  runtime-log   uptime
.....
failover        inactive    6.1.1939.49     enabled      enabled       -
.....

LYSH@MyHostName# systemctl link failover
LYSH@MyHostName# show service
name            status      version         enablement  runtime-log   uptime
.....
failover        inactive    6.1.1939.49     linked      enabled       -
.....

주의: smgr, mysql, 그리고 apache2 서비스는 필수 서비스 이므로 수동(link)로 설정하지마세요.

제품 초기에 설정된 기본 값은 다음과 같습니다.

  • linked: dhcpv4, dhcpv6, failover, logexp, and radiusd
  • enabled: smgr, startup, mysql, and apache2


Runtime Data

특정 서비스는 시작시 데이터베이스 또는 설정으로 부터 데이터를 로딩 후 서비스를 운영하며 서비스 동작중에 데이터베이스나 설정이 변경되면 수초내에 서비스에 바로 적용되는데 이러한 데이터를 "런타임 데이터"라고 합니다. 서비스가 정상적으로 운영중이라면 런타임 데이터는 관리인터페이스에 표시된 내용과 동일하게 표시되어야 합니다. 예로, 관리 인터페이스를 통해 하나의 DHCP 범위를 추가하면 수초내에 "런타임 데이터"에서도 동일한 범위가 나타나야합니다. 만일 시간이 지나도 데이터가 동기화되지 않으면 서비스를 재시작 해야합니다.

이러한 데이터를 표시하려면 show service {service name} {data type} 명령어를 사용해 확인 할 수 있습니다.

LYSH@MyHostName# show service dhcpv4 pool
DHCP-Scope> written at 2021-04-20 16:10:09 (KST, +0900)
--------------------------------------------------------------------------------------------------------
ssid    ipver   stateful        ptn         T(preferred)    T(valid)
sid     ena     gateway                                     start ip                  count     IA
--------------------------------------------------------------------------------------------------------
119     4       -               0           10m             6h
#250    y       192.168.5.1/24                              192.168.5.200             20        0x01

만일 런타임 데이터를 확인 할 서비스가 동작중이 아니면 show service {service name} {data type} 명령어는 아래와 같은 오류를 표시합니다.

LYSH@MyHostName# show service dhcpv4 pool
sending request> message[0], ipver[4]
[E-11] No response from service...

imRAD 서비스중 dhcpv4, dhcpv6, 그리고 failover service만 런타임 데이터를 제공합니다.

dhcpv4/dhcpv6
argument 설명
failover DHCP Failover 상태를 표시합니다.
host Displays all IP addresses in all DHCP Pools. You can get only filtered results by specifying keywords.
  • status:
    • avail: Available IP address that can be assigned to another host.
    • decl: Declined IP address that is not assigned to another host during the "dhcpv4_decline_age" or "dhcpv6_decline_age".
    • bound: The IP address is in use.
    • offer: It is shown as "advert"(i.e. advertisement) in the DHCPv6, the IP address was offered to a host but not completed the DHCP operation.
    • invalid: The IP address is out of the DHCP pool.
  • flag: If the IP address is reserved for a host, the flag has 0x2. If the IP is excluded, it has 0x4. For example, If the flag is 0x6, the IP address is both in reserve and exclude. If a flag has 0x1, it means that the IP address is out of the pool.
  • age: It is the time that was elapsed from the latest allocation. If the status is "bound", the age is increased. if a host sends a renew to expand its lease time, the age is set to 0.

If the age is greater than or equal to the Lease Time of its DHCP Pool, the status of the IP address is changed to "avail". In other words, the Lease of the IP address expires.

  • oage: If an IP address was offered to a host and the status of the IP address remains as "offer" or "advert" for 30 seconds, the status of the IP address is changed to "avail". In other words, If a host does not complete the DHCP operation, the offered IP address to the host can be assigned to another.
  • hit-date: It is the latest response Datetime to a host.

You can also find some terms in the IP Address list section.

option It show all DHCP options.
reserv It show all reserved IP address. You can get only filtered results by specifying keywords.
setting It shows information that was loaded from the service configuration setting.
logexp
argument Description
server It shows the result of exporting logs.
setting It shows the variables generated by the failover service.
table It shows the result of exporting each log table.

Runtime Log

The Runtime Log is the logs that were generated in real-time during the runtime of a service. You can enable the Runtime log of service for the purpose of analyzing or feedback.

LYSH@MyHostName# configure
configure# rtlog enable {service_name}
configure# exit
LYSH@MyHostName# show log {service_name} -w

If you enable the Runtime Log of services, you can watch the logs by the show log command. For more options to show logs, please refer to the CLI - Log section

LYSH@MyHostName# show log dhcpv4

The Runtime log configuration for both "smgr", "startup", and "radiusd" service is already enabled. Remark that you cannot disable the Runtime log for the "radiusd" service.

Note that you should disable it after doing your job because the service may generate a log of Runtime Logs.

Configuring the Service Setting

You can configure the variables of the DHCP and logexp Service in the configuration mode. If you want to see the current values, enter the show system command.

dhcpv4 / dhcpv6
LYSH@MyHostName# configure 
configure# dhcpv4 {argument} {value}	// configuring a variable of the dhcpv4 service
configure# dhcpv6 {argument} {value}	// configuring a variable of the dhcpv4 service
argument variable Description
dbpool dhcpvN_dbpool configuring the number of database pools.
decline dhcpvN_decline_age configuring the time in seconds to change the status from "decl" to "avail" of the declined IP addresses.
entid entid_from_hostname Whether to read the enterprise number from the hostname or not.
expire dhcpvN_expire_check_intv configuring the interval in seconds to check the lease expiration.
postdhcp postdhcp_success Whether to record all results or not(default).
rcvbuf dhcpvN_socket_rcvbuf configuring the receiving buffer size of the socket.
sndbuf dhcpvN_socket_sndbuf configuring the sending buffer size of the socket.
encoding from_encoding It is used to convert hostnames that have multibyte characters to utf8. Only dhcpv4 service refers to this variable.

Note that If there are multiple clients that have set their hostname including multibyte characters, and they use operating systems with different characters set each other, only the hostnames encoded to the "from_encoding" may be converted to utf8.

logexp
LYSH@MyHostName# configure 
configure# logexp {argument} {value}	// configuring a variable of the logexp service
argument variable Description
dbpool logexp_dbpool configuring the number of database pools.
lsyslog lsyslog_priority configuring the highest syslog priority to read.
syslog syslog_priority configuring the highest syslog priority to read.

Note that you should read what the variable means before configuring a variable.

References