Sponsored Content
Full Discussion: trouble with snmpwalk script
Top Forums UNIX for Dummies Questions & Answers trouble with snmpwalk script Post 302530373 by chancho on Monday 13th of June 2011 11:34:50 PM
Old 06-14-2011
I made a new script that uses the dhcp lease time to determine whether there is a new device connected to the network. Works very quickly. I have it running on my desktop with Geektool.

Code:
#! /bin/bash
#This script monitors local network via snmp
# accesslist is a txt file that sed uses to change the MAC addresses into the device name
# it notifies me via growl and displays with geektool
d=$(snmpwalk -v 2c -c publicpassword -M /usr/share/snmp/mibs:$HOME/share/mibs -m+AIRPORT-BASESTATION-3-MIB 10.0.1.1 dhcp \
| sed -f /Users/user/Documents/bin/accesslist \
|sed 's/AIRPORT-BASESTATION-3-MIB::dhcpLeaseTime.//' | awk ' $4 >= 1036600 { print $1 }')
if [ ! -n "$d" ] ; then
echo "No New Connections"
else
echo " "$d" has renewed
it's lease"
        if [ "$d" -ne ""iPhone"" ]
        then
growlnotify  -m " "$d" has just renewed it's lease" -a "Airport Utility" -n "NetWatch" -t "New DHCP Lease"
fi
fi
# I don't want a notification every time my iphone's display wakes up. it reconnects to the wifi so I added a second if statement

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

trouble with script

I'm having a little trouble finishing up this script any help would be great. My system is SCO OpenServer Enterprise System (ver 5.0.5m) and i'm using sh This script checks todays date and goes and downloads a file with yesterdays date in the name. ---start---- Server="ipaddresshere"... (4 Replies)
Discussion started by: whegra
4 Replies

2. UNIX for Advanced & Expert Users

snmpget/snmpwalk for dskPercent not working.

snmpwalk -v1 -c myname {ip address} dskPercent. Error in packet Reason: (noSuchName) There is no such variable name in this MIB. Failed object: UCD-SNMP-MIB::dskPercentNode snmpget -v1 -c myname {ip address} dskPercent.1 Error in packet Reason: (noSuchName) There is no such variable... (0 Replies)
Discussion started by: ynilesh
0 Replies

3. Solaris

Net-SNMP v5.4 - sub-id not found in log, but can query with snmpget and snmpwalk

Hi everyone, I'm configuring Net-SNMP v5.4 on Solaris 10, sending traps to OpenNMS 1.2.9-0.20061212.0. I'm setting up disk monitoring (% of space free) for 5 directories. Here's what I'm working with: (snmpd.conf - disk and monitoring portions) # # Disk Usage monitoring: # disk / 20%... (0 Replies)
Discussion started by: Mariognarly
0 Replies

4. Infrastructure Monitoring

snmpwalk on solaris 8

hello, I want to know how can I find the path of snmpwalk under sun solaris 5.8. I have snmp protocol installed.when I write this on a terminal I have this result: bash: snmpwalk: command not found but when I wrote this command At a distance,it works good. urgent please help me thanks (4 Replies)
Discussion started by: lamou23
4 Replies

5. Shell Programming and Scripting

snmpwalk timeout

can somoene please tell me how to tell snmpwalk how many seconds it has to timeout? i searched the web for this but i can't find it. i'm incorporating this into a script, and I'd like to have snmpwalk timeout within a certain amount of seconds. the -t option doesn't seem to work because... (1 Reply)
Discussion started by: SkySmart
1 Replies

6. UNIX for Dummies Questions & Answers

snmpwalk or maximum connection

what is the simplest command to check if a server already reached it's maximum connection? ( regardless if it's database, mail, etc). system: solaris (9/20) machine: sparc/x86 thanks, larey (5 Replies)
Discussion started by: lhareigh890
5 Replies

7. Homework & Coursework Questions

unix script trouble

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi I am new to unix and need some help, the main reason I am here is because i need basic unix knowledge The... (2 Replies)
Discussion started by: krolike
2 Replies

8. AIX

NET-SNMP not responding to snmpwalk

We are using net-snmp on AIX 5.3 TL12 with CACTi for monitoring. Recently we are facing a problem. When we start net-snmp the snmpwalk to the localhost is working. But after a few minutes the snmpwalk gives a timeout to localhost. The snmp process is running. We recently upgraded the TL on the... (1 Reply)
Discussion started by: wibhore
1 Replies

9. AIX

snmp genError with snmpwalk

Hi Admins, I am new member here. I am using IAX 5.3 trying to configure snmpv3. Conf file /etc/snmpdv3.conf contents given below VACM_GROUP group1 SNMPv1 public - VACM_GROUP group1 SNMPv1 sbmviking - VACM_VIEW defaultView internet - included -... (0 Replies)
Discussion started by: newaix
0 Replies

10. UNIX for Dummies Questions & Answers

Help with SNMPWALK

Hi when I do the SNMPwalk, it doesn't seem to work. Please advice what I am doing wrong? On my snmpd.conf file, I have this. rocommunity badboy xx.x.x.x # Traverse Server Also I have MIB files under /usr/share/snmp/mibs # service snmpd status snmpd (pid 23756)... (3 Replies)
Discussion started by: samnyc
3 Replies
smicache(1)							     SMI Tools							       smicache(1)

NAME
smicache - caching method for use with libsmi SYNOPSIS
smicache [ -Vh ] [ -d dir ] [ -p prefix ] [ mib ] DESCRIPTION
The smicache program can be used by libsmi to fetch MIB modules that cannot be found in regular local MIB directories. OPTIONS
-V Show the smicache version and exit. -h Show a help text and exit. -d dir Write fetched module file(s) to directory dir. -p prefix Use the URL prefix prefix for fetching modules. mib The MIB module to be fetched. Note that smicache is just a very simple script that builds on the wget program to retrieve files from URLs. It does not handle the file attributes of retrieved modules in any special way, so that you have to care about permissions in multi-user environments. EXAMPLE
Smicache can be used by putting the following line into the global configuration file: cache /usr/local/share/mibs/cache /usr/local/bin/smicache -d /usr/local/share/mibs/cache -p http://www.ibr.cs.tu-bs.de/projects/libsmi/smicache/ You might want to chmod 1777 /usr/local/share/mibs/cache. SEE ALSO
The libsmi(3) project is documented at http://www.ibr.cs.tu-bs.de/projects/libsmi/. smilint(1) AUTHOR
(C) 2001-2004 Frank Strauss, TU Braunschweig, Germany <strauss@ibr.cs.tu-bs.de> IBR
August 10, 2004 smicache(1)
All times are GMT -4. The time now is 03:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy