trap

WinSNMP v1traps

I'm using WinSNMP in c++ to send snmp traps. For backwards compatibility I’m required to send v1 snmp traps. WinSNMP works with v2 traps but is capable of converting those v2 traps to v1 when sending the trap. I use SnmpSetTranslateMode(SNMPAPI_UNTRANSLATED_V1) in order to do that. I also added the sysUpTime oid (1.3.6.1.2.1.1.3.0), the ...

Zenoss trap issue

We are having an issue getting Zenoss to return a 'clear' notification on 'linkUp' traps. We know that the trap is being sent to Zenoss. ...

What's the most insidious way to pose this problem?

My best shot so far: A delivery vehicle needs to make a series of deliveries (d1,d2,...dn), and can do so in any order--in other words, all the possible permutations of the set D = {d1,d2,...dn} are valid solutions--but the particular solution needs to be determined before it leaves the base station at one end of the route (imagine t...

Ruby, windows, active_record, and Control-C

What is active_record doing to the signal processes under windows (I don't see this with the same versions on the mac) that causes it to behave so strangely? For instance: require 'rubygems' trap("INT"){puts "interrupted"} puts __LINE__ sleep 5 require 'active_record' trap("INT"){puts "interrupted again"} puts __LINE__ sleep 5 When I...

Why does active_record break the behavior of Ruby's trap and how do I work around it?

In the last couple of days, I've been trying to get a solution to an active_record issue that has been plaguing me. Posts on railsforum and stackoverflow have turned up completely dry. The length and level of detail in those posts may have dissuaded commentors, so I'm trying again - in brief. Under windows, the trap behavior is normal...

Is it possible to implement a `trap' for GNU make

I'm wondering if there's a way to implement the similar functionality as you get in bash scripts using `trap', but for gmake, such that if the user presses CTRL-C, or if make itself fails, it can call a particular target or macro. ...

How not to run into the intellectual property trap on a daily basis?

I found a lot of questions and answers about how to protect yourself from the so called bad boys/ IP thieves and how to enforce rights. As a BSD guy myself I'm not particular interested in this and I somewhat want to turn the question around and ask exactly the opposite: How do you protect yourself from getting sued? In theory the answe...

KeyDown/KeyPress and Indexing

Hi everyone. Compelete noob working on my first app in C#. Here is what I am trying to do.... A user is going to enter an "ID" into a text box, all numbers. I have been trying to figure out how to trap a leading zero in the ID, for instance: 5031 is accepteble for ID 0827 not what we want Basically, zero cannot be the leading number i...

What are the child OIDs in an SNMP trap?

I have inherited a MIB and example documentation, and need to re-implement the code that generates traps. (For various reason the original code is lost and gone forever, but CM is not my question.) The MIB says: alertObjects OBJECT IDENTIFIER ::= { corpAlert 1 } alertEvents OBJECT IDENTIFIER ::= { corpAlert 2 } alertDispa...

How do I trap windows key, alt+tab, ctrl+alt+delete in C#?

How do I trap Windows key, Alt+Tab, and Ctrl+Alt+Delete in a Windows application using C#? ...

Powershell trap not being triggered consistently.

I can't understand why I'm seeing this behavior in Powershell: PS C:\> trap { "Got it!" } 1/0 Attempted to divide by zero. At line:1 char:22 + trap { "Got it!" } 1/0 <<<< PS C:\> trap { "Got it!" } 1/$null Got it! Attempted to divide by zero. At line:1 char:22 + trap { "Got it!" } 1/$ <<<< null Why does one expression trigger the tra...

Custom SNMP Trap Implementation in .Net

I need to create a monitoring mechanism using SNMP (in .Net). I think we'll be using an nsoftware component to handle most of the work. It appears we must use 'traps' to communicate from the agent to the server. We'll have a number of different traps and various information detailing each trap. What is the best way to implement cust...

bash trap of TERM - what am I doing wrong?

Given this hack.c program: #include <stdio.h> main() { int i=0; for(i=0; i<100; i++) { printf("%d\n", i); sleep(5); } } and this hack.sh bash script: #!/bin/bash ./hack If I run hack.sh, two processes get created - one for bash, one for the C task. If a TERM signal gets sent to the bash process, the C process is unharmed....

How to trap a PHP script error which dies (Perl has eval)?

Hi I've got a script which works fine on our development server but dies on the clients server. error_reporting(E_ALL); if (function_exists('simplexml_load_file')) echo "function exists"; if (file_exists('test.xml')) { echo("<hr>just about to read local xml file :".__LINE__); $xml = simplexml_load_file('test.xml'); // dies here In ...

How can I trap the unknown cause of a Javascript popup?

I am debugging someone else's web page. There is a link on it which tries to open itself in a popup window, the reason for this is unclear -- there is nothing obvious in the HTML (onclick=foo) to cause this. Disabling JavaScript means the link opens normally. I have Firefox/Firebug/Dom Inspector and would like to trap whatever JavaScrip...

kernel software trap handling

I'm reading a book on Windows Internals and there's something I don't understand: "The kernel handles software interrupts either as part of hardware interrupt handling or synchronously when a thread invokes kernel functions related to the software interrupt." So does this mean that software interrupts or exceptions will only be handled...

traping shell exit code

Hi there, I am working on a shell script, and want to handle various exit codes that I might come across. To try things out, I am using this script: #!/bin/sh echo "Starting" trap "echo \"first one\"; echo \"second one\"; " 1 exit 1; I suppose I am missing something, but it seems I can't trap my own "exit 1". If I try to trap 0 every...

C++: Continue execution after SIGINT

Okay, I am writing a program that is doing some pretty heavy analysis and I would like to be able to stop it quickly. I added signal(SIGINT, terminate); to the beginning of main and defined terminate like: void terminate(int param){ cout << endl << endl << "Exit [N]ow, or [A]fter this url?" << endl; std::string answer; cin >> ...

Is it possible to detect *which* trap signal in bash?

Hello,when using something like trap func_trap INT TERM EXIT with func_trap () { ...some commands... } is there a way in the function block to detect which trap has called it? Something like func_trap () { if signal = INT then do this else do that fi } Or do I need to write a seperate function for each trap typ...

How to send a signal SIGINT from script to script ? BASH

I want to trap a signal send from Script-A.sh to Script-B.sh so in Script-A.sh i use the command (Send SIGINT to Script-B.sh) kill -2 $PID_Script-B.sh And in Script-B.sh i catch the signal and call function Clean trap 'Clean' 2 It does not work, instead the Script-B.sh is killed right away without per...