Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- use DBI;
- my $data_source = "DBI:mysql:zabbix";
- my $username = "";
- my $password = "";
- my $graph_name = "DiskUsage";
- my @recs = ();
- eval {
- my $dbh = DBI->connect($data_source, $username, $password,
- {RaiseError => 1, PrintError => 0});
- my $sql = "SELECT graphid FROM graphs WHERE name = ?";
- my $sth = $dbh->prepare($sql);
- $sth->execute($graph_name);
- while (my $rec = $sth->fetchrow_arrayref) {
- push(@recs, $rec->[0]);
- }
- $sth->finish;
- $dbh->disconnect;
- };
- die "Error : $@\n" if ($@);
- print join(", ", @recs), "\n";
Add Comment
Please, Sign In to add comment