Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERRO[0000] Invalid value for poll interval parameter: time: invalid duration "" #256

Open
kiranashav opened this issue Oct 2, 2023 · 8 comments

Comments

@kiranashav
Copy link

kiranashav commented Oct 2, 2023

Please include the following information in your ticket.

  • mq-metrics-samples version(s) that are affected by this issue.
  • A small code sample or description that demonstrates the issue.
    [mqm@localhost mq_prometheus]$ sudo docker run -p 9157:9157 -v /home/mqm/src/github.com/ibm-messaging/mq-metric-samples/cmd/mq_prometheus:/opt/config -it --rm mqprom:2.0
    [sudo] password for mqm:
    IBM MQ metrics exporter for Prometheus monitoring
    MQ Go Version : v5.5.0

ERRO[0000] Invalid value for poll interval parameter: time: invalid duration ""
INFO[0000] Done.
[mqm@localhost mq_prometheus]$
Not sure where to fix the Invalid duration poll Interval parameter

Prometheus.yaml file

[mqm@localhost mq_prometheus]$ cat mq_prometheus.yaml

# my global config
global:
  scrape_interval:     15s # Scrape targets every 15 seconds.
  evaluation_interval: 15s # Evaluate rules every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
      monitor: 'codelab-monitor'

# Load and evaluate rules in this file every 'evaluation_interval' seconds.
rule_files:
  # - "first.rules"
  # - "second.rules"

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any time series scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.

    static_configs:
      - targets: ['localhost:9090']

  # Adding a reference to an MQ monitor. All we have to do is
  # name the host and port on which the monitor is listening.
  # Port 9157 is the reserved default port for this monitor.
  - job_name: 'ibmmq'
    scrape_interval: 15s

    static_configs:
       - targets: ['localhost:9157']
  # targets: ['hostname.example.com:9157','hostname.example.com:9158'] is
  # the syntax if you want to have several prometheus monitors on the same
  # box.

@ibmmqmet
Copy link
Collaborator

ibmmqmet commented Oct 4, 2023

This is nearly unreadable because of the formatting. And you don't seem to have provided a copy of your collector configuration file - that's the one with the definitions of how to connect to the queue manager.

The provided sample config has pollInterval = 30s. Problems with yaml files often revolve around trailing or missing spaces.

@kiranashav
Copy link
Author

kiranashav commented Oct 4, 2023

Thank you for your reply..

Location of the file
[mqm@localhost mq_prometheus]$ ls
Channel Status-1573633353444.json Logging-1675415684512.json mq_prometheus.sh Queue Status-1542214350028.json z_OS status-1553086205889.json
config.collector.yaml main.go mq_prometheus.yaml README.md
config.go MQ Prometheus-1541759594068.json mqsf_prometheus.sh status.go
exporter.go mq_prometheus.mqsc Queue Manager Status-1554359901415.json Topic Status-1554454974410.json
[mqm@localhost mq_prometheus]$ pwd
/home/mqm/src/github.com/ibm-messaging/mq-metric-samples/cmd/mq_prometheus

Here's the config.collector.yaml file . Please let me know if you need any other file to fix the Invalid value for poll interval parameter

**config.collector.yaml** 


# This is the collector-specific piece of the configuration
prometheus:
  port: 9157
# We can constrain the http listener to a single adapter via the 'host' config. Default is
# to bind to all local addresses
# host: 1.2.3.4
  metricsPath: "/metrics"
  namespace: ibmmq
# We can also set keystore information if the Prometheus instance uses TLS to contact the collector
# httpsKeyFile:  "server.key"
# httpsCertFile: "server.crt"
# Keep running even if the qmgr is not available - allows a "STOPPED" status to be
# returned to the Prometheus server.
  keepRunning: true
# How often to check the status and to attempt to reconnect if there's been a failure  
  reconnectInterval: 5s

@kiranashav
Copy link
Author

the poll_interval seems to be defined in config.common.yaml. Not sure if we need to modify anything in this file

# This is the section of the configuration file
# that is common for all collectors. It gets combined
# with the collector-specific portion to create the real
# configuration file.

global:
  useObjectStatus: true
  useResetQStats: false
  usePublications: true
  logLevel: INFO 
  metaprefix: ""
  pollInterval: 30s
  rediscoverInterval: 1h
  tzOffset: 0h

connection:
    queueManager: QM1

# You can point at a CCDT here. You probably will have to use this
# for TLS client connections to a queue manager
    ccdtUrl:
# For simple client configurations, set the connName and channel
    connName:
    channel:
# If none of the channel-related attributes are set, then this can
# be set to true to force client connectivity and the usual environment
# variables such as MQSERVER are used.
    clientConnection: false

# If a user is set, then a password must be passed somehow. It can
# be done in this file, on a command line, or (better) passed via stdin
#    user: mqadmin
#    password: passw0rd                                             

# Which queue should be used as the template for replies from the qmgr. This will 
# usually be a QMODEL
    replyQueue: SYSTEM.DEFAULT.MODEL.QUEUE
# If 'replyQueue' is set to a QLOCAL, then you must also set
#   replyQueue2: A.DIFFERENT.QLOCAL

# Using durable subscriptions for queue metrics reduces the need for MAXHANDS to be increased.
# Setting this to a non-empty value switches the collectors to use durable subs. And then the
# replyQueue and replyQueue2 values MUST refer to distinct QLOCALs. The value of this attribute must be
# unique for any collector program connecting to this queue manager
    durableSubPrefix: 

# Maximum time (seconds) to wait for a status response from qmgr. 
    waitInterval: 3

# "channels" is for all the traditional MQ channels including SVRCONNs. "amqpChannels" shows
# status for the AMQP objects
objects:
    queues:
    - APP.*
    - "!SYSTEM.*"
    - "!AMQ.*"
    - QM*
    channels:
    - SYSTEM.*
    - TO.*
    topics:
    subscriptions:
#    amqpChannels:
#    - "*"

# The "filters" section gives additional control over what is collected for various
# object types. Some fields in here used to be in other sections, but those
# attributes now give an error to force configurations to move to this model.
filters:
    # Setting this to "true" reduces the unique sets of data in the database, at the cost of
    # hiding metrics from separate instances. 
    hideSvrConnJobname: false
    # Setting this to "true" shows all channels, not just those that have some kind of active status
    showInactiveChannels: false
    # Similar to the hideSvrJobname attribute, but for AMQP channels. Reduces the number of unique
    # elements when set to "true"
    hideAMQPClientId: false
    # The number of subscriptions can be reduced by selecting a subset of types. Set to "NONE" to 
    # ignore all published queue metrics (but still keeping all queue manager metrics). The set
    # shown here gives best balance for number of subscriptions and useful metrics. If this is an empty 
    # list, all queue metrics are collected.
    queueSubscriptionSelector:
    - PUT
    - GET
    - GENERAL

# Collector-specific configuration may also need to be added here. The example build
# scripts will concatenate default definitions from the cmd/mq_* directories.

@kiranashav
Copy link
Author

@ibmmqmet here's the docker command that I am executing. I have commented out the poll_interval in config.common.yaml
but we're still receiving the same error

[mqm@localhost` mq-metric-samples]$ sudo docker run -p 9157:9157 -v /home/mqm/src/github.com/ibm-messaging/mq-metric-samples/cmd/mq_prometheus:/opt/config -it --rm mqprom:2.0
IBM MQ metrics exporter for Prometheus monitoring
MQ Go Version : v5.5.0

ERRO[0000] Invalid value for poll interval parameter: time: invalid duration "" 
INFO[0000] Done.       

@ibmmqmet
Copy link
Collaborator

ibmmqmet commented Oct 5, 2023

It looks like you are only providing a partial configuration file (if any).

As the README says, the full config file that you supply needs to be the combination of config.common.yaml and the config.collector.yaml in a single file for the specific collector program.

@kiranashav
Copy link
Author

kiranashav commented Oct 9, 2023

Hi @ibmmqmet We haven't made any changes to config.common.yaml and config.collector.yaml . Here's the list of directories which we currently have . I have shared both the files in the previous comments and still get the invalid value error. Not sure how to troubleshoot this issue. Any help on this issue would be appreciated.
Also here's the docker command I'm trying to execute .

Tried adding both config.common.yaml and config.collector.yaml in one single file and still getting the same error.

ERRO[0000] Invalid value for poll interval parameter: time: invalid duration "" 
INFO[0000] Done.       
sudo docker run -p 9157:9157 -v /home/mqm/src/github.com/ibm-messaging/mq-metric-samples/cmd/mq_prometheus:/opt/config -it --rm mqprom:2.0

[mqm@localhost mq-metric-samples]$ ls
CHANGELOG.md  config.common.yaml  DCO1.1.txt  Dockerfile.build  dspmqrtj                     go.mod  LICENSE      MQDEB  README.md  vendor
cmd           cp4i                Dockerfile  Dockerfile.run    go1.21.1.linux-amd64.tar.gz  go.sum  metrics.txt  pkg    scripts

@ibmmqmet
Copy link
Collaborator

If you set loglevel to DEBUG it will print out what it thinks your configuration settings are. Of course, if you are pointing at the wrong configuration file then that change wouldn't take effect.

Since you seem to be mounting the prometheus-specific source directory into /opt/config, then it will be looking for a mq_prometheus.yaml from that directory. And that would have to be the merged /config.common.yaml and <cmd/mq_prometheus>/config.collector.yaml.

@kiranashav
Copy link
Author

kiranashav commented Oct 13, 2023

@ibmmqmet As suggested above I have merged mq_prometheus.yaml with config.common.yaml and config.collector.yaml and executing the below command


[mqm@localhost ~]$ sudo docker run -p 9157:9157 -v /home/mqm/src/github.com/ibm-messaging/mq-metric-samples/cmd/mq_prometheus/mq_prometheus.yaml:/opt/config/mq_prometheus.yaml mqprom:2.0
[sudo] password for mqm: 
IBM MQ metrics exporter for Prometheus monitoring
MQ Go Version : v5.5.0

time="2023-10-13T09:21:17Z" level=error msg="Connection to QM1 has failed. Cannot connect to queue manager QM1 : MQCONNX: MQCC = MQCC_FAILED [2] MQRC = MQRC_Q_MGR_NAME_ERROR [2058]"
time="2023-10-13T09:21:17Z" level=info msg=Done.
[mqm@localhost ~]$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants