Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-25097

Zabbix agent2 plugin CEPH default value

XMLWordPrintable

    • Icon: Patch request Patch request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.33
    • Agent2 plugin (N)
    • None

      Steps to reproduce:

      1. Install Zabbix Agent2
      2. Configure CEPH :
        1. enable restful :
          ceph mgr module enable restful
        2. create self sign certificate :
          ceph restful create-self-signed-cert
        3. create api key :
          ceph restful create-key zabbix
        4. keep the YourKEY return by the command
      3. Configure plugin CEPH /etc/zabbix/zabbix_agent2.d/plugins.d/ceph.conf
        # cat /etc/zabbix/zabbix_agent2.d/plugins.d/ceph.conf
        Plugins.Ceph.Default.Uri=https://localhost:8003
        Plugins.Ceph.Default.User=zabbix
        Plugins.Ceph.Default.ApiKey=YourKEY
      4. Test :
        zabbix_agent2 -t ceph.ping

      Result:

      # zabbix_agent2 -t ceph.ping
      ceph.ping                                     [m|ZBX_NOTSUPPORTED] [Second parameter "User" is required: Too few parameters.]

      Expected:

      # zabbix_agent2 -t ceph.ping
      ceph.ping                                     [s|1]

      or

      # zabbix_agent2 -t ceph.ping
      ceph.ping                                     [s|0]

      What works:

      1. Use a session :
        # cat /etc/zabbix/zabbix_agent2.d/plugins.d/ceph.conf
        Plugins.Ceph.Sessions.Prod.Uri=https://localhost:8003
        Plugins.Ceph.Sessions.Prod.User=zabbix
        Plugins.Ceph.Sessions.Prod.ApiKey=YourKEY
        # zabbix_agent2 -t ceph.ping[Prod]
        ceph.ping[Prod]                               [s|1]
        
      2. Set variable in argument or in MACRO :
        # zabbix_agent2 -t ceph.ping[https://localhost:8003,zabbix,YourKEY]
        ceph.ping[Prod]                               [s|1]
        

      Proposed solution:
      Set arguments to optional as in MySQL plugin :

      diff --git a/src/go/plugins/ceph/config.go b/src/go/plugins/ceph/config.go
      index 0353cb34214..3ae25fbb326 100644
      --- a/src/go/plugins/ceph/config.go
      +++ b/src/go/plugins/ceph/config.go
      @@ -22,10 +22,8 @@ import (
       type Session struct {
              // URI defines an endpoint to REST API.
              URI string `conf:"name=Uri,optional"`
      -
      -       APIKey string `conf:"name=ApiKey"`
      -
      -       User string `conf:"name=User"`
      +       APIKey string `conf:"name=ApiKey,optional"`
      +       User string `conf:"name=User,optional"`
       }
       
       type PluginOptions struct {
      diff --git a/src/go/plugins/ceph/metrics.go b/src/go/plugins/ceph/metrics.go
      index f70b2debf53..85bba810b0a 100644
      --- a/src/go/plugins/ceph/metrics.go
      +++ b/src/go/plugins/ceph/metrics.go
      @@ -86,8 +86,8 @@ var (
              paramURI = metric.NewConnParam("URI", "URI to connect or session name.").
                              WithDefault(uriDefaults.Scheme + "://localhost:" + uriDefaults.Port).WithSession().
                              WithValidator(uri.URIValidator{Defaults: uriDefaults, AllowedSchemes: []string{"https"}})
      -       paramUsername = metric.NewConnParam("User", "Ceph API user.").SetRequired()
      -       paramAPIKey   = metric.NewConnParam("APIKey", "Ceph API key.").SetRequired()
      +       paramUsername = metric.NewConnParam("User", "Ceph API user.").WithDefault("zabbix")
      +       paramAPIKey   = metric.NewConnParam("APIKey", "Ceph API key.").WithDefault("")
       )
       
       var metrics = metric.MetricSet{
      

            mbuz Maksym Buz
            macmonac Pierre BLONDEAU
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: