init III
This commit is contained in:
2
Perl OPC Messages/opc.conf
Normal file
2
Perl OPC Messages/opc.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
dest=10.10.30.78
|
||||
count=1
|
||||
15134
Perl OPC Messages/opc.log
Normal file
15134
Perl OPC Messages/opc.log
Normal file
File diff suppressed because it is too large
Load Diff
79
Perl OPC Messages/opc.pl
Normal file
79
Perl OPC Messages/opc.pl
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/bin/perl
|
||||
|
||||
#use strict;
|
||||
|
||||
my $hostname;
|
||||
my $mall;
|
||||
my @ausg;
|
||||
my %para;
|
||||
my $k;
|
||||
my $v;
|
||||
my @msg_in;
|
||||
my %OPC;
|
||||
my $txt;
|
||||
my @TEMP;
|
||||
my @DEST;
|
||||
my $count;
|
||||
my $host;
|
||||
my $i;
|
||||
my ($sekunden, $minuten, $stunde, $tag, $monat, $jahr, $wochentag, $tag_im_jahr, $ist_sommerzeit);
|
||||
|
||||
$hostname = `hostname`;
|
||||
chomp $hostname;
|
||||
$mall = "-m all";
|
||||
my $order;
|
||||
|
||||
foreach (@ARGV) {
|
||||
($k,$v)=split /=/,$_;
|
||||
$para{$k}=$v;
|
||||
}
|
||||
|
||||
open TAB, "<opc.tab" or die "$!";
|
||||
open CONF, "<opc.conf" or die "$!";
|
||||
|
||||
while ( <CONF> ) {
|
||||
if ( $_ =~ /count/ ) {
|
||||
@TEMP = split /=/, $_;
|
||||
$count = @TEMP[1];
|
||||
}
|
||||
if ( $_ =~ /dest/) {
|
||||
@TEMP = split /=/, $_;
|
||||
@DEST = (@DEST, $TEMP[1]);
|
||||
}
|
||||
}
|
||||
|
||||
while (<TAB>) {
|
||||
chomp;
|
||||
@msg_in = split /,/,$_;
|
||||
$OPC{$msg_in[0]}=$msg_in[1];
|
||||
}
|
||||
chomp %OPC;
|
||||
|
||||
$txt="$para{'T'}";
|
||||
open OUT, ">>opc.log";
|
||||
foreach $host(@DEST) {
|
||||
chomp $host;
|
||||
for($i=1;$i<=$count;$i++) {
|
||||
($sekunden, $minuten, $stunde, $tag, $monat, $jahr, $wochentag, $tag_im_jahr, $ist_sommerzeit) = localtime;
|
||||
if ($OPC{$para{"O"}}eq undef ) {
|
||||
printf(OUT "%4d-%02d-%02d %02d:%02d:%02d OPC-Message (%s) not defined or not found!\n",$jahr+1900,$monat+1,$tag,$stunde,$minuten,$sekunden,$para{'O'});
|
||||
if ($ENV{"OS"} eq "Windows_NT") {
|
||||
@ausg=`snmptrap $mall $host public .1.3.6.1.4.1.2222 $hostname 6 999 0 .1.3.6.1.4.1.0.2222 string "UNDEF_OPC_MSG:$OPC{$para{'O'}}"`;
|
||||
}
|
||||
else {
|
||||
@ausg=`snmptrap -c public $host .1.3.6.1.4.1.2222 $hostname 6 999 0 .1.3.6.1.4.1.0.2222 octetstring "UNDEF_OPC_MSG:$OPC{$para{'O'}}"`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ENV{"OS"} eq "Windows_NT") {
|
||||
@ausg=`snmptrap $mall $host public .1.3.6.1.4.1.2222 $hostname 6 $OPC{$para{"O"}} 0 .1.3.6.1.4.1.0.2222 string $txt`;
|
||||
}
|
||||
else {
|
||||
@ausg = `snmptrap -c public $host .1.3.6.1.4.1.2222 $hostname 6 $OPC{$para{"O"}} 0 .1.3.6.1.4.1.0.2222 octetstring $txt`;
|
||||
}
|
||||
printf(OUT "%4d-%02d-%02d %02d:%02d:%02d Send OPC-Message (%s %s) (%s) to %s\n",$jahr+1900,$monat+1,$tag,$stunde,$minuten,$sekunden,$para{'O'},$OPC{$para{'O'}},$txt,$host);
|
||||
#print OUT "Send OPC-Message ($para{'O'} $OPC{$para{'O'}}) ($txt) to $host\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
close OUT;
|
||||
43
Perl OPC Messages/opc.tab
Normal file
43
Perl OPC Messages/opc.tab
Normal file
@@ -0,0 +1,43 @@
|
||||
OMFailExecutor,800
|
||||
OMFAILDISK,801
|
||||
IRWARNDISK,900
|
||||
IRFAILDISK,901
|
||||
MOFAILGENDOFDAY,1000
|
||||
MOWARNGENDOFDAY,1001
|
||||
MONOTEENDOFDAY,1002
|
||||
MOFAILSQLERROR,1003
|
||||
MOFAILJOB,1004
|
||||
MOFAILDBS,1005
|
||||
MOWARNDBS,1006
|
||||
MOFAILPRICEIMPORT,1007
|
||||
MOWARNPRICEIMPORT,1008
|
||||
MONOTEPRICEIMPORT,1009
|
||||
MOFAILAPPL,1010
|
||||
MOWARNAPPL,1011
|
||||
MONOTEAPPL,1012
|
||||
MOFAILFILEOPENORDERS,1013
|
||||
MOFAILCEFOUT,1014
|
||||
MONOTECEFOUT,1015
|
||||
MOMCTRLPPING,1016
|
||||
MOMCTRLBPING,1017
|
||||
MOWARNKURS,2000
|
||||
MOFAILINTF,2001
|
||||
MOWARNDISK,2002
|
||||
MOFAILPROCESS,2003
|
||||
MOFAILPOLL,2004
|
||||
MOFAILDBPROCESSES,2005
|
||||
MOWARNDBPROCESSES,2006
|
||||
MOFAILMCPRI,2007
|
||||
MOFAILMCBACK,2008
|
||||
MOFAILLISTENER,2009
|
||||
MOWARNLISTENER,2010
|
||||
MOFAILINSTANCE,2011
|
||||
MOFAILDISK,2012
|
||||
MOLOWMEM,2013
|
||||
MOSTARTPROCESS,2014
|
||||
MOSTOPPROCESS,2015
|
||||
MOFAILMQSCHANNEL,2016
|
||||
MOWARNXO,2017
|
||||
MOERRXO,2018
|
||||
MOFAILXO,2019
|
||||
CEFLOG,3000
|
||||
2
Perl OPC Messages/opc2.conf
Normal file
2
Perl OPC Messages/opc2.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
dest=10.10.30.185
|
||||
count=1
|
||||
2143
Perl OPC Messages/opc2.log
Normal file
2143
Perl OPC Messages/opc2.log
Normal file
File diff suppressed because it is too large
Load Diff
79
Perl OPC Messages/opc2.pl
Normal file
79
Perl OPC Messages/opc2.pl
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/bin/perl
|
||||
|
||||
#use strict;
|
||||
|
||||
my $hostname;
|
||||
my $mall;
|
||||
my @ausg;
|
||||
my %para;
|
||||
my $k;
|
||||
my $v;
|
||||
my @msg_in;
|
||||
my %OPC;
|
||||
my $txt;
|
||||
my @TEMP;
|
||||
my @DEST;
|
||||
my $count;
|
||||
my $host;
|
||||
my $i;
|
||||
my ($sekunden, $minuten, $stunde, $tag, $monat, $jahr, $wochentag, $tag_im_jahr, $ist_sommerzeit);
|
||||
|
||||
$hostname = `hostname`;
|
||||
chomp $hostname;
|
||||
$mall = "-m all";
|
||||
my $order;
|
||||
|
||||
foreach (@ARGV) {
|
||||
($k,$v)=split /=/,$_;
|
||||
$para{$k}=$v;
|
||||
}
|
||||
|
||||
open TAB, "<opc.tab" or die "$!";
|
||||
open CONF, "<opc2.conf" or die "$!";
|
||||
|
||||
while ( <CONF> ) {
|
||||
if ( $_ =~ /count/ ) {
|
||||
@TEMP = split /=/, $_;
|
||||
$count = @TEMP[1];
|
||||
}
|
||||
if ( $_ =~ /dest/) {
|
||||
@TEMP = split /=/, $_;
|
||||
@DEST = (@DEST, $TEMP[1]);
|
||||
}
|
||||
}
|
||||
|
||||
while (<TAB>) {
|
||||
chomp;
|
||||
@msg_in = split /,/,$_;
|
||||
$OPC{$msg_in[0]}=$msg_in[1];
|
||||
}
|
||||
chomp %OPC;
|
||||
|
||||
$txt="$para{'T'}";
|
||||
open OUT, ">>opc2.log";
|
||||
foreach $host(@DEST) {
|
||||
chomp $host;
|
||||
for($i=1;$i<=$count;$i++) {
|
||||
($sekunden, $minuten, $stunde, $tag, $monat, $jahr, $wochentag, $tag_im_jahr, $ist_sommerzeit) = localtime;
|
||||
if ($OPC{$para{"O"}}eq undef ) {
|
||||
printf(OUT "%4d-%02d-%02d %02d:%02d:%02d OPC-Message (%s) not defined or not found!\n",$jahr+1900,$monat+1,$tag,$stunde,$minuten,$sekunden,$para{'O'});
|
||||
if ($ENV{"OS"} eq "Windows_NT") {
|
||||
@ausg=`snmptrap $mall $host public .1.3.6.1.4.1.2222 $hostname 6 999 0 .1.3.6.1.4.1.0.2222 string "UNDEF_OPC_MSG:$OPC{$para{'O'}}"`;
|
||||
}
|
||||
else {
|
||||
@ausg=`snmptrap -c public $host .1.3.6.1.4.1.2222 $hostname 6 999 0 .1.3.6.1.4.1.0.2222 octetstring "UNDEF_OPC_MSG:$OPC{$para{'O'}}"`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($ENV{"OS"} eq "Windows_NT") {
|
||||
@ausg=`snmptrap $mall $host public .1.3.6.1.4.1.2222 $hostname 6 $OPC{$para{"O"}} 0 .1.3.6.1.4.1.0.2222 string $txt`;
|
||||
}
|
||||
else {
|
||||
@ausg = `snmptrap -c public $host .1.3.6.1.4.1.2222 $hostname 6 $OPC{$para{"O"}} 0 .1.3.6.1.4.1.0.2222 octetstring $txt`;
|
||||
}
|
||||
printf(OUT "%4d-%02d-%02d %02d:%02d:%02d Send OPC-Message (%s %s) (%s) to %s\n",$jahr+1900,$monat+1,$tag,$stunde,$minuten,$sekunden,$para{'O'},$OPC{$para{'O'}},$txt,$host);
|
||||
#print OUT "Send OPC-Message ($para{'O'} $OPC{$para{'O'}}) ($txt) to $host\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
close OUT;
|
||||
Reference in New Issue
Block a user