Ad Widget

Collapse

Zabbix agent emulator for as400 system

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sancho
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2015
    • 300

    #16
    Hi Kos,

    Amazing! Thank you very much.

    The new options open up a lot of possibilities.

    The Alpha version has been working very well for me so far. I'll let you know how this beta version and the new features perform once I've had more time to test them.

    As always, congratulations on your excellent work.

    Comment

    • j.k.
      Junior Member
      • Jul 2026
      • 3

      #17
      Hi KOS, I have tried new version and have some problems with my select.
      I have this item:
      Click image for larger version

Name:	image.png
Views:	18
Size:	39.9 KB
ID:	515084
      With this key:
      as400.sql.select["SELECT count(*) FROM QSYS2.JOB_QUEUE_INFO WHERE ACTIVE_JOBS IS NOT NULL and SUBSYSTEM_NAME = 'SLASCH'"]

      But result in Zabbix is this error: as400.ZbxException: java.sql.SQLException: [SQL0666] SQL query exceeds specified limit or threshold.

      From the log: 25:20260715:094854.715 Starting Zabbix Agent v0.8.0-beta3
      25:20260715:094854.725 using configuration file: /home/ZABBIX/agentd/zabbix_agentd.conf
      25:20260715:094854.725 IBM Corporation Java version "1.8.0_401"
      25:20260715:094854.726 Java(TM) SE Runtime Environment (build 8.0.8.20 - pap3280sr8fp20-20240112_01(SR8 FP20))
      25:20260715:094854.726 IBM J9 VM (build 2.9, JRE 1.8.0 OS/400 ppc-32-Bit 20231219_62619 (JIT enabled, AOT enabled)
      OpenJ9 - 08d2144
      OMR - 7a5005b
      IBM - 7394519)
      25:20260715:094854.765 Open Source Software, JTOpen 11.2 codebase 5770-SS1 V7R5M0.00 built=20230219 @AI9
      25:20260715:094857.153 Agent hostname: 'BDAT01', System info: IBM OS/400 BDAT01 V7R3M0, IBM Corporation IBM J9 VM (v1.8.0_401)
      30:20260715:094857.230 agent #1 started [collector]
      31:20260715:094857.258 agent #2 (172.16.108.37) started [active checks #3]
      32:20260715:094857.274 agent #3 started[listener #1]
      34:20260715:094857.281 agent #4 started[listener #2]
      35:20260715:094857.286 agent #5 started[listener #3]
      31:20260715:094902.166 As400Metric.process(as400.sql.select["SELECT count(*) FROM QSYS2.JOB_QUEUE_INFO WHERE ACTIVE_JOBS IS NOT NULL and SUBSYSTEM_NAME = 'SLASCH'"]) error: java.sql.SQLException: [SQL0666] SQL query exceeds specified limit or threshold.​

      But the limit is *nomax
      Click image for larger version

Name:	image.png
Views:	13
Size:	50.0 KB
ID:	515085
      Thansk in advance for any response.​

      Comment

      • Kos
        Senior Member
        Zabbix Certified SpecialistZabbix Certified Professional
        • Aug 2015
        • 3451

        #18
        j.k.Hm, interesting effect. The Zabbix Agent honestly returns the error that it got from the JDBC level. I found the following article regarding the error "SQL0666" (link).
        The agent really sets the QueryTimeout for the java.sql.Statement object before executing an SQL request. It sets it to the same value as was specified for the timeout of Zabbix item.
        I can confirm that on my system your request also returns the same error (with a little bit different message, but the same error code: "[SQL0666] SQL query exceeds specified time limit or storage limit."). However, by some reason the IBM i query optimizer does not like this default value (4 seconds); but it is quite happy if we use a bit higher value (7 seconds or above). I don't know why the query optimizer takes this decision (in my case a real request takes about 400 milliseconds), but, probably, you can use a bigger value of item's timeout as a workaround. If you use Zabbix version older than 7.0.0, you will need to set this timeout value in the config file of Zabbix agent.

        Comment

        • j.k.
          Junior Member
          • Jul 2026
          • 3

          #19
          Hi Kos,

          thanks for your reply. I use zabbix 7.4.10, but which exactly value, do you mean I have change from default ( or 4 ) to 7 or?

          Thanks in advance

          Comment

          • Kos
            Senior Member
            Zabbix Certified SpecialistZabbix Certified Professional
            • Aug 2015
            • 3451

            #20
            Originally posted by j.k.
            thanks for your reply. I use zabbix 7.4.10, but which exactly value, do you mean I have change from default ( or 4 ) to 7 or?
            It's OK, I just mean that Zabbix versions older that 7.0.0 did not allow to set per-item timeouts; in this case the only way to set up the needed timeout was to use the agent's config file.
            The exact value for timeout you can evaluate experimentally; for example, at my systems 6 seconds still give error, but 7 seconds works OK.

            Comment

            • j.k.
              Junior Member
              • Jul 2026
              • 3

              #21
              OK, but I ment, what exactly have to write into config file, to set this timeout. In zabbix_agent.d is not value like timeout ( according to SQL), querry or somenhink like that. Thanks a lot.

              # This is a config file for the Zabbix agent daemon (i5/OS)
              # To get more information about Zabbix, visit http://www.zabbix.com

              ############ GENERAL PARAMETERS #################

              ### Option: PidFile
              # Name of PID file.
              #
              # Mandatory: no
              # Default:
              # PidFile=/tmp/zabbix_agentd.pid

              ### Option: LogType
              #!!Onle file is supported!!
              # Specifies where log messages are written to:
              # system - syslog
              # file - file specified with LogFile parameter
              # console - standard output
              #
              # Mandatory: no
              # Default:
              # LogType=file

              ### Option: LogFile
              # Name of log file.
              #
              # Mandatory: no
              # Default:
              # LogFile=/tmp/zabbix_agentd.log

              LogFile=/home/ZABBIX/agentd/zabbix_agentd.log

              ### Option: LogFileSize
              # Maximum size of log file in MB.
              # 0 - disable automatic log rotation.
              #
              # Mandatory: no
              # Range: 0-1024
              # Default:
              # LogFileSize=1

              ### Option: DebugLevel
              # Specifies debug level
              # 0 - no debug
              # 1 - critical information
              # 2 - error information
              # 3 - warnings
              # 4 - for debugging (produces lots of information)
              # 5 - extended debugging (produces even more information)
              #
              # Mandatory: no
              # Range: 0-5
              # Default:
              # DebugLevel=3

              ### Option: SourceIP
              # Source IP address for outgoing connections.
              #
              # Mandatory: no
              # Default:
              # SourceIP=

              ### Option: AllowKey
              # Allow execution of item keys matching pattern.
              # Multiple keys matching rules may be defined in combination with DenyKey.
              # Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments.
              # Parameters are processed one by one according their appearance order.
              # If no AllowKey or DenyKey rules defined, all keys are allowed.
              #
              # Mandatory: no

              ### Option: DenyKey
              # Deny execution of items keys matching pattern.
              # Multiple keys matching rules may be defined in combination with AllowKey.
              # Key pattern is wildcard expression, which support "*" character to match any number of any characters in certain position. It might be used in both key name and key arguments.
              # Parameters are processed one by one according their appearance order.
              # If no AllowKey or DenyKey rules defined, all keys are allowed.
              # Unless another system.run[*] rule is specified DenyKey=system.run[*] is added by default.
              #
              # Mandatory: no
              # Default:
              # DenyKey=system.run[*]

              ### Option: EnableRemoteCommands - Deprecated, use AllowKey=system.run[*] or DenyKey=system.run[*] instead
              # Internal alias for AllowKey/DenyKey parameters depending on value:
              # 0 - DenyKey=system.run[*]
              # 1 - AllowKey=system.run[*]
              #
              # Mandatory: no

              ### Option: LogRemoteCommands
              # Enable logging of executed shell commands as warnings.
              # 0 - disabled
              # 1 - enabled
              #
              # Mandatory: no
              # Default:
              # LogRemoteCommands=0

              ##### Passive checks related

              ### Option: Server
              #!!IPv4 only supported!!
              #!!As StartAgents must be minimum 1, this parameter is mandatory!!
              # List of comma delimited IP addresses, optionally in CIDR notation, or DNS names of Zabbix servers and Zabbix proxies.
              # Incoming connections will be accepted only from the hosts listed here.
              # If IPv6 support is enabled then '127.0.0.1', '::127.0.0.1', '::ffff:127.0.0.1' are treated equally
              # and '::/0' will allow any IPv4 or IPv6 address.
              # '0.0.0.0/0' can be used to allow any IPv4 address.
              # Example: Server=127.0.0.1,192.168.1.0/24,::1,2001:db8::/32,zabbix.example.com
              #
              # Mandatory: yes, if StartAgents is not explicitly set to 0
              # Default:
              # Server=

              Server=zabbix.yourcompany.com,localhost

              ### Option: ListenPort
              # Agent will listen on this port for connections from the server.
              #
              # Mandatory: no
              # Range: 1024-32767
              # Default:
              # ListenPort=10050

              ### Option: ListenIP
              #!!Originally it was a list of IP-addresses; but we use only a single value!!
              #!!IPv4 only supported!!
              # List of comma delimited IP addresses that the agent should listen on.
              # First IP address is sent to Zabbix server if connecting to it to retrieve list of active checks.
              #
              # Mandatory: no
              # Default:
              # ListenIP=0.0.0.0

              ### Option: StartAgents
              #!!Currently must be minimum 1.!!
              # Number of pre-forked instances of zabbix_agentd that process passive checks.
              # (If set to 0, disables passive checks and the agent will not listen on any TCP port.)
              #
              # Mandatory: no
              # Range: 1-100
              # Default:
              # StartAgents=3

              ##### Active checks related

              ### Option: ServerActive
              #!!IPv4 only supported!!
              # Zabbix server/proxy address or cluster configuration to get active checks from.
              # Server/proxy address is IP address or DNS name and optional port separated by colon.
              # Cluster configuration is one or more server addresses separated by semicolon.
              # Multiple Zabbix servers/clusters and Zabbix proxies can be specified, separated by comma.
              # More than one Zabbix proxy should not be specified from each Zabbix server/cluster.
              # If Zabbix proxy is specified then Zabbix server/cluster for that proxy should not be specified.
              # Multiple comma-delimited addresses can be provided to use several independent Zabbix servers in parallel. Spaces are allowed.
              # If port is not specified, default port is used.
              # IPv6 addresses must be enclosed in square brackets if port for that host is specified.
              # If port is not specified, square brackets for IPv6 addresses are optional.
              # If this parameter is not specified, active checks are disabled.
              # Example for Zabbix proxy:
              # ServerActive=127.0.0.1:10051
              # Example for multiple servers:
              # ServerActive=127.0.0.1:20051,zabbix.domain,[::1]:30051,::1,[12fc::1]
              # Example for high availability:
              # ServerActive=zabbix.cluster.node1;zabbix.cluster.n ode2:20051;zabbix.cluster.node3
              # Example for high availability with two clusters and one server:
              # ServerActive=zabbix.cluster.node1;zabbix.cluster.n ode2:20051,zabbix.cluster2.node1;zabbix.cluster2.n ode2,zabbix.domain
              #
              # Mandatory: no
              # Default:
              # ServerActive=

              ServerActive=zabbix.yourcompany.com

              ### Option: Hostname
              # Unique, case sensitive hostname.
              # Required for active checks and must match hostname as configured on the server.
              # Value is acquired from HostnameItem if undefined.
              #
              # Mandatory: no
              # Default:
              # Hostname=

              ### Option: HostnameItem
              # Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
              # Does not support UserParameters or aliases.
              #
              # Mandatory: no
              # Default:
              # HostnameItem=system.hostname

              ### Option: HostMetadata
              # Optional parameter that defines host metadata.
              # Host metadata is used at host auto-registration process.
              # An agent will issue an error and not start if the value is over limit of 2034 bytes.
              # If not defined, value will be acquired from HostMetadataItem.
              #
              # Mandatory: no
              # Range: 0-2034 characters
              # Default:
              # HostMetadata=

              ### Option: HostMetadataItem
              # Optional parameter that defines an item used for getting host metadata.
              # Host metadata is used at host auto-registration process.
              # During an auto-registration request an agent will log a warning message if
              # the value returned by specified item is over limit of 65535 characters.
              # This option is only used when HostMetadata is not defined.
              #
              # Mandatory: no
              # Default:
              #
              #HostMetadataItem=

              ### Option: HostInterface
              # Optional parameter that defines host interface.
              # Host interface is used at host auto-registration process.
              # An agent will issue an error and not start if the value is over limit of 255 characters.
              # If not defined, value will be acquired from HostInterfaceItem.
              #
              # Mandatory: no
              # Range: 0-255 characters
              # Default:
              # HostInterface=

              ### Option: HostInterfaceItem
              # Optional parameter that defines an item used for getting host interface.
              # Host interface is used at host auto-registration process.
              # During an auto-registration request an agent will log a warning message if
              # the value returned by specified item is over limit of 255 characters.
              # This option is only used when HostInterface is not defined.
              #
              # Mandatory: no
              # Default:
              # HostInterfaceItem=

              ### Option: RefreshActiveChecks
              # How often list of active checks is refreshed, in seconds.
              #
              # Mandatory: no
              # Range: 1-86400
              # Default:
              # RefreshActiveChecks=5

              ### Option: BufferSend
              # Do not keep data longer than N seconds in buffer.
              #
              # Mandatory: no
              # Range: 1-3600
              # Default:
              # BufferSend=5

              ### Option: BufferSize
              # Maximum number of values in a memory buffer. The agent will send
              # all collected data to Zabbix Server or Proxy if the buffer is full.
              #
              # Mandatory: no
              # Range: 2-65535
              # Default:
              # BufferSize=100

              ### Option: MaxLinesPerSecond
              # Maximum number of new lines the agent will send per second to Zabbix Server
              # or Proxy processing 'log' and 'logrt' active checks.
              # The provided value will be overridden by the parameter 'maxlines',
              # provided in 'log' or 'logrt' item keys.
              #
              # Mandatory: no
              # Range: 1-1000
              # Default:
              # MaxLinesPerSecond=100

              ### Option: HeartbeatFrequency
              # Frequency of heartbeat messages in seconds.
              # Used for monitoring availability of active checks.
              # 0 - heartbeat messages disabled.
              #
              # Mandatory: no
              # Range: 0-3600
              # Default: 60
              # HeartbeatFrequency=

              ############ ADVANCED PARAMETERS #################

              ### Option: Alias
              # Sets an alias for an item key. It can be used to substitute long and complex item key with a smaller and simpler one.
              # Multiple Alias parameters may be present. Multiple parameters with the same Alias key are not allowed.
              # Different Alias keys may reference the same item key.
              # For example, to retrieve the ID of user 'zabbix':
              # Alias=zabbix.userid:vfs.file.regexp[/etc/passwd,^zabbix:.[0-9]+),,,,\1]
              # Now shorthand key zabbix.userid may be used to retrieve data.
              # Aliases can be used in HostMetadataItem but not in HostnameItem parameters.
              #
              # Mandatory: no
              # Range:
              # Default:

              ### Option: Timeout
              # Specifies how long to wait (in seconds) for establishing connection and exchanging data with Zabbix proxy or server.
              #
              # Mandatory: no
              # Range: 1-30
              # Default:
              # Timeout=3

              ### Option: AllowRoot
              # Allow the agent to run as 'root'. If disabled and the agent is started by 'root', the agent
              # will try to switch to user 'zabbix' instead. Has no effect if started under a regular user.
              # 0 - do not allow
              # 1 - allow
              #
              # Mandatory: no
              # Default:
              # AllowRoot=0

              ### Option: User
              #!!User profile on AS/400 system that our agent uses to connect.
              #!!By default we use '*CURRENT' for locally started agent and 'zabbix' for remotely monitored systems.
              # Drop privileges to a specific, existing user on the system.
              # Only has effect if run as 'root' and AllowRoot is disabled.
              #
              # Mandatory: no
              # Default:
              # User=zabbix

              ####### USER-DEFINED MONITORED PARAMETERS #######

              ### Option: UnsafeUserParameters
              # Allow all characters to be passed in arguments to user-defined parameters.
              # The following characters are not allowed:
              # \ ' " ` * ? [ ] { } ~ $ ! & ; ( ) < > | # @
              # Additionally, newline characters are not allowed.
              # 0 - do not allow
              # 1 - allow
              #
              # Mandatory: no
              # Range: 0-1
              # Default:
              # UnsafeUserParameters=0

              ### Option: UserParameter
              # User-defined parameter to monitor. There can be several user-defined parameters.
              # Format: UserParameter=<key>,<shell command>
              # See 'zabbix_agentd' directory for examples.
              #
              # Mandatory: no
              # Default:
              # UserParameter=

              ### Option: UserParameterDir
              #!!Ignored!!
              # Directory to execute UserParameter commands from. Only one entry is allowed.
              # When executing UserParameter commands the agent will change the working directory to the one
              # specified in the UserParameterDir option.
              # This way UserParameter commands can be specified using the relative ./ prefix.
              #
              # Mandatory: no
              # Default:
              # UserParameterDir=

              ####### LOADABLE MODULES #######

              ### Option: LoadModulePath
              #!!Ignored!!
              # Full path to location of agent modules.
              # Default depends on compilation options.
              #
              # Mandatory: no
              # Default:
              # LoadModulePath=${libdir}/modules

              ### Option: LoadModule
              #!!Ignored!!
              # Module to load at agent startup. Modules are used to extend functionality of the agent.
              # Format: LoadModule=<module.so>
              # The modules must be located in directory specified by LoadModulePath.
              # It is allowed to include multiple LoadModule parameters.
              #
              # Mandatory: no
              # Default:
              # LoadModule=

              ####### TLS-RELATED PARAMETERS #######
              #!!All these parametes are ignored as encrypted connections are not implemented
              # TLSConnect=unencrypted
              # TLSAccept=unencrypted
              # TLSCAFile=
              # TLSCRLFile=
              # TLSServerCertIssuer=
              # TLSServerCertSubject=
              # TLSCertFile=
              # TLSKeyFile=
              # TLSPSKIdentity=
              # TLSPSKFile=
              # TLSCipherCert13=
              # TLSCipherCert=
              # TLSCipherPSK13=
              # TLSCipherPSK=
              # TLSCipherAll13=
              # TLSCipherAll=

              ####### For advanced users - TCP-related fine-tuning parameters #######

              ## Option: ListenBacklog
              # The maximum number of pending connections in the queue. This parameter is passed to
              # listen() function as argument 'backlog' (see "man listen").
              #
              # Mandatory: no
              # Range: 0 - INT_MAX (depends on system, too large values may be silently truncated to implementation-specified maximum)
              # Default: SOMAXCONN (hard-coded constant, depends on system)
              # ListenBacklog=

              ### Option: Include
              #!!Not implemented!!
              # You may include individual files or all files in a directory in the configuration file.
              # Installing Zabbix will create include directory in /usr/local/etc, unless modified during the compile time.
              #
              # Mandatory: no
              # Default:
              # Include=

              # Include=/usr/local/etc/zabbix_agentd.userparams.conf
              # Include=/usr/local/etc/zabbix_agentd.conf.d/
              # Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf

              ####### AS/400-specific parameters #######

              ### Option: as400ServerHost
              # DNS name or IP address of AS/400 host to connect to.
              # Default is localhost (acceptable if the agent is running on the AS/400 host directly).
              #
              # Mandatory: no
              # Default:
              # as400ServerHost=localhost

              ### Option: as400Password
              # Password for a user on AS/400 (username can be set via "User=" parameter).
              # Default is acceptable if the agent is running on the AS/400 host directly).
              # Mandatory: no
              # Default:
              # as400Password=*CURRENT

              ### Option: as400EventIdAsMessagePrefix #######
              # If Zabbix Agent should add the Event ID to the message text as a prefix
              #
              # Mandatory: no
              # Range: 0-1
              # Default:
              # as400EventIdAsMessagePrefix=1

              ### Option: as400UserAsMessagePrefix #######
              # If Zabbix Agent should add the current user name of message in message queue
              # to the message text as a prefix
              #
              # Mandatory: no
              # Range: 0-1
              # Default:
              # as400UserAsMessagePrefix=0

              ### Option: as400JobAsMessagePrefix #######
              # If Zabbix Agent should add the current Job name (in format "NUMBER/USER/JOBNAME")
              # to the message text as a prefix
              #
              # Mandatory: no
              # Range: 0-1
              # Default:
              # as400JobAsMessagePrefix=0

              Comment

              • Kos
                Senior Member
                Zabbix Certified SpecialistZabbix Certified Professional
                • Aug 2015
                • 3451

                #22
                I spoke about this section:
                Code:
                ### Option: Timeout
                # Specifies how long to wait (in seconds) for establishing connection and exchanging data with Zabbix proxy or server.
                #
                # Mandatory: no
                # Range: 1-30
                # Default:
                # Timeout=3
                However, if you have Zabbix server v7.x, it's not needed: starting from Zabbix v7.0.0, our agent will use for SQL requests the timeouts configured via web-interface (global or a per-item timeouts) and will ignore timeout from its config.

                Comment

                Working...