salut j'ai un scripte pour executer depuis php pour ajouter un hote dans switch.cfg de nagios je lance le formulaire et le code passe bien dans le php mais rien se passe dans le switch cfg
c'est le shell
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash 
#if [ $# -ne 5 ] ;then 
# echo "5 parametres attendu [NOM] [IP] [PARENT] [NOM GROUP] [CONTACT]" 
#else 
echo " 
########################## 
define host{ 
use generic-host 
host_name $1 
parents $2
alias $3 
address $4  
event_handler 	update-nagex-host 
hostgroups $5 
} 
" >> /etc/nagios3/switches/switch.cfg 
/etc/init.d/nagios3 restart 1>/dev/null 
#fi
et mon scripte php
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php 
if(isset($_POST['btCreer'])) 
{ 
$a=$_POST['nom']; 
$b=$_POST['ip']; 
$c=$_POST['parent']; 
$d=$_POST['groupe']; 
$e=$_POST['alias']; 
exec("/var/www/add.sh",$a,$b,$c,$d,$e); 
echo'Machine Ajoutee 
<META HTTP-EQUIV="refresh" CONTENT="2;URL=ajout.php">'; 
} 
else { 
echo'<form action="ajout.php" method="post"> 
Ajout d\' une nouvelle machine<br /><br /><br />'; 
echo'Nom de la machine: <input type="text" id="nom" name=nom"> 
<br /><br /> 
Adresse IP: <input type="text" id="ip" name="ip"> 
<br /><br /> 
Parent: <input type="text" id="parent" name="parent"> 
<br /><br /> 
Groupe: <input type="text" id="groupe" name="groupe"> 
<br /><br /> 
alias: <input type="text" id="contact" name="alias"> 
<br /><br /> 
<input type="submit" value="Creer" id="btCreer" name="btCreer" onclick="return confirmjs();" /> 
</form>'; 
} 
?>
Merci en avance