-
Patch request
-
Resolution: Unresolved
-
Trivial
-
None
-
6.0.33
-
None
Steps to reproduce:
- Install Zabbix Agent2
- Configure CEPH :
- enable restful :
ceph mgr module enable restful
- create self sign certificate :
ceph restful create-self-signed-cert
- create api key :
ceph restful create-key zabbix
- keep the YourKEY return by the command
- enable restful :
- 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
- 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:
- 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]
- 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{