Need help with code...

Paul L. Allen pla at softflare.com
Sat Apr 16 00:17:30 CEST 2005


Rob Wirtz writes: 


> serial loopback connector connected to the siren output on my alarm with a
> normally closed relay.  The idea is that the loopback connector will be
> wired across a normally closed relay, completing the loop.  If an alarm
> condition occurs with the security system, tripping the siren will also 
> trip the relay, interrupting the serial loopback

Seems unnecessarily complicated, and resource consuming, to continuously
send a data stream and monitor that it comes back OK.  Most people would
stick the relay on one of the control lines like DTR or CTS which set
flags depending upon presence or absence. 

> connected to one of my Windows servers.

Ah, forget I said anything.  Windows probably doesn't let you get at the
control lines any more.  Not easily, anyway.  Checking the "fire" button
on the games port may (or may not) be a simpler task under Windows. 

> The problem is, I am not a programmer.  I know it should only take 5-10
> lines of code to accomplish what I need.  What I would like is a small
> program that transmits arbitrary data across the serial loopback
> connection. If that connection is broken, then a file like "alarm.txt" 
> will be written to the hard drive.   Using the Check_nt pluigin to check
> for the presence of this file will cause Nagios to send email and page 
> alarms.

Doing all that in 5-10 lines of code?  I doubt it.  You could probably
detect a change on DTR or CTS in 5-10 lines of code (using a reasonably
"compact" language like perl, on a decent OS like Linux).  Doing what you
want on Windows is likely to be a little more complex.  Oh, and if you use
MS programming tools then you can expect the binary to be about 2M in size
even if there are only 5-10 lines of code (c.f., regedit which could be
squeezed into a binary of around 100K but because of the cruft the MS tools
drag in - unless you explicitly tell them not to - ends up around 2M). 

-- 
Paul Allen
Softflare Support 




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list