subscribeto_rule

Subscribes the user to a rule with email notification.

It is not an error to specify email addresses that are already in the assignto user's preferences.

A message appears if the outgoing mail server (SMTP) has not been set up. When you specify the -fail_if_no_mail_server, this condition is an error and prevents the subscribe from occurring; otherwise, this condition is a warning that does not affect the success of this command.

Format

emcli subscribeto_rule
        -ruleset_name="ruleset_name"
        -rule_name="rule_name"
        -owner="rule_owner"
        [-assignto="em_username"]
        [-email="email_address";...]
        [-fail_if_no_mail_server]

[ ]  indicates that the parameter is optional

Options

  • ruleset_name

    Name of the incident rule set.

  • rule_name

    Name of the rule.

  • owner

    Owner of the rule set.

  • assignto

    User to subscribe to the notification rule. If the assignto user is not the current user, or if the owner of the rule is not the current user, the super-user privilege is needed. The default is the current user.

  • email

    List of email addresses to associate with the rule to which the assignto user is being subscribed. These addresses are first added to the preferences of the assignto user (duplicates are ignored) before being assigned to the notification rule. The email addresses are added only if the current user has the privilege to subscribe the assignto user to the rule.

  • fail_if_no_mail_server

    A message appears if the outgoing mail server (SMTP) has not been set up. When you specify the -fail_if_no_mail_server option, this condition is an error and prevents the subscribe from occurring; otherwise, this condition is a warning that does not affect the success of this command.

Examples

Example 1

This example subscribes the current user to the rule "Agent Upload Problems" using the current user's email addresses for notification. The current user must have the SUPER_USER (or have sysman) privilege for this to succeed, since sysman owns the rule. Also, the current user must already have at least one email address in his/her preferences for this command to succeed.

emcli subscribeto_rule -name="Agent Upload Problems" -owner=sysman

Example 2

This example first adds the two specified email addresses to the preferences for user joe. Then user joe is subscribed to the rule "Agent Upload Problems" using joe's email addresses for notification. The current user must have SUPER_USER privilege (or be joe) for this command to succeed.

emcli subscribeto_rule -name="Agent Upload Problems" -owner=sysma
      -assignto=joe -email="joe@work.com;joe@home.com"