This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
#!/bin/perl
use strict;
use mysql;
use CGI qw(:standard);
my $ind = param('ind');
my $akt = param('akt');
my $deakt = param('deakt');
my $dbh = DBI->connect("DBI:mysql:database=c2;host=localhost",'root','', {RaiseError => 1});
print header();
print "<html>\n";
print "<head>\n";
print "<style type='text/css'>\n";
print "select { font-size:8pt }\n";
print "</style>\n";
print "</head>\n";
print "<body>\n";
print "<b><u>Todo aktivieren/deaktivieren</u></b><br><br>\n";
if ($ind eq "") {
my $sth = $dbh->prepare("select ind,t_host,t_service,t_check,t_alert,t_description from todos order by 'ind'");
$sth->execute;
print "<table>\n";
while (my $ref = $sth->fetchrow_arrayref()) {
print "<form action='chg_todo.pl'>\n";
print "<tr>\n";
print "<td><input type='hidden' name='ind' value='$ref->[0]'></td>\n";
#HOST
my $sth_host = $dbh->prepare("select hostname,ip from hosts where ind='$ref->[1]'");
$sth_host->execute;
while (my $ref_host = $sth_host->fetchrow_arrayref()) {
print "<td><input type='text' readonly value='$ref_host->[0] ($ref_host->[1])'></td>\n";
}
#SERVICE
my $sth_desc = $dbh->prepare("select distinct description from services where service_ind='$ref->[2]'");
$sth_desc->execute;
while (my $ref_desc = $sth_desc->fetchrow_arrayref()) {
print "<td><input type='text' readonly value='$ref_desc->[0]'></td>\n";
}
#CHECK
my $sth_check = $dbh->prepare("select description from checks where ind='$ref->[3]'");
$sth_check->execute;
while (my $ref_check = $sth_check->fetchrow_arrayref()) {
print "<td><input type='text' readonly value='$ref_check->[0]'></td>\n";
}
#ALERT
my $sth_alert = $dbh->prepare("select description from alerts where ind='$ref->[4]'");
$sth_alert->execute;
while (my $ref_alert = $sth_alert->fetchrow_arrayref()) {
print "<td><input type='text' readonly value='$ref_alert->[0]'></td>\n";
}
#DESCRIPTION
print "<td><input type='text' readonly value='$ref->[5]'></td>\n";
print "<td><input type='submit' name='akt' value='aktivieren'></td>\n";
print "<td><input type='submit' name='deakt' value='deaktivieren'></td>\n";
print "</tr>\n";
print "</form>\n";
}
print "</table>\n";
}
else {
#$dbh->do("delete from todos where ind='$del'");
if ($akt eq "aktivieren") {
$dbh->do("update todos set t_active = '1' where ind ='$ind'");
print "<br>Todo aktiviert!\n";
}
if ($deakt eq "deaktivieren") {
$dbh->do("update todos set t_active = '0' where ind ='$ind'");
print "<br>Todo deaktiviert!\n";
}
}
print "</body>\n";
print "</html>\n";