Ad Widget

Collapse

need privilege inside agent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • frater
    Senior Member
    • Oct 2010
    • 340

    #1

    need privilege inside agent

    I've been busy with this script.


    It works, but it isn't sufficient.
    I'm monitoring a server which is also running apache with virtual-hosting.
    This server sometimes has ill-behaving websites on it and it's always a lot of work to find out who's the culprit.
    If a process is using a lot of CPU I want it to list the process (the full process name). This is working alright, but it isn't enough info.
    I need the files that are open at that moment.

    I'm using lsof for it. I spent a lot of time tweaking the command so it will not burden the server even more. An lsof for only the process ID and letting it only list the fields I really need was my focus.
    I thought it was working well, but I was still not getting the right info into zabbix. I thought it had some strange characters, but in the end I found out my 'lsof' just didn't have enough privilege to show me the open files being used by that process......


    What is the most elegant way to get the zabbix_agent to run lsof with root privileges? Should I make a wrapper?
    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP
  • frater
    Senior Member
    • Oct 2010
    • 340

    #2
    I never really looked into /etc/sudoers, but it was easier than I thought.
    It seems I can give the user zabbix permission to use lsof with root privileges without any password....

    Code:
    echo zabbix ALL = NOPASSWD: `which lsof` >> /etc/sudoers
    Zabbix agents on Linux, FreeBSD, Windows, AVM-Fritz!box, DD-WRT and QNAP

    Comment

    Working...