Find the answer to your Linux question:
Results 1 to 3 of 3
Hi, I am using Zabbix to monitor our production environments. One of these environments is an array of VPSs (not maintained by us but to which I do have root ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    May 2010
    Posts
    23

    monitoring beancounters - or run single command as root


    Hi,

    I am using Zabbix to monitor our production environments. One of these environments is an array of VPSs (not maintained by us but to which I do have root access).
    I am trying to monitor data from the /proc/user_beancounters file which contains OpenVZ related counters.
    Anyway in the Zabbix config I am to place something that looks like:
    Code:
    UserParameter=beancounters.tcpsndbuf.failcount,cat /proc/user_beancounters | grep tcpsndbuf | tr -s ' ' | cut -d' ' -f7
    but when the Zabbix agent attempts to run the command it fails since as it turns out /proc/user_beancounters has only read access for root while the zabbix agent is running under (believe it or not) user zabbix.
    I tried various methods using sudo and su to get this running. I'd rather not to have to resort to that at all since that would mean using root password in the config file, but that is another story.

    Anyway, nothing works... anyone got an idea either how to get the beancounter data using zabbix, or to help me get su to do the trick (without user interaction of course)?

    Cheers,
    DB

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,227
    Wrap the commands in a script,
    set it executeable and readable by root
    and then set up sudo to allow the user zabbix to execute this one command without password.
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    May 2010
    Posts
    23
    Thanks Irithori,

    Can you please point me to the right config line I need to put in sudoers file to enable this?

    And BTW, why does it need to be a shell script? Why can't I just do the following?
    Code:
    UserParameter=command.name,sudo myCommand
    Reason I'm asking is that when I tried using sudo before it gave me weird results. It tried to run some of the command parameters separately or something like that. Maybe it simply can't be done in some cases? But if that's true, in which cases?

    Cheers,
    DB
    Last edited by devboy; 11-03-2010 at 03:07 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •