Ad Widget

Collapse

A little help please about running scripts on linux though an Agent !

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whiz_kid_uk
    Junior Member
    • Jul 2024
    • 2

    #1

    A little help please about running scripts on linux though an Agent !

    I am very new at using zabbix, and trying to learn what is quite a large subject, however I have an issue that I need some help with please.

    I have a zabbix server, a proxy and an agent. Zabbit is 6.5, proxy is the same and so is the agent that is installed on Ubunutu.

    The Zabbix server connects to the proxy, and can communicate, the proxy can connect to the agent (On kali) and server and communicate.

    The issue I am having whilst testing is I have created a web scenario to monitor if Greenbone community server is available (GVM), If its not available then I want it to run a script to update and then start GVM.

    Normally to update GVM I type greegreenbone-feed-sync
    Normally to start GVM I type gvm-start.

    I thought I could create a script with the following contents :

    sudo greegreenbone-feed-sync
    sudo gvm-start

    I manually execute the script from zabbix and I get the following in the zabbix screen along with the below extract of the log

    Feebback from Zabbix
    sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
    sudo: a password is required

    log file
    730084:20240706:103306.069 Executing command '/etc/zabbix/gvmstarter.sh'
    730082:20240706:103355.657 Executing command '/etc/zabbix/gvmstarter.sh'


    I have upped the server timeout and agent timeout to 30 s. So The agent does try and run it bit the "sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
    sudo: a password is required​ " - Is confusing me.

    Any help would be appreciated.

    Jez
  • NgRox
    Member
    • Jun 2022
    • 44

    #2
    Hi,

    you can create a trigger and an action, this action will execute an action when the trigger alarms:


    The action performed can be commands/scripts, calmly, the issue is that the zabbix user does not have permission to execute this command, and when you execute it with sudo, it requests a password. What you can do is give permission for the zabbix user to run gvm-start without needing sudo in the command, or you can make the zabbix agent start as root (I don't recommend much).

    The error in the log is basically that the command with "sudo" is executed and waits for the password that will never be entered, then gives a time of 30 seconds (timeout limit) and then returns this TIMEOUT in the log.

    Greetings

    Comment

    Working...