Solaris 11 – How to Monitor SMF Services

 

 

How to List the Status of a Service

This procedure can be used to show what services are running.

  • Run the svcs command.Running this command without any options displays a status report of the service specified by the FMRI.
    $ svcs -l FMRI

Example 1 Showing the Status of the sendmail Service

This example shows the status of a service that includes dependencies. Also, the -p option is used so that information about the process ID, start time and command run is displayed

$ svcs -lp network/smtp:sendmail
fmri         svc:/network/smtp:sendmail
name         sendmail SMTP mail transfer agent
enabled      true
state        online
next_state   none
state_time   Tue Aug 09 19:25:54 2011
logfile      /var/svc/log/network-smtp:sendmail.log
restarter    svc:/system/svc/restarter:default
contract_id  114
manifest     /etc/svc/profile/generic_limited_net.xml
manifest     /lib/svc/manifest/network/smtp-sendmail.xml
dependency   require_all/refresh file://localhost/etc/mail/sendmail.cf (online)
dependency   require_all/refresh file://localhost/etc/nsswitch.conf (online)
dependency   optional_all/none svc:/system/filesystem/autofs (online)
dependency   require_all/none svc:/system/filesystem/local (online)
dependency   require_all/none svc:/network/service (online)
dependency   require_all/refresh svc:/milestone/name-services (online)
dependency   optional_all/refresh svc:/system/identity:domain (online)
dependency   optional_all/none svc:/system/system-log (online)
process      101077 /usr/lib/sendmail -bd -q15m

Example 2 Showing the Status of all Services

The following command lists all services that are installed on the system as well as the status of each service. The command displays those services that are disabled as well as those that are enabled.

$ svcs -a

Example 3 Showing the Status of Services Controlled by inetd

The following command lists services that are controlled by inetd. Each service’s FMRI is listed, along with the run state and whether the service is enabled or disabled.

$ inetadm

How to List Customizations of a Service

  • List local customizations.This command displays all of the changes at the admin layer for the selected service.
    % /usr/sbin/svccfg -s FMRI listcust

How to Show Which Services Are Dependent on a Service Instance

This procedure shows how to determine which service instances depend on the specified service.

  • Display the service dependents.
    $ svcs -D FMRI

Example 4 Displaying the Service Instances That Are Dependent on the multiuserMilestone

The following example shows how to determine which service instances are dependent on themultiuser milestone.

$ svcs -D milestone/multi-user
STATE          STIME    FMRI
disabled       Aug_09   svc:/application/time-slider:default
disabled       Aug_09   svc:/application/management/net-snmp:default
online         Aug_09   svc:/system/intrd:default
online         Aug_09   svc:/system/boot-config:default
online         Aug_09   svc:/milestone/multi-user-server:default

How to Show Which Services a Service Is Dependent On

This procedure shows how to determine which services a specified service instance is dependent on.

  • Display the service dependencies.
    $ svcs -d FMRI

Example 5 Displaying the Service Instances That the multiuser Milestone Is Dependent On

The following example shows the services instances that the multiuser milestone is dependent on:

$ svcs -d milestone/multi-user:default
STATE          STIME    FMRI
disabled       Aug_09   svc:/network/nfs/client:default
disabled       Aug_09   svc:/network/smb/client:default
disabled       Aug_09   svc:/system/mdmonitor:default
disabled       Aug_09   svc:/application/print/server:default
online         Aug_09   svc:/system/resource-controls:default
online         Aug_09   svc:/system/metasync:default
online         Aug_09   svc:/system/rmtmpfiles:default
online         Aug_09   svc:/system/utmp:default
online         Aug_09   svc:/system/name-service/cache:default
online         Aug_09   svc:/system/device/audio:default
online         Aug_09   svc:/network/rpc/bind:default
online         Aug_09   svc:/milestone/name-services:default
online         Aug_09   svc:/network/iscsi/initiator:default
online         Aug_09   svc:/milestone/single-user:default
online         Aug_09   svc:/system/filesystem/local:default
online         Aug_09   svc:/network/inetd:default
online         Aug_09   svc:/system/cron:default
online         Aug_09   svc:/system/filesystem/autofs:default
online         Aug_09   svc:/system/filesystem/ufs/quota:default
online         Aug_09   svc:/system/power:default
online         Aug_09   svc:/system/system-log:default
online         Aug_09   svc:/system/system-log:default
online         Aug_09   svc:/system/auditd:default
online         Aug_09   svc:/network/smtp:sendmail

How to Set Up Email Notification of SMF Transition Events

This procedure causes the system to generate an email notification each time one of the services or a selected service has a change in state. You can choose to use either SMTP or SNMP. Normally, you would only select SNMP if you already have SNMP configured for some other reason.

By default, SNMP traps are sent on maintenance transitions. If you use SNMP for monitoring, you can configure additional traps for other state transitions.

  1. Become an administrator or assume a role that includes the Service Managementrights profile.
  2. Set notification parameters.The following examples show how to set notification parameters for SMF and FMA events, as well as how to list and delete notification parameters.

Example 6 Configuring Notifications for All SMF Service State Events

The following command creates a notification that sends email when transactions go into themaintenance state.

# /usr/sbin/svccfg setnotify -g maintenance mailto:sysadmins@example.com

You can also choose to select transactions that start in the state listed with the from option and end in the state listed with the to option. The valid SMF states for this option are: degraded,maintenance, offline, and online. You can use the -g all option to generate email for all state transition events. 

Example 7 Configuring Notifications for an Individual Service

The following command creates a notification that sends email when the switch service goes into the online state.

# /usr/sbin/svccfg -s svc:/system/name-service/switch:default setnotify to-online \ mailto:sysadmins@example.com

Example 8 Configuring Notifications for FMA Events

The following command creates a notification that sends an SNMP message when a FMA problem is repaired.

# /usr/sbin/svccfg setnotify problem-repaired snmp: 

The FMA event classes include problem-diagnosed, problem-updated, problem-repaired and problem-resolved

Example 9 Listing Notification Settings

The following command shows the notification settings for a new problem diagnosed by the FMA service. Notification settings for SMF service state transition events can be displayed by including the service state instead of the event class or by not including any arguments withlistnotify.

# /usr/sbin/svccfg listnotify problem-diagnosed

Example 10 Deleting Notification Settings

The following command deletes the notification settings associated with the switch service transitioning to the online service state. You can use an FMA event class in place of the service state.

# /usr/sbin/svccfg -s svc:/system/name-service/switch:default delnotify to-online
Measure
Measure
 
 
 
Ramdev

Ramdev

I have started unixadminschool.com ( aka gurkulindia.com) in 2009 as my own personal reference blog, and later sometime i have realized that my leanings might be helpful for other unixadmins if I manage my knowledge-base in more user friendly format. And the result is today's' unixadminschool.com. You can connect me at - https://www.linkedin.com/in/unixadminschool/

2 Responses

  1. September 16, 2015

    […] Read – How to Monitor SMF Services […]

  2. September 22, 2015

    […] Read – How to Monitor SMF Services […]

What is in your mind, about this post ? Leave a Reply

Close
  Our next learning article is ready, subscribe it in your email

What is your Learning Goal for Next Six Months ? Talk to us