Ad Widget

Collapse

Simple expand macros on stdin

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • limo
    Senior Member
    • Dec 2004
    • 192

    #1

    Simple expand macros on stdin

    Hi to all,

    I just needed this so I made little patch. It is working for me, but it is more hack than real patch. I added commandline options to zabbix_server

    Code:
           "  -n --new-nodeid <nodeid>    convert database data to new nodeid",
           "  -e --expand-macros          expand macros on stdin and print to stdout",
           "  -t --expand-macros-triggerid  <triggerid> for -e and simple_macros: triggerid",
    than you can use zabbix_server with parameter -e and -t :
    Code:
     ./zabbix_server  -e -t '19524' -c /etc/zabbix/zabbix_server_beta.conf
    {a423-1:icmpping.last(0)}
    {HOSTNAME}
    ctrl-d
    
    1
    A423-1
    It is not safe and sure alex will don't like me for my hacks but mysticaly, it works we use it as external alerter script which substitutes macros in external files.
    Attached Files
  • Alexei
    Founder, CEO
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2004
    • 5654

    #2
    The idea is very good but I don't like this patch at all! It is clearly not a task of zabbix_server!
    Alexei Vladishev
    Creator of Zabbix, Product manager
    New York | Tokyo | Riga
    My Twitter

    Comment

    • limo
      Senior Member
      • Dec 2004
      • 192

      #3
      Originally posted by Alexei
      The idea is very good but I don't like this patch at all! It is clearly not a task of zabbix_server!
      Yes, you are absoulutely right! I do not like this patch too! But as I said it works for me and it was easiest way to achieve

      If you think idea is good so maybe it could look something like:

      Code:
      zabbix_cli [ --expand-stdin [ {--triggerid id} |  {--hostid id} | {--eventid id} ]  ]
      which would expand stdin to stdout
      Code:
      zabbix_cli [ --expand macro_name [ {--triggerid id} |  {--hostid id} | {--eventid id} ]  ]
      which would expand only one macro_name and return value to stdout.

      But maybe it would be easier and quicker to expand across tcp/ip port. So some server process could listen on some port (or use some protocol on same port) which would do only this translation with simple API.

      With regards,
      Lukas

      Comment

      • Alexei
        Founder, CEO
        Zabbix Certified Trainer
        Zabbix Certified SpecialistZabbix Certified Professional
        • Sep 2004
        • 5654

        #4
        I think that a command line utility would be the best solution for this and similar tasks.
        Alexei Vladishev
        Creator of Zabbix, Product manager
        New York | Tokyo | Riga
        My Twitter

        Comment

        • tronite
          Senior Member
          • Jun 2007
          • 147

          #5
          Originally posted by limo
          Hi to all,

          I just needed this so I made little patch. It is working for me, but it is more hack than real patch. I added commandline options to zabbix_server

          Code:
                 "  -n --new-nodeid <nodeid>    convert database data to new nodeid",
                 "  -e --expand-macros          expand macros on stdin and print to stdout",
                 "  -t --expand-macros-triggerid  <triggerid> for -e and simple_macros: triggerid",
          than you can use zabbix_server with parameter -e and -t :
          Code:
           ./zabbix_server  -e -t '19524' -c /etc/zabbix/zabbix_server_beta.conf
          {a423-1:icmpping.last(0)}
          {HOSTNAME}
          ctrl-d
          
          1
          A423-1
          It is not safe and sure alex will don't like me for my hacks but mysticaly, it works we use it as external alerter script which substitutes macros in external files.
          Well I am going to try this and by the looks of it, it is very nice work and I like it already, just thought you should know!

          Comment

          Working...