Hello,
my idea was to change the background of a map dynamically so I can display any picture without dealing with php or whatever.
In my example I have a map with the europe background to see the status of variuos links. I want to change it with the satellite images so I can check the weather at the same time ;-)
Let's assume we have a map in table 'graphs' having id 21.
I have first created a batch file that get the picture I want by using wget, then I call a perl script to update the table.
The perl script is this:
#!/usr/bin/perl
use DBI;
our $dbh = DBI->connect('DBI:mysql:zabbix:localhost',
'zabbix', #user name
'yourpassword', #password
{ RaiseError => 1 });
my $sth= $dbh->prepare("UPDATE images SET image = ? WHERE imageid = 21");
open(my $fh, '/root/grande.gif' ) or die $!;
read( $fh, $var, -s $fh );
$sth->execute($var);
$sth->finish;
$dbh->disconnect;
Please note the '21' for the id and substitute the /root/grande.gif with the path of the 'wgetted' image.
Just cron the batch and you can see the picture changing every time you want.
my idea was to change the background of a map dynamically so I can display any picture without dealing with php or whatever.
In my example I have a map with the europe background to see the status of variuos links. I want to change it with the satellite images so I can check the weather at the same time ;-)
Let's assume we have a map in table 'graphs' having id 21.
I have first created a batch file that get the picture I want by using wget, then I call a perl script to update the table.
The perl script is this:
#!/usr/bin/perl
use DBI;
our $dbh = DBI->connect('DBI:mysql:zabbix:localhost',
'zabbix', #user name
'yourpassword', #password
{ RaiseError => 1 });
my $sth= $dbh->prepare("UPDATE images SET image = ? WHERE imageid = 21");
open(my $fh, '/root/grande.gif' ) or die $!;
read( $fh, $var, -s $fh );
$sth->execute($var);
$sth->finish;
$dbh->disconnect;
Please note the '21' for the id and substitute the /root/grande.gif with the path of the 'wgetted' image.
Just cron the batch and you can see the picture changing every time you want.
Comment