[Discussion] Proposals for getinfo.sh

A 5 star hangout for overworked and underpaid system admins.

[Discussion] Proposals for getinfo.sh

Postby jlehtone » 2012/04/20 08:21:05

Hi,

The getinfo is a wonderful tool for wrenching details from users before their issues can be approached. However -- risking data overload -- I feel that it could tell even more.

I mainly dwell on the network fora where routing is a frequent issue. Thus, my notes are about that this time.

One bit of information, but perhaps relevant when traffic does not pass as expected.:
Code: Select all
# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0

There have been couple cases when this policy change in CentOS 6 has saved the day:
Code: Select all
# grep rp_filter /etc/sysctl.{conf,d/*}
/etc/sysctl.conf:net.ipv4.conf.default.rp_filter = 1

(Not quite optimal command for CentOS 5, where there is no /etc/sysctl.d/.)

I'm not fond of "ifconfig -a" but I have to admit that its output is more compact than "ip -s link show" and "ip address show".

When someone has added routing rules/tables, they know what they are doing, so the following would not help?
Code: Select all
# ip rule show
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default


My pet peeve is "route vs. ip", since they show a bit different details. Sadly, the route has neater columns:
Code: Select all
]# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.0.20.0       0.0.0.0         255.255.255.0   U     0      0        0 bond0.69
172.16.2.0      10.0.0.230      255.255.255.0   UG    0      0        0 brsbl
10.0.0.0        0.0.0.0         255.255.255.0   U     0      0        0 brsbl
192.168.168.0   10.0.0.254      255.255.255.0   UG    0      0        0 brsbl
10.0.10.0       0.0.0.0         255.255.255.0   U     0      0        0 brman
10.21.0.0       10.0.0.230      255.255.0.0     UG    0      0        0 brsbl
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 brsbl

# ip route show
10.0.20.0/24 dev bond0.69  proto kernel  scope link  src 10.0.20.3
172.16.2.0/24 via 10.0.0.230 dev brsbl
10.0.0.0/24 dev brsbl  proto kernel  scope link  src 10.0.0.207
192.168.168.0/24 via 10.0.0.254 dev brsbl
10.0.10.0/24 dev brman  proto kernel  scope link  src 10.0.10.1
10.21.0.0/16 via 10.0.0.230 dev brsbl
default via 10.0.0.1 dev brsbl
User avatar
jlehtone
 
Posts: 1431
Joined: 2007/12/11 08:17:33
Location: Finland

Re: [Discussion] Proposals for getinfo.sh

Postby pschaff » 2012/04/20 12:39:59

Moving to Social as this is not CentOS-6 (or even CentOS) specific.

No problem with adding the suggested ip information, but I'd be reluctant to replace the current commands. On the sysctl stuff, some file grepping can certainly provide it.

Before moving out on this, any others with suggestions please jump in. I'd rather incorporate all suggestions at once, particularly now that this is in an ELRepo package.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: [Discussion] Proposals for getinfo.sh

Postby AlanBartlett » 2012/04/20 23:16:15

I do not think I am suitably qualified to comment on the finer networking points currently being discussed. However I will show the results I have obtained from executing those commands on an RHEL 6.2 system --

[ajb@Duo2 ~]$ sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
[ajb@Duo2 ~]$ grep rp_filter /etc/sysctl.{conf,d/*}
/etc/sysctl.conf:net.ipv4.conf.default.rp_filter = 1
[color=FF0000]grep: /etc/sysctl.d/*: No such file or directory[/color]
[ajb@Duo2 ~]$ ip rule show
0: from all lookup local
32766: from all lookup main
32767: from all lookup default
[ajb@Duo2 ~]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
[ajb@Duo2 ~]$ ip route show
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.2 metric 2
default via 192.168.1.254 dev wlan0 proto static
[ajb@Duo2 ~]$

Note the line highlighted in red? :-o
User avatar
AlanBartlett
Forum Moderator
 
Posts: 8975
Joined: 2007/10/22 11:30:09
Location: ~/Earth/UK/England/Suffolk

Re: [Discussion] Proposals for getinfo.sh

Postby TrevorH » 2012/04/21 03:40:37

I've never been keen on the errors we get because a command is not installed. Not sure if this is exactly elegant but it seems to work

Code: Select all
--- /usr/local/bin/oldinfo.sh   2012-04-10 20:09:19.000000000 +0000
+++ /usr/local/bin/getinfo.sh   2012-04-21 03:35:54.077342619 +0000
@@ -85,9 +85,14 @@
 
 for program in $PRGS
 do
-   echo "== BEGIN $program ==" >> $TMPFILE 2>&1
-   eval $program >> $TMPFILE 2>&1
-   echo "== END   $program ==" >> $TMPFILE 2>&1
+   PRG=$(which `echo $program | cut -d" " -f1` 2>/dev/null)
+   if [ -n "$PRG" -a -x "$PRG" ]; then
+      echo "== BEGIN $program ==" >> $TMPFILE 2>&1
+      eval $program >> $TMPFILE 2>&1
+      echo "== END   $program ==" >> $TMPFILE 2>&1
+   else
+      echo "== NO    $program ==" >> $TMPFILE 2>&1
+   fi
    echo >> $TMPFILE 2>&1
 done
 
User avatar
TrevorH
Forum Moderator
 
Posts: 9133
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [Discussion] Proposals for getinfo.sh

Postby pschaff » 2012/04/21 12:48:46

Good idea. I had thought about doing something like that but never got it done. Will do it this iteration.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: [Discussion] Proposals for getinfo.sh

Postby pschaff » 2012/04/21 13:02:47

AlanBartlett wrote:
...
Note the line highlighted in red? :-o

Actually, same thing on 5.8 now that I test...
Code: Select all
# grep rp_filter /etc/sysctl.{conf,d/*}
/etc/sysctl.conf:net.ipv4.conf.default.rp_filter = 1
grep: /etc/sysctl.d/*: No such file or directory
# rpm -q centos-release
centos-release-5-8.el5.centos.x86_64
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: [Discussion] Proposals for getinfo.sh

Postby TrevorH » 2012/04/21 16:55:06

I had a thought after posting my patch... unfortunately I don't think `which` is a default package :-(
User avatar
TrevorH
Forum Moderator
 
Posts: 9133
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [Discussion] Proposals for getinfo.sh

Postby pschaff » 2012/04/21 20:21:38

That is a problem. All I can come up with as an alternative is to use the full paths for executables so they can be checked with "if [ -f /bin/name ]; then ..." as the original command strings are constructed. Makes it rather messy.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Re: [Discussion] Proposals for getinfo.sh

Postby TrevorH » 2012/04/21 21:06:46

Hmmm... in the RPM I guess we could cheat:

Requires: which
User avatar
TrevorH
Forum Moderator
 
Posts: 9133
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: [Discussion] Proposals for getinfo.sh

Postby pschaff » 2012/04/22 02:31:43

That would take care of people who use the package. Better than anything I've come up with. A more general solution that also works for a direct download of the script would be better. I'm still looking/thinking. Other suggestions welcome.
pschaff
Retired Moderator
 
Posts: 18277
Joined: 2006/12/13 20:15:34
Location: Tidewater, Virginia, North America

Next

Return to CentOS Social

Who is online

Users browsing this forum: No registered users and 1 guest