I created a simple bash script and a verification command :
/usr/lib/centreon/plugins/test2.sh
For the test i tried :
chmod 777 test2.sh
chown centreon:root test2.sh
Manuelly the script works with centreon user but he doesn’t when i try by centeon gui.
Page 1 / 1
Hello @akhethan,
It is the ‘centreon-engine’ user that execute your commands. What is the error command on the Web interface ?
Regards.
i tried too : chown centreon-engine:root test2.sh
this is my command
the error command in on web interface is :
(No output returned from plugin)
this is normal because it is a test script which does not return anything, normally if the script is executed there should be a file created. here is my test script :
#!/bin/bash NOW=$(date +"%m-%d-%Y") RAND=$N 1 + $ RANDOM % 100000 ]] echo test >> "temp.$NOW.$RAND"
What happen when you exectute the following command ?
su - centreon-engine -s /bin/bash -c <Path of your script>
if I run the command:
su - centreon-engine -s /bin/bash -c /usr/lib/centreon/plugins/test2.sh
the script is launched and the word test is displayed on the screen, however this does not create the file and that is what interests me.
here are the rights to the plugins directory :
moreover I have just tested the same command with the root user and I have the same result, on the other hand if I place myself in the directory and that I execute the script in root it works
Solved !
I found my mistake and it's not centreon's fault but me, in my script I ask to create a file and you had to put the full path
I wanted to thank you because it is thanks to your help that I found.