summaryrefslogtreecommitdiff
path: root/ats-watch/ats-watch.pl
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-02-24 20:30:27 +0100
committerChristian Pointner <equinox@spreadspace.org>2015-02-24 20:30:27 +0100
commitaf128458b65c6181794939eca626fdd9e75a6732 (patch)
treea5647534284b22a84b8e2f4d55471bc94be22463 /ats-watch/ats-watch.pl
parentmoved dolmetsch-ctl to new repo avr-projects (diff)
moved ats-watch to avr-projects repo at git.helsinki.at
Diffstat (limited to 'ats-watch/ats-watch.pl')
-rwxr-xr-xats-watch/ats-watch.pl42
1 files changed, 0 insertions, 42 deletions
diff --git a/ats-watch/ats-watch.pl b/ats-watch/ats-watch.pl
deleted file mode 100755
index f374295..0000000
--- a/ats-watch/ats-watch.pl
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use Device::SerialPort;
-use Mail::Sendmail;
-
-my $port = new Device::SerialPort("/dev/ats-watch");
-$port->baudrate(38400);
-$port->parity("none");
-$port->databits(8);
-$port->stopbits(1);
-$port->handshake("none");
-$port->read_const_time(500);
-$port->read_char_time(5);
-$port->write_settings;
-
-$port->lookclear;
-$port->write("s");
-
-my %mail = ( To => 'logs@helsinki.at',
- From => 'noreply@helsinki.at',
- );
-
-while(1) {
- my ($count, $line) = $port->read(100);
- if($count > 0) {
- if($line =~ /Status: (\w+), Input (\w) is selected \(A: (\w+), B: (\w+)\)/) {
- my $state = $1;
- if($3 ne 'Online' && $4 ne 'Online') {
- $state = 'critical';
- } elsif($3 ne 'Online' || $4 ne 'Online') {
- $state = 'degraded';
- }
- $mail{Subject} = "[ATS-Watch] PDU0 state $state";
- $mail{Message} = "Current State: $1\n" . "Current Input: $2\n" . "Input A: $3\n" . "Input B: $4\n";
- } else {
- $mail{Subject} = '[ATS-Watch] PDU0 state unknown';
- $mail{Message} = $line;
- }
- sendmail( %mail ) or print $Mail::Sendmail::error . "\n";
- }
-}