Thanks Joe
The answer to your question is No. 
1. I want to Perform an SNMP request in SNMP agent. return 0 if the
connect succeeded.
2. I want to be able to see how many times people from outside tried to
get into the devices also

I know my script is wrong , but her is what I come up with so far:

LIST = 'ypcat hosts|| sort | awk '{print $2}''
 for Devices in $LIST
 do
 Errorcount=`snmpget -v1 -c privator $Devices snmpInBadCommunityNames.O
|awk '{print $4}' `
 
  if [ Errorcount >= 0 ]; then
    echo "Devices=0"
    echo "$sysdate $Devices" >> /tmp/hosthistory.txt

  fi
 done

I feel like I forced the devices to be zero.
My next question is how would I know if the device been hacked or tried
to be hacked ?

Thank you 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Joe Pruett
Sent: Wednesday, October 21, 2009 2:21 PM
To: General Linux/UNIX discussion and help;civil and on-topic
Subject: Re: [PLUG] shell scripting

> hello all,
>
> i want to Perform an SNMP set request in SNMP agent. return 0 if the
> connect succeeded.
>
> here is what i did :
>
> LIST = 'ypcat hosts|| sort | awk '{print $2}''
> for Devices in $LIST
> do
> Errorcount=`snmpget -v1 -c privator $Devices snmpInBadCommunityNames.O
> |awk '{print $4}' `
> if [ Errorcount > 0 ]; then
> Devices=$Errorcount
> echo $Devices
> # line added
> echo "$sysdate $Devices" >> /tmp/hosthistory.txt
>
> fi
> done
>
> but the answer is wrong cause i'm getting an errorcount.

well, rather than using awk, i'd suggest using the -Oqv option to
snmpget. 
that will make it only spit out the value.

but i'm not sure what you are trying to do.  that snmpget will return
the 
total number of bad requests the device has seen since reboot.  is that 
what you want to do?
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug
____________________________________________________________________________
EMAIL DISCLAIMER:
This email and any attachments thereto may contain private, confidential, and
privileged material for the sole use of the intended recipient. Any review,
copying, or distribution of this email (or any attachments thereto) by other
than the intended recipient is strictly prohibited.

If you are not the intended recipient, please contact the sender immediately
and permanently delete the original and any copies of this email and any
attachments thereto.
_____________________________________________________________________________

_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to