Code Monkey home page Code Monkey logo

Comments (7)

robbrucks avatar robbrucks commented on June 12, 2024

It appears putting the query into a macro variable works, but it's not an ideal solution. Some of the queries at the app level are going to be around 400 characters. I don't want to create a bunch of macro variables for those.

Any suggestions?

Thanks,
Rob

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

Hmmm... really good challenge. We could push for the character limit to be increased but I'm not convinced that is a smart way forward.

How helpful would it be if I documented up a template for writing and compiling your own keys in the module? Just copy and paste in your own queries and make.

from libzbxpgsql.

robbrucks avatar robbrucks commented on June 12, 2024

I'd prefer a method that wouldn't require recompiling every time we change something. Would it be possible to read the sql by key from a config file in "/etc/zabbix" or "/etc/zabbix/zabbix_agentd.d" ?

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

Would you prefer to define all of your queries in an INI style file or as individual query files?

I think individual files would be better in that there is no character escaping required. The query could then be referenced in the Zabbix agent key by file name. E.g. pg.query.interger[,,query_file]. These could maybe be stored in /etc/zabbix/libzbxpgsql.d/*.sql or a path configured via environment variable. This is also fairly simple to implement in code.

A single config file could get a little unwieldy with lots of multi-line queries and character escaping, but it would more intuitive for defining other things like a pre-allocated agent key, data type, etc.

from libzbxpgsql.

robbrucks avatar robbrucks commented on June 12, 2024

If I had to choose between them I'd go with a single file, but if you feel strongly about multiple files I could live with that. IMHO a single file is easier to maintain. Plus if you have need to define other parameters (like maybe session options such as statement_timeout... hint hint) they could live there as well.

Escaping things isn't a big deal to me... I live for dollar quotes and backslashes... lol!

Simple variable assignment or INI or YAML or whatever standard you want to use would be fine, I can adapt. Even XML would work (sigh), though I hate XML.

BTW - Thanks for all your hard work on this, I think this plugin will rapidly become very popular!

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

I've pushed some fairly major refactoring in 4663596. I apologise as it has removed your contributions from blame view, but your implementation and commit history are still in tact.

These are few changes that are hopefully of value:

  • there's a single config file now, that can be used to import additional config files, instead of using file globbing
  • configuration files can be used for other future things - for now it only supports queries = {}
  • config/named-query logic is in a discrete code file src/pg_config.c
  • theres a lot less log noise now

from libzbxpgsql.

cavaliercoder avatar cavaliercoder commented on June 12, 2024

Added in release v1.1.0

from libzbxpgsql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.