E-mail Notification
-
You don’t need create a new query to know the hostname. Probably, the fog script knows the hostname, it is necesary to change it when you download an image. Check the PXE file to know it.
Then, you can change the web service call:
[CODE]wget -q -O /tmp/co.txt “http://${web}service/Post_Stage3.php?mac=$mac&imgid=$imgid&hostname=$hostname” &>/dev/null[/CODE]
Capture the hostname in the Post_Stage3.php file:
[PHP]$hostname = $_GET[“hostname”];[/PHP] -
of course!! thank you, as I say stupid mental block! lol
-
This post is deleted! -
this didn’t work hostname is blank
-
want to try and avoid writing a new query but unless you got any other idea?.. thanks for the help btw
-
[quote=“Lee Rowlett, post: 12364, member: 28”]this didn’t work hostname is blank[/quote]
What is the reason to be blank? The PXE file hasn’t the hostname, the fog script not get the $hostname or the $_GET variable is empty?
-
The PXE file hasn’t the hostname
-
There is the problem You can solve it easily.
When you create a task, the webUI calls to tasks.confirm.include.php ( you can locete it in WEBROOT_DIRECTORY/fog/management/includes/ ). This php file creates the PXE file depending the tasks type. For example, to create a multicast download task, the tasks.confirm.include.php calls to :
[PHP]$taskid = createImagePackageMulticast($conn, $imageMembers[$i], $taskName, $port, $tmp, (!empty($_GET[“debug”]) && $_GET[“debug”] == “true” ), true, $shutdown, $imageMembers[$i]->getKernel(), $other , (empty($bashscript)? “”:$bashscript), $type, $taskPCT);[/PHP]
This function uses the [B][I]$other[/I][/B] variable to setup the hostname, check if this variable has setup the hostname.
-
Hi,
nice thread very interesting, @Lee do you have it working now?
Can you post a little overview of what u’ve done please?Greetz X23
-
[quote=“x23piracy, post: 12383, member: 3982”]Hi,
nice thread very interesting, @Lee do you have it working now?
Can you post a little overview of what u’ve done please?Greetz X23[/quote]
yes this would be very useful if you could share an overview, maybe if you could post it in the tutorial section?
-
Hi,
i have got it working but had to write a seperate query to get hostname. it is hard to write a step by step as you can customize it to however you want and use any mail protocol, i am using sendmail/mailutils - below is what i did.
edit the file …/fog/service/Post_Stage3.php
just before line: echo “##”; write you’re mail function i.e.
if ( checkOut( $conn, $jobid ) )
{
[B]mail(“emailaddress@tosendto”,“$hostname - Image Task Completed”, “$hostname has been successfully imaged”);[/B]
echo “##”;// Now update the imaging log.
@logImageTask( $conn, “e”, $hostid );if you would like to get the hostname in the email - you have to include this, it is another query and there may be a cleaner way to do this but for now put this anywhere before the if statement put…
$hst = “SELECT hostName FROM hosts WHERE hostID like '”.$hostid.“'”;
$res1 = mysql_query( $hst, $conn ) or die( mysql_error() );
$ar1 = mysql_fetch_object($res1);
$hostname = $ar1->hostName;optional:
on the server install sendmail/mailutils
apt-get install sendmail
apt-get install mailutilsrecommend stopping sendmail running a daemon.
hope this helps
…thanks for the guidance Fernando
-
-
Hi,
something about this ? Is it in the last version of fog ?
thx -
It’s added.
-
hi,
I was searching for that option and I realised that I was not in the same last version… I was in the 1.2.0 and not in the svn version. I m now in 1.2.0 version 3118 and I see a section “Fog Email Settings”. I think it s that but how does it work ?
The package has been installed but i m not receiving mails…
apt-get install sendmail
apt-get install mailutilsthx
-
Do you see any errors in your apache log files when mail is being sent? I guess you need to configure smart host with sendmail… [url]https://www.dnsexit.com/support/mailrelay/sendmail.html[/url]