[aklug] Re: Exit status of scripts

From: James Zuelow <James_Zuelow@ci.juneau.ak.us>
Date: Fri Jun 05 2009 - 14:46:29 AKDT

> -----Original Message-----
> From: aklug-bounce@aklug.org [mailto:aklug-bounce@aklug.org]=20
> On Behalf Of Royce Williams
> Sent: Friday, 05 June, 2009 14:28
> To: aklug@aklug.org
> Subject: [aklug] Re: Exit status of scripts
>=20
> Are you at liberty to show your config, or a similar one?
>=20
> The syntax I'm talking about is as simple as
>=20
> # snmpd.conf
> extend my.branch "echo blah" =20
>=20
> ... and you should see
>=20
> $ snmpwalk -v 1 -c redacted 192.168.42.42=20
> NET-SNMP-EXTEND-MIB::nsExtendObjects | grep my.branch
> NET-SNMP-EXTEND-MIB::nsExtendCommand."my.branch" =3D STRING: echo blah
> NET-SNMP-EXTEND-MIB::nsExtendArgs."my.branch" =3D STRING:

OK, no I'm not using the same syntax you are.

Here's the important part of my config:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
# exec: run a simple command using exec()
# arguments: [oid] name /path/to/executable arguments

exec squidClientSec /bin/bash /usr/local/bin/squid_client_stat.sh
exec squidNtlmMsec /bin/bash /usr/local/bin/squid_ntlm_stat.sh
exec squidMedSvcTime /bin/bash /usr/local/bin/squid_mdsvc_stat.sh
exec squidDnsMsec /bin/bash /usr/local/bin/squid_dnssvc_stat.sh
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

This was just a quick mashup with snmpconf. I'm looking for SNMP data that=
 the Squid MIB doesn't expose, like average service time for NTLM authentic=
ation. It works for me as it is now, but I was asked to write up my config=
. One of the scripts checks the average number of clients over a 5 minute =
period. That will never hit 255 for the city of Juneau, but it is certainl=
y possible that someone else's site would be that busy.

Here's the NTLM script as an example:

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
#!/bin/bash
# NTLM average service time in milliseconds
ntlm=3D`printf %.0f $(squidclient -p 8080 mgr:ntlmauthenticator@password \
 | grep avg | cut -d " " -f 4 )`
exit $ntlm
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Hopefully it doesn't get wrapped or %20 mangled too much. Besides the shab=
ang line, there is one comment and two lines of code.

James Zuelow....................CBJ MIS (907)586-0236
Network Specialist...Registered Linux User No. 186591 =
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Fri Jun 5 14:46:47 2009

This archive was generated by hypermail 2.1.8 : Fri Jun 05 2009 - 14:46:47 AKDT