code: func (p *Plugin) StartPlugin() error {
  	p.App.Before = func(c *cli.Context) error {
  		if p.BeforeFunc != nil {
  			if err := p.BeforeFunc(c); err != nil {
  				return err
  			}
  		}
  		if p.Role == dcos.RoleMaster || p.Role == dcos.RoleAgent || p.Role == dcos.RoleAgentPublic {
  			return p.createClient()
  		}
  		return fmt.Errorf(
  			"--dcos-role %q was not recognized (valid roles: %s, %s, %s)",
  			p.Role, dcos.RoleMaster, dcos.RoleAgent, dcos.RoleAgentPublic)
  	}
  	p.App.After = func(c *cli.Context) error {
  		if p.AfterFunc != nil {
  			if err := p.AfterFunc(c); err != nil {
  				return err
  			}
  		}
  		return nil
  	}
  	p.App.Action = func(c *cli.Context) error {
  		for {
  			metrics, err := p.Metrics()
  			if err != nil {
  				return err
  			}
  
  			if err := p.ConnectorFunc(metrics, c); err != nil {
  				return err
  			}
  
  			p.Log.Infof("Polling complete, sleeping for %d seconds", p.PollingInterval)
  			time.Sleep(time.Duration(p.PollingInterval) * time.Second)
  		}
  	}
  
  	return p.App.Run(os.Args)
  }
docs: // StartPlugin starts a (previously configured) Plugin. It will periodically
  // poll the system for metrics and send them to the ConnectorFunc.  This method
  // will block.