Solution of error with Detect operating system in Zabbix

The standard “Detect operating system” script does not work in Zabbix, when trying to execute it, the “sudo: no tty present and no askpass program specified” error appears, so for its operation it is necessary to take several actions.

The first is to install nmap:

apt-get install sudo nmap

The second is to allow the user of Zabbix to run nmap, for this open the file /etc/sudoers in any editor, for example nano:

sudo nano /etc/sudoers

and add the following line to it:

zabbix  ALL=(root) NOPASSWD: /usr/bin/nmap

or you can not open it in the editor, but execute the command:

sudo echo "zabbix  ALL=(root) NOPASSWD: /usr/bin/nmap" >> /etc/sudoers

After these manipulations, the script should work, determine the operating system, show the list of open ports, etc.