Contributed by: Thejaswini Kodavur
Have you ever wondered if there was a single service that monitors all your other services and makes administration easier? If yes then “SMF goal services”, a new feature of Oracle Solaris 11.4, is here to provide a single, unambiguous, and well-defined point where one can consider the system up and running. You can choose your customized, mission critical services and link them together into a single SMF service in one step. This SMF service is called a goal service. It can be used to monitor the health of your system upon booting up. This makes administration much easier as monitoring each of the services individually is no longer required!
There are two ways in which you can make your services part of a goal service.
By default Oracle Solaris 11.4 system provides you a goal service called “svc:/milestone/goals:default”. This goal service has a dependency on the service “svc:/milestone/multi-user-server:default” by default.
You can set your mission critical service to the default goal service as below:
# svcadm goals system/my-critical-service-1:default
Note: This is a set/clear interface. Therefore the above command will clear the dependency from “svc:/milestone/multi-user-server:default”.
In order to set the dependency on both the services use:
# svcadm goals svc:/milestone/multi-user-server:default \
system/my-critical-service-1:default
Oracle Solaris 11.4 allows you to create your own goal service and set your mission critical services as dependent services. Follow the below steps to create and use a goal service.
# svcbundle -o new-gs.xml -s service-name=milestone/new-gs -s start-method=":true"
# cp new-gs.xml /lib/svc/manifest/site/new-gs.xml
# svccfg validate /lib/svc/manifest/site/new-gs.xml
# svcadm restart svc:/system/manifest-import
# svcs new-gs
STATE STIME FMRI
online 6:03:36 svc:/milestone/new-gs:default
# svcadm disable svc:/milestone/new-gs:default
# svccfg -s svc:/milestone/new-gs:default setprop general/goal-service=true
# svcadm enable svc:/milestone/new-gs:default
# svcadm goals -g svc:/milestone/new-gs:default system/critical-service-1:default \
system/critical-service-2:default
Note: By omitting the -g option without specifying a goal service, you will set the dependency to the system provided default goal service, i.e svc:/milestone/multi-user-server:default.
# svcs -d milestone/new-gs
STATE STIME FMRI
disabled 5:54:31 svc:/system/critical-service-2:default
online Feb_19 svc:/system/critical-service-1:default
# svcs milestone/new-gs
STATE STIME FMRI
maintenance 5:54:30 svc:/milestone/new-gs:default
Note: You can use -d option of svcs(1) to check the dependencies on your goal service.
# svcs -d milestone/new-gs
STATE STIME FMRI
online Feb_19 svc:/system/critical-service-1:default
online 5:56:39 svc:/system/critical-service-2:default
# svcs milestone/new-gs
STATE STIME FMRI
online 5:56:39 svc:/milestone/new-gs:default
Note: For more information refer to "Goal Services" in smf(7) and subcommand goal in svcadm(8).
The goal service “milestone/new-gs” is your new single SMF service with which you can monitor all of your other mission critical services!
Thus, Goals Service acts as the headquarters that monitors the rest of your services.