Ad Widget

Collapse

how zabbix agent is running shell commands?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • reallove
    Junior Member
    • Feb 2010
    • 14

    #1

    how zabbix agent is running shell commands?

    Hello,
    I have a bit of concern the way system.run is executing commands on the agent, and also how the command defined by the UserParameter runs...here are the details...
    I am using the zabbix-agent package from the Debian lenny repositories. Upon installation, it creates a system user 'zabbix' with the shell /bin/false.
    Next, I want Zabbix to execute a command on the agent, /sbin/iptables. I've created in zabbix agent conf a custom user-defined monitored parameter (UserParameter), and then add the item on the server. I added a sudoers line, so zabbix can execute /sbin/iptables...and surprisingly it works.
    My question is, how is zabbix executing the command, since it has no shell defined in /etc/passwd? If I su zabbix -c command, it doesn't work. How is then zabbix able to execute it?
    Thanks, I hope my question makes sense.
  • nelsonab
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Sep 2006
    • 1233

    #2
    It has nothing to do with your current shell, or the shell of the Zabbix user. I would have to look at the source but I'm willing to bet /bin/sh is called by the exec() library function call, which in turn is passed the subsequent command. This is likely hard coded and cannot be changed without recompiling the agent. This is pretty standard in the Unix world.
    RHCE, author of zbxapi
    Ansible, the missing piece (Zabconf 2017): https://www.youtube.com/watch?v=R5T9NidjjDE
    Zabbix and SNMP on Linux (Zabconf 2015): https://www.youtube.com/watch?v=98PEHpLFVHM

    Comment

    • reallove
      Junior Member
      • Feb 2010
      • 14

      #3
      nelsonab, thanks, this sounds about right.

      Comment

      Working...