Monday, March 21, 2011

SMF Service Management Facility

SMF
Stands for Service Management Facility a new way of managing services in your Solaris Operating Environment.

Benefits:



  • You can manually stop,start and restart services using proper procedures.
  • You can establish and formalize dependency relationships between services.
  • You can have a grip on system startup behavior and service status.
  • You can have a structured mechanism for Fault Management of system services.
  • You can get detailed information about misconfigured services with explaination as why the service was not running or misconfigured.
  • You get individual log files for each service.



KEY TERM:

Service Identifier
Service Category
Service States
Milestones
Service Configuration Repository

Now we shall discuss the key terms now to get familiar with SMF

What is Service Identifier ?
Each instance of   service within SMF has a name which is called Service Identifier.
Service Identifier is in the form of  Fault Management Resource Identifier.

What is FMRI ?
FMRI indicates type of service or category,name and instance of the service.

What is Service Category ?
It defines the category of  service and is always after the prefix “svc”.
Example:
application,device,legacy,milestone,network,platform,site,system.

What is Service States?
It denotes if a SMF service is online, offline, disabled, maintenance, uninitialized, degraded, legacy_run.

What are Milestones ?
It’s a special type of service that is made up of a defined set of  other services.
A milestone is a system state to reach which in turn requires defined set of services to be running which depend on other services being available.
Example:
single-user,multi-user,multi-user-server,network,name-services,sysconfig,devices.


What is Service Configuration Repository ?
It stores information about the state of each SMF service instance.
It also stores configuration information about the services and system.
Example:
/etc/svc/repository.db



Introducing SMF Commands

svcs


You can identify each service by using svcs command.
Example:
#svcs
Using svcs command to list service, check service dependencies.

#svcs -a | grep offline
#svcs -a | grep disabled
#svcs nfs/client
STATE          STIME    FMRI
maintenance     3:02:10 svc:/network/nfs/client:default
# svcs -D nfs/client 
(Use D to list services or service intances that depend on given services or service instances).
STATE          STIME    FMRI
online         Mar_13   svc:/system/filesystem/autofs:default
online         Mar_13   svc:/system/dumpadm:default
online         Mar_13   svc:/milestone/multi-user:default
online         Mar_13   svc:/system/webconsole:consol

#svcs –d network/smtp
(Use d to list services or service instances upon which the given service instances depend).
STATE          STIME    FMRI
online         Mar_13   svc:/milestone/name-services:default
online         Mar_13   svc:/system/identity:domain
online         Mar_13   svc:/network/service:default
online         Mar_13   svc:/system/filesystem/local:default
online         Mar_13   svc:/system/filesystem/autofs:default
online         Mar_13   svc:/system/system-log:default

#svcs -xv (x Displays explanations for service states,v displays verbose )
Example:
# svcs -xv
svc:/application/print/server:default (LP print server)
 State: disabled since Sun Mar 13 20:44:59 2011
Reason: Disabled by an administrator.
   See: http://sun.com/msg/SMF-8000-05
   See: man -M /usr/share/man -s 1M lpsched
Impact: 2 dependent services are not running:
        svc:/application/print/rfc1179:default
        svc:/application/print/ipp-listener:default

svcadm

You can administer or change the service by using svcadm command.
Example:
#svcadm enable sendmail (use this if its disabled)
#svcadm disable sendmail(use this to disabled if enabled)

Example:
#svcadm clear sendmail    (use this if in maintenance state)
#svcadm refresh sendmail (use this after clear)
#svcadm restart sendmail  (use this after refresh)

svccfg

You can configure and manipulate a service by using the svccfg command.

Example 1 : Importing a Service Description

The following example imports a service description for the seismic service in the XML manifest specified on the command line.

# svccfg import /var/svc/manifest/site/seismic.xml


 Example 2 : Exporting a Service Description

 To export a service description on the local system:

 $ svccfg export dumpadm >/tmp/dump.xml

 Example 3 :  Deleting a Service Instance

To delete a service instance:
$ svccfg delete network/inetd-upgrade:default

Example 4:  Modifying the properties of instance
# svccfg
       svc:> repository /etc/svc/repository-boot
       svc:> select telnet:default
       svc:/network/telnet:default> listprop general/enabled
       general/enabled  boolean  false
       svc:/network/telnet:default> exit

Example 5 : Reverting to another SMF snapshot that worked perfectly

# svccfg
svc:> select svc:/network/nfs/client:default
svc:/network/nfs/client:default> listsnap
initial
last-import
running
start
previous
svc:/network/nfs/client:default> revert start
svc:/network/nfs/client:default> quit
Now need to refresh and restart for changes to reflect.
-bash-3.00# svcadm refresh svc:/network/nfs/client:default
-bash-3.00# svcadm restart svc:/network/nfs/client:default

svcprop

You can retrieve values of service configuration properties

Example:
#svcprop -p restarter/state system/cron:default
  online

No comments:

Post a Comment