Ad Widget

Collapse

Allow specific command only using AllowKey parameter (Ex: AllowKey=[echo *])

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RaulChiarella
    Member
    • Apr 2021
    • 59

    #1

    Allow specific command only using AllowKey parameter (Ex: AllowKey=[echo *])

    Hello

    I created the parameter "AllowKey=system.run[echo *]" on a Zabbix Agent config file and tested using "zabbix_get -s 127.0.0.1 -k system.run["echo 'Test ' >/tmp/test.txt"]"
    It worked...

    But when i went to Zabbix Server and created a script and a action with the same command on the same host, i got the message "Unsupported item key" on the actions column!
    If i change the parameter to "AllowKey=system.run[*]" the action works...

    But i do not want to allow all commands. Just the ones i specify in the config file!
    Can someone help me?

    Thanks
  • tim.mooney
    Senior Member
    • Dec 2012
    • 1427

    #2
    Have you considered using Zabbix's UserParameter feature, instead? It allows you to define custom items that can accept multiple item parameters (if needed), and it works sort of like 'system.run' but allows you to control the commands being run.

    The only real disadvantage to UserParameter's is that you need to have a configuration in place on the client, defining the UserParameter. This is easy to do, though, especially if you have a fixed group of UserParameters that are used on most of your clients, or if you have any kind of system automation or configuration management that can deploy a simple text file to a set of clients.

    My site uses UserParameters instead of system.run, and I personally think it's a better way to go in most scenarios.

    Comment

    • RaulChiarella
      Member
      • Apr 2021
      • 59

      #3
      Hello. Yes i do use UserParameters on some cases but since this is a simple echo command i believe it would be faster and easier to just use AllowKey instead...
      I am leaving AllowKey=system.run[*] for now but if you or someones knows how can i allow only specific commands i will be glad to know how to do it, using AllowKey!

      Thanks.

      Comment

      • RaulChiarella
        Member
        • Apr 2021
        • 59

        #4
        tim.mooney Hey, do you know how can I allow a specific UserParameter in AllowKey? I created a UserParameter that restarts a service, but I am getting the error "Key access denied: "system.run["restartService[SysMain]",nowait]"" when using it on a Trigger Action. I want to allow that specific UserParameter only.. I see that I asked this previously, but I still don't know how to do it.

        Thanks. I tried AllowKey=system.run["restartService[*]"] but I still did'nt test it tho. Will test and return here.

        Edit: I tested the Trigger Action after adding AllowKey=system.run["restartService[*]"] to my config file, and it did'nt work, I still received the error listed above.
        Last edited by RaulChiarella; 23-07-2024, 18:22. Reason: Tested the AllowKey command and it did'nt work.

        Comment

        Working...