Random Project

works well

After converting it to english and to the right text format by making a new file and copy and pasting code into it, it worked.

past this into /etc/sudoers:
nagios ALL=(ALL) NOPASSWD:/usr/bin/virsh list

and uncomment the line:
Defaults requiretty

to run command, type:
./check_virsh srv “virtual machine name”
example: ./check_virsh srv server1.example.com