(originally published on 29.03.2019, reviewed/rewritten on 29.03.2025, tested on Oracle Solaris 11.4 SRU 79)
Yesterday I demonstrated goal services to you with the build-in goal services. But perhaps you have multiple important applications running on your system and you want to monitor them independently. How can you do that? Well, it’s simple: Create your own goal service!
It starts with the creation of a plain and simple SMF service. The easiest way to do so is using svcbundle
.
root@testbed:~# LANG=C svcbundle -i -s service-name=milestone/myfirstgoalservice -s start-method=":true"
Waiting for milestone/myfirstgoalservice to reach online state.
It is safe to interrupt.
A goal server doesn’t start applications. So can simply use :true
as a start method. Right after executing the comand, you should see a running SMF service.
root@testbed:~# svcs milestone/myfirstgoalservice
STATE STIME FMRI
online 2025-03-29T03:45:27 svc:/milestone/myfirstgoalservice:default
However this service isn’t a goal service at the moment. Just a service that does nothing useful. To make it a goal service you have to set general/goal-service
to true
as well.
root@testbed:~# svcadm disable milestone/myfirstgoalservice
root@testbed:~# svccfg -s svc:/milestone/myfirstgoalservice:default setprop general/goal-service=true
root@testbed:~# svcadm enable milestone/myfirstgoalservice
Now you can use the newly minted goal service. Like with the default goal service you can use the goals
subcommand. However, you have to specify the goal service you want to configure. Otherwise it would modify the default service. You can specify the goal service with -g
.
Okay, I’m a little bit lazy. I will just use sendmail
and apache24
in my goal service. Thus both goal services will monitor the same services. Of course you could chose other services.
root@testbed:~# svcadm goals -g svc:/milestone/myfirstgoalservice:default apache24 sendmail
Now we check the the goal service functionality by disabling one of the monitored services.
root@testbed:~# svcs svc:/milestone/myfirstgoalservice:default
STATE STIME FMRI
maintenance 2025-03-29T03:59:15 svc:/milestone/myfirstgoalservice:default
root@testbed:~# svcadm enable apache24
root@testbed:~# svcs svc:/milestone/myfirstgoalservice:default
STATE STIME FMRI
online 2025-03-29T03:59:41 svc:/milestone/myfirstgoalservice:default
Let’s see if this information is propagated as well into the Fault Management Architecture
März 29 03:59:15.2638 d2e35b38-e8db-4603-88c2-c35be3447c94 SMF-8000-YX Diagnosed
100% defect.sunos.smf.svc.maintenance
Problem in: svc:///milestone/myfirstgoalservice:default
Affects: svc:///milestone/myfirstgoalservice:default
FRU: -
FRU Location: -
März 29 03:59:15.2671 d2e35b38-e8db-4603-88c2-c35be3447c94 FMD-8000-9L Isolated
100% defect.sunos.smf.svc.maintenance
Problem in: svc:///milestone/myfirstgoalservice:default
Affects: svc:///milestone/myfirstgoalservice:default
FRU: -
FRU Location: -
März 29 04:01:04.6800 d2e35b38-e8db-4603-88c2-c35be3447c94 FMD-8000-4M Repaired
100% defect.sunos.smf.svc.maintenance Repair Attempted
Problem in: svc:///milestone/myfirstgoalservice:default
Affects: svc:///milestone/myfirstgoalservice:default
FRU: -
FRU Location: -
März 29 04:01:04.6814 d2e35b38-e8db-4603-88c2-c35be3447c94 FMD-8000-6U Resolved
100% defect.sunos.smf.svc.maintenance Repair Attempted
Problem in: svc:///milestone/myfirstgoalservice:default
Affects: svc:///milestone/myfirstgoalservice:default
FRU: -
FRU Location: -
Well, you just configured your first goal service.