PDA

View Full Version : SysInfo: a set of scripts that document your system


danger@
April 8th, 2009, 18:34
Hello guys,

I am developing a script that automatically documents settings of particular freebsd (currently 7.x) box from the hardware point of view to the network and services related information.

The point of this script is to provide some descriptive information about unknown system's configuration (hardware and software) for administrator who has no idea about the given system.

I would greatly appreciate if you guys could test it in your environment and provide some feedback. It currently doesn't provide very much information, so I would really also like to hear your opinions on what kind of information would you be interested in in above described situation, which I should document.

The latest version of this script can be found at:
http://people.freebsd.org/~danger/sysinfo/

Thank you.

DutchDaemon
April 8th, 2009, 18:44
I get an error in the part handled by the 020-mem script.



System memory summary
expr: illegal option -- 4
usage: expr [-e] expression
expr: illegal option -- 1
usage: expr [-e] expression
Total real memory available: 2047 MB
Logically used memory: MB
Logically available memory: MB


020-mem run with sh -xv:


cat <<EOF
Total real memory available: $(calc_mb $physmem) MB
Logically used memory: $(calc_mb $usedmem) MB
Logically available memory: $(calc_mb $availmem) MB
EOF
+ cat
+ calc_mb 3203567616
+ expr 3203567616 / 1048576
+ echo 2047
+ return
+ calc_mb -465883137
+ expr -465883137 / 1048576
expr: illegal option -- 4
usage: expr [-e] expression
+ echo
+ return
+ calc_mb -1681600512
+ expr -1681600512 / 1048576
expr: illegal option -- 1
usage: expr [-e] expression
+ echo
+ return
Total real memory available: 2047 MB
Logically used memory: MB
Logically available memory: MB


My real mem (dmesg -a) is 3220897792 (3071 MB), btw ;)

danger@
April 8th, 2009, 19:13
does http://people.freebsd.org/~rse/dist/freebsd-memory work for you well?

icer
April 8th, 2009, 20:58
no errors and all true :)
CPU information

Machine class: i386
CPU Model: Intel(R) Pentium(R) Dual CPU E2200 @ 2.20GHz
Number of CPUs: 2

RAM information

System memory summary
Total real memory available: 1005 MB
Logically used memory: 481 MB
Logically available memory: 523 MB

Swap information
Device 1K-blocks Used Avail Capacity
/dev/ad6s1b 4194304 0B 4.0G 0%

Operating system information

Operating system release: FreeBSD 7.1-RELEASE-p2
OS architecture: i386
Hostname: icer.local
Kernel build dir location: /usr/obj/usr/src/sys/WiFi
Currently booted kernel: /boot/kernel/kernel

Currently loaded kernel modules (kldstat):
acpi.ko
linprocfs.ko
linux.ko
Storage information

Available hard drives:
da3: <Generic USB MS Reader 1.03> Removable Direct Access SCSI-0 device
da3: 1.000MB/s transfers
da3: Attempt to query device size failed: NOT READY, Medium not present
da2: <Generic USB SM Reader 1.02> Removable Direct Access SCSI-0 device
da2: 1.000MB/s transfers
da2: Attempt to query device size failed: NOT READY, Medium not present
da1: <Generic USB CF Reader 1.01> Removable Direct Access SCSI-0 device
da1: 1.000MB/s transfers
da1: Attempt to query device size failed: NOT READY, Medium not present
da0: <Generic USB SD Reader 1.00> Removable Direct Access SCSI-0 device
da0: 1.000MB/s transfers
da0: Attempt to query device size failed: NOT READY, Medium not present
acd0: DVDR <Optiarc DVD RW AD-7170A/1.03> at ata2-master UDMA66
cd0: <Optiarc DVD RW AD-7170A 1.03> Removable CD-ROM SCSI-0 device
cd0: 66.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present
ad6: 76319MB <WDC WD800JD-60LSA5 10.01E03> at ata3-master SATA300

Currently mounted filesystems:
/dev/ad6s1a on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ad6s1e on /tmp (ufs, local, soft-updates)
/dev/ad6s1f on /usr (ufs, local, soft-updates)
/dev/ad6s1d on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
linprocfs on /usr/compat/linux/proc (linprocfs, local)

I/O statistics:
tty ad6 da0 da1 cpu
tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id
14 209 11.09 11 0.12 0.01 0 0.00 0.01 0 0.00 6 0 2 2 90
INFO:
Run gstat(8) to see live statistics.

Disk usage:
Filesystem Size Used Avail Capacity Mounted on
/dev/ad6s1a 496M 252M 204M 55% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ad6s1e 496M 17M 439M 4% /tmp
/dev/ad6s1f 58G 27G 26G 52% /usr
/dev/ad6s1d 9.7G 1.4G 7.5G 16% /var
procfs 4.0K 4.0K 0B 100% /proc
linprocfs 4.0K 4.0K 0B 100% /usr/compat/linux/proc

Network information

hostname: icer.local

Currently available network devices:
em0 ath0 fwe0 fwip0 lo0 pflog0 pfsync0

Basic configuration for currently available NICs:

em0:
MAC address: 00:1c:c0:73:7c:2c
IPv4 addresses:
192.168.x.x netmask 0xffffff00

ath0:
MAC address: 00:21:91:97:ba:5e
IPv4 addresses:
192.168.x.x netmask 0xffffff00
MAC address: 02:90:27:24:da:b9

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
fe80::1%lo0 prefixlen 64
::1 prefixlen 128

Default route: 192.168.x.x
INFO: For a complete routing table please run netstat -rn

There are 12 currently opened or listening connections.
INFO: For more information please see sockstat(8) manual

Information related to services

Misc information

Currently logged-in users:
icer v8 :0 9:51PM - -
icer p1 :0.0 10:48PM - w -hi
icer p0 :0.0 9:51PM 9 /usr/bin/as -o nsPlugi

Uptime:
10:50PM up 4:55, 3 users, load averages: 1.17, 1.05, 0.88

thx, useful fiche
P.S. btw in my opinion, it will be useful if script check rc.conf and after what check runing services and show status. smf like this:
apache 2.2.1 - runing
samba 3.3.3 - runing

DutchDaemon
April 8th, 2009, 21:17
does http://people.freebsd.org/~rse/dist/freebsd-memory work for you well?

Yes, that looks normal to me.


SYSTEM MEMORY INFORMATION:
mem_wire: 144449536 ( 137MB) [ 4%] Wired: disabled for paging out
mem_active: + 179015680 ( 170MB) [ 5%] Active: recently referenced
mem_inactive:+ 567050240 ( 540MB) [ 18%] Inactive: recently not referenced
mem_cache: + 2453504 ( 2MB) [ 0%] Cached: almost avail. for allocation
mem_free: + 2252898304 ( 2148MB) [ 71%] Free: fully available for allocation
mem_gap_vm: + 688128 ( 0MB) [ 0%] Memory gap: UNKNOWN
-------------- ------------ ----------- ------
mem_all: = 3146555392 ( 3000MB) [100%] Total real memory managed
mem_gap_sys: + 57012224 ( 54MB) Memory gap: Kernel?!
-------------- ------------ -----------
mem_phys: = 3203567616 ( 3055MB) Total real memory available
mem_gap_hw: + 17657856 ( 16MB) Memory gap: Segment Mappings?!
-------------- ------------ -----------
mem_hw: = 3221225472 ( 3072MB) Total real memory installed

SYSTEM MEMORY SUMMARY:
mem_used: 398823424 ( 380MB) [ 12%] Logically used memory
mem_avail: + 2822402048 ( 2691MB) [ 87%] Logically available memory
-------------- ------------ ----------- ------
mem_total: = 3221225472 ( 3072MB) [100%] Logically total memory

zordio
April 9th, 2009, 02:59
I also get an error in the memory section:


expr: illegal option -- 1
usage: expr [-e] expression
expr: syntax error


I threw a few extra lines into 020.mem to see the values of the memory variables:


physmem: 3744890880
activemem: 140959744
inactmem: -1125810176
cachemem: 142274560
allmem: -616513536
wiremem: 211468288
freemem: 13770752


and the direct sysctl outputs (done after the script ran, so the results might be a little different) are:


hw.pagesize: 4096
hw.physmem: 3744890880
vm.stats.vm.v_active_count: 34425
vm.stats.vm.v_inactive_count: 773958
vm.stats.vm.v_cache_count: 34531
vm.stats.vm.v_page_count: 898060
vm.stats.vm.v_wire_count: 51683
vm.stats.vm.v_free_count: 3258


Seems to be an overflow error for memory above a certain size.

danger@
April 9th, 2009, 09:27
interesting...I will check later today and see what's going on. I have been developing this tool on 8gb box, so it's a bit weird. We will see.

danger@
April 9th, 2009, 09:29
Yup, the services part is not yet implemented. I will be working on this part today or maybe during the weekend and Easter holidays.

Having that said, I would like to hear what kind of information you guys are interested to see in the script's output in that regard.

Thanks.

danger@
April 9th, 2009, 11:16
what does expr 3744890880 / 1048576 give you?

zordio
April 9th, 2009, 18:23
what does expr 3744890880 / 1048576 give you?

That gives 2047. Although the problem seemed to be with multiplication, not division.

While reading the expr man page, I noticed the -e option, to detect overflows. I added it to the script, and no longer get errors:


RAM information

System memory summary
Total real memory available: 3571 MB
Logically used memory: 398 MB
Logically available memory: 3172 MB

Swap information
Device 1K-blocks Used Avail Capacity
/dev/twed0s1b 4194304 248K 4.0G 0%

danger@
April 9th, 2009, 18:41
I thought that will be a problem :-)

can you please test http://people.freebsd.org/~danger/sysinfo/sysinfo-090409-alpha.tar.gz for me?

lme@
April 9th, 2009, 20:01
Daniel, that's a very nice script! :)

Available hard drives:
acd0: DVDR <TSSTcorpCD/DVDW TS-L632D/SC01> at ata0-slave UDMA33
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
cd0: <TSSTcorp CD/DVDW TS-L632D SC01> Removable CD-ROM SCSI-0 device
cd0: 33.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY,
^^^^ should be grepped out
Medium not present - tray closed
acpi_acad0: <AC Adapter> on acpi0
^^^^^^^^^^^^^^^^^^^^^^^
no, this is not a drive ;-)
ad0: 114473MB <Seagate ST9120822A 3.ALC> at ata0-master UDMA100



Basic configuration for currently available NICs:
MAC address: 00:13:02:3f:0d:e4
MAC address: 00:00:f0:7f:da:00
MAC address: 02:00:f0:0f:ab:79

You should add the device names here.


Default route: 192.168.10.1


Here you could add the interface.

zordio
April 9th, 2009, 22:17
I thought that will be a problem :-)

can you please test http://people.freebsd.org/~danger/sysinfo/sysinfo-090409-alpha.tar.gz for me?

No errors, info looks correct.

DutchDaemon
April 9th, 2009, 22:47
No errors here.

gelraen
April 10th, 2009, 00:21
CPU information

Machine class: i386
CPU Model: Intel(R) Core(TM)2 Duo CPU T7250 @ 2.00GHz
Number of CPUs: 2

RAM information

System memory summary
Total real memory available: 2035 MB
Logically used memory: 1352 MB
Logically available memory: 682 MB

Swap information
Device 512-blocks Used Avail Capacity
/dev/ad4s1b 4194304 920K 2.0G 0%

Operating system information

Operating system release: FreeBSD 8.0-CURRENT
OS architecture: i386
Hostname: imax
Kernel build dir location: /usr/obj/usr/src/sys/HEAD
Currently booted kernel: /boot/kernel/kernel

Currently loaded kernel modules (kldstat):
drm.ko
radeon.ko
linprocfs.ko
linux.ko
ng_socket.ko
ng_mppc.ko
rc4.ko
ng_iface.ko
ng_ppp.ko
fuse.ko
kqemu.ko
Storage information

Available hard drives:
acd0: DVDR <MATSHITADVD-RAM UJ-861H/1.50> at ata0-master PIO4
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
acd0: FAILURE - INQUIRY ILLEGAL REQUEST asc=0x24 ascq=0x00
cd0: <MATSHITA DVD-RAM UJ-861H 1.50> Removable CD-ROM SCSI-0 device
cd0: 16.000MB/s transfers
cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
ad4: 152627MB <FUJITSU MHY2160BH 890B> at ata2-master SATA150

Currently mounted filesystems:
/dev/ufs/root on / (ufs, local)
devfs on /dev (devfs, local)
/dev/ufs/tmp on /tmp (ufs, local, soft-updates)
/dev/ufs/usr on /usr (ufs, local, soft-updates)
/dev/ufs/var on /var (ufs, local, soft-updates)
procfs on /proc (procfs, local)
linprocfs on /usr/compat/linux/proc (linprocfs, local)
devfs on /usr/compat/linux/dev (devfs, local)
/usr/home/imax/music/Audio on /var/ftp/music/audio (nullfs, local, read-only)
/usr/home/imax/music/Video on /var/ftp/music/video (nullfs, local, read-only)
/usr/home/imax/music/Lyrics on /var/ftp/music/lyrics (nullfs, local, read-only)
/usr/home/imax/Films on /var/ftp/films (nullfs, local, read-only, union)
/usr/home/imax/Share on /var/ftp/share (nullfs, local, read-only)
/var/ftp/incoming on /usr/home/imax/incoming (nullfs, local)
/usr/ports/distfiles on /var/ftp/distfiles (nullfs, local, read-only)
/usr/home/imax/Documents/docs on /var/ftp/docs (nullfs, local, read-only)
devfs on /var/named/dev (devfs, local)

I/O statistics:
tty ad4 cd0 pass0 cpu
tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id
57 1588 65.26 17 1.05 0.00 0 0.00 0.00 0 0.00 17 3 9 1 69
modules/030.storage: DEBUG: checkyesno: INFO_MSGS is set to YES.
INFO: Run gstat(8) to see live statistics.

Disk usage:
Filesystem Size Used Avail Capacity Mounted on
/dev/ufs/root 496M 167M 289M 37% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/ufs/tmp 989M 123M 787M 13% /tmp
/dev/ufs/usr 138G 135G 1.2G 99% /usr
/dev/ufs/var 2.9G 687M 2.0G 25% /var
procfs 4.0K 4.0K 0B 100% /proc
linprocfs 4.0K 4.0K 0B 100% /usr/compat/linux/proc
devfs 1.0K 1.0K 0B 100% /usr/compat/linux/dev
/usr/home/imax/music/Audio 138G 135G 1.2G 99% /var/ftp/music/audio
/usr/home/imax/music/Video 138G 135G 1.2G 99% /var/ftp/music/video
/usr/home/imax/music/Lyrics 138G 135G 1.2G 99% /var/ftp/music/lyrics
/usr/home/imax/Films 138G 135G 1.2G 99% /var/ftp/films
/usr/home/imax/Share 138G 135G 1.2G 99% /var/ftp/share
/var/ftp/incoming 2.9G 687M 2.0G 25% /usr/home/imax/incoming
/usr/ports/distfiles 138G 135G 1.2G 99% /var/ftp/distfiles
/usr/home/imax/Documents/docs 138G 135G 1.2G 99% /var/ftp/docs
devfs 1.0K 1.0K 0B 100% /var/named/dev

Network information

hostname: imax

Currently available network devices:
em0 wpi0 lo0 vlan0 ng0 gif0 gif1 gif4

Basic configuration for currently available NICs:

em0:
MAC address: 00:1a:4b:76:91:e1
IPv4 addresses:
10.45.71.120 netmask 0xffffff80
MAC address: 00:1c:bf:2e:dc:fc

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
fe80::1%lo0 prefixlen 64
::1 prefixlen 128

vlan0:
MAC address: 00:1a:4b:76:91:e1
IPv4 addresses:
10.45.74.7 netmask 0xffffff00

gif0:
IPv4 addresses:
inet 10.45.74.7 -->
192.168.100.1 --> 192.168.100.2

gif1:
IPv4 addresses:
inet 10.45.74.7 -->
192.168.100.1 --> 192.168.100.3

gif4:
IPv4 addresses:
inet 10.45.74.7 -->
192.168.100.17 --> 192.168.100.18

Default route: 10.45.74.254
modules/040.network: DEBUG: checkyesno: INFO_MSGS is set to YES.
INFO: For a complete routing table please run netstat -rn

There are 183 currently opened or listening connections.
modules/040.network: DEBUG: checkyesno: INFO_MSGS is set to YES.
INFO: For more information please see sockstat(8) manual

Information related to services

Misc information

Currently logged-in users:
root pts/10 :pts/9:S.0 Thu03PM 9:18 /usr/local/bin/zsh

Uptime:
12:55AM up 10:51, 1 user, load averages: 0.55, 0.56, 0.59
ifconfig output parsing not adopted for point-to-point interfaces.

Maybe resolv.conf should be printed in network information.
Also, information about firewall could be useful (as for ipfw - at least sysctl net.inet(6).ip(6).fw.enable, net.link.ether.ipfw and net.link.bridge.ipfw variables).

P.S.: `./sysinfo -a | less` full of esacpe sequences used for coloring which makes output some less readable.

P.P.S.: thanks for developing such tool :)

danger@
April 10th, 2009, 00:48
ifconfig output parsing not adopted for point-to-point interfaces.

First, let me thank you for the feedback.

Could you please send me the output of your ifconfig, so I can fix it for P2P devices?

Maybe resolv.conf should be printed in network information.

Feature added in my local version, thanks for an idea.

Also, information about firewall could be useful (as for ipfw - at least sysctl net.inet(6).ip(6).fw.enable, net.link.ether.ipfw and net.link.bridge.ipfw variables).

That's a great idea, I will implement it soon.

P.S.: `./sysinfo -a | less` full of esacpe sequences used for coloring which makes output some less readable.

That's why there's -c option :-)

P.P.S.: thanks for developing such tool :)

It's nice to hear such words, thanks :)
Actually it's being developed as part of my bachelor thesis.

danger@
April 10th, 2009, 00:55
cd0: Attempt to query device size failed: NOT READY,
^^^^ should be grepped out
Medium not present - tray closed
acpi_acad0: <AC Adapter> on acpi0
^^^^^^^^^^^^^^^^^^^^^^^
no, this is not a drive ;-)

I think I have fixed this in my local version :) I will release new version probably during the weekend so you will be welcome to test it :)

[code]
Basic configuration for currently available NICs:
MAC address: 00:13:02:3f:0d:e4
MAC address: 00:00:f0:7f:da:00
MAC address: 02:00:f0:0f:ab:79

You should add the device names here.

I wonder how does your ifconfig output look like?


Default route: 192.168.10.1


Here you could add the interface.

Added. :)

gelraen
April 10th, 2009, 14:19
Could you please send me the output of your ifconfig, so I can fix it for P2P devices?


% ifconfig gif0
gif0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1280
tunnel inet 10.45.74.7 --> 10.45.67.94
inet 192.168.100.17 --> 192.168.100.18 netmask 0xffffffff


General interface looks like this:
% ifconfig vlan0
vlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=3<RXCSUM,TXCSUM>
ether 00:1a:4b:76:91:e1
inet 10.45.74.7 netmask 0xffffff00 broadcast 10.45.74.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
vlan: 1000 parent interface: em0


That's why there's -c option :-)

Oh, sorry, I've missed this one :)

And one more small thing, when started without parameters it show help message followed by
./sysinfo: ERROR: Not enough arguments provided.

marius
April 11th, 2009, 16:19
The script seems to work correctly on my Soekris.

danger@
April 11th, 2009, 18:00
Hello guys,

I have packaged a new version of my script. It can be downloaded from http://people.freebsd.org/~danger/sysinfo/sysinfo-110409.tar.gz.

Please test it (including execution with -v to include verbose information) and report any bugs you may have found.

I am still also interested in ideas on what should this script document.

Thanks in advance!

mwatkins
April 11th, 2009, 18:34
Your latest script works without issue on my slightly out-dated version of FreeBSD 7.1 and served to remind me I have to do an OS update this weekend.

Quick small issue - advice in the following statement is spelled incorrectly:

INFO: For system tuning adice, see the tuning(7) man page.

gelraen
April 11th, 2009, 20:08
1) check_firewalls() should handle also $firewall_type, not just $firewall_script (btw, maybe will be better to say "ipfw show" instead)

2) services module output full of
Cannot 'status' snmpd. Set snmpd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.

3) Socket statistics doesn't count tcp/udp sockets. And phrase "IP connections" has no sense.

trev
April 12th, 2009, 09:02
CPU information


You could add vmstat(8) -i info after cpu info.


System memory summary


You could vmstat(8) output here.


Currently mounted filesystems:


You could compare against /etc/fstab and list currently unmounted filesystems too.


Disk usage:


After this, it might be useful to see the output of dump(8) -W ... although I'm sure everyone's backups would be up-to-date :-)


MAC address: 00:1f:d0:a4:ec:fc
IPv4 addresses:
192.168.1.4 netmask 0xffffff00


Why does the MAC address run on? Most of your other info after a colon starts a new line.


Firewall related information:



Leave this out if there isn't any firewall info? Or say "no firewall info found" ?


INFO: Use the portsnap(8) tool to update your ports tree.


Why not csup(1) with compression? Faster and smaller updates.


Services status

adzapper is running as pid 730.

apache is running as pid 736.

apcupsd is running as pid 625.

bsdstats is not running.

...


Why the blank line between entries?


INFO: Configuration of system-wide services is located in the /etc/ directory.
INFO: Configuration files for local services can be found in the /usr/local/etc/


Might as well be consistent and make it "Configuration of..." rather than "Configuration files for..." the second time.

Nice job!

danger@
April 14th, 2009, 13:26
Hello,

it's me again! I have put up a new version of SysInfo (0.5), which can be downloaded from http://people.freebsd.org/~danger/sysinfo/sysinfo-140409.tar.gz.

In this version, I have incomporated the latest feedback I have recieved. I would be very thankful if anybody could test it in their own environment and report any bugs found in this release.

As a last note -- I am still looking for ideas of what should be documented by this script.

DutchDaemon
April 14th, 2009, 13:52
Two quirks:

Double:


Available hard drives:
cd0: <HL-DT-ST DVDRAM GSA-T40L KC07> Removable CD-ROM SCSI-0 device
cd0: 16.000MB/s transfers
cd0: <HL-DT-ST DVDRAM GSA-T40L KC07> Removable CD-ROM SCSI-0 device
cd0: 16.000MB/s transfers
ad8: 114473MB <Seagate ST9120823AS 3.AHE> at ata4-master SATA300
ad8: 114473MB <Seagate ST9120823AS 3.AHE> at ata4-master SATA300


?

Firewall related information:
[: -ne: unexpected operator


(not using any)

danger@
April 14th, 2009, 14:12
I wonder whether your /var/run/dmesg.boot contains content from previous boot (i.e. not only the last one)?

As of the bug in FW section: I believe I have fixed this in my new local version (haven't tested on the system w/o fw), Thanks.

DutchDaemon
April 14th, 2009, 14:19
I have no idea ;) Just a clean and planned reboot, and it shows up thusly in /var/run/dmesg.boot :


Waiting (max 60 seconds) for system process `vnlru' to stop...done
Waiting (max 60 seconds) for system process `bufdaemon' to stop...done
Waiting (max 60 seconds) for system process `syncer' to stop...
Syncing disks, vnodes remaining...3 2 2 0 0 done
All buffers synced.
Uptime: 1h37m8s
Rebooting...
cpu_reset: Stopping other CPUs
Copyright (c) 1992-2009 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 7.2-PRERELEASE #0: Thu Mar 19 15:26:46 CET 2009


Maybe default behaviour for a warm boot?

fraenki
April 14th, 2009, 17:10
Nice script, thank you. Some suggestions:

display whether CPU supports 64-bit or not (x86-64)
more information about hardware (in addition to "graphic card information")
-> storage controller vendor/device information
-> network controller vendor/device information
system boot date and time (in addition to "system uptime")
Top 10 most frequently logged-in users (this month)

devel
April 14th, 2009, 20:47
information regarding jails would be nice addition to existing features :o)

royce
April 14th, 2009, 23:40
Great idea!

ipfilter isn't being detected because of a minor test bug in 140409. Running 040.network using 'sh -x', the error is:

+ [ ! -z ]
+ sysctl -n net.inet.ipf.fr_running
+ stat=1
+ [ ! -z 1]
[: missing ]
+ [ 0 -ne 1 ]
+ warn No firewall is being used on this system.
+ echo -e WARNING: No firewall is being used on this system.
WARNING: No firewall is being used on this system.

Just a typo:

--- 040.network 2009-04-14 04:10:33.000000000 -0800
+++ 040.network.new 2009-04-14 13:38:44.000000000 -0800
@@ -53,7 +53,7 @@

# IPF
stat=`sysctl -n net.inet.ipf.fr_running 2>/dev/null`
- if [ ! -z $stat] && [ $stat -eq 1 ]; then
+ if [ ! -z $stat ] && [ $stat -eq 1 ]; then
fw=1

echo "ipfilter is enabled."


Keep up the good work!

mfaridi
April 15th, 2009, 09:03
thanks this is great job , and this script give good informaton
I check it today

f-andrey
April 15th, 2009, 22:11
Nice script
sysinfo-150409.tar.gz
# ./sysinfo -a -v 1 > info.txt
WARNING: No firewall is being used on this system.
ps: illegal argument: to
usage: ps [-aCcefHhjlmrSTuvwXxZ] [-O fmt | -o fmt] [-G gid[,gid...]]
[-M core] [-N system]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
ps: illegal argument: to
usage: ps [-aCcefHhjlmrSTuvwXxZ] [-O fmt | -o fmt] [-G gid[,gid...]]
[-M core] [-N system]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]

# ./sysinfo -a > info0.txt
work

Some suggestion:
Parsing program arguments

# ./sysinfo -ac
not work
my_book# ./sysinfo -a -c
work

danger@
April 15th, 2009, 22:49
I wonder why some of you guys get these:

Cannot 'status' ipxrouted. Set ipxrouted_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'

does anyone have an idea? I don't get it on my machines....interesting. That's the reason you got those ps errors.

As of the argument parsing, this is a common issue with shell scripts (or maybe I am missing something), you have to live with that, sorry :(

danger@
April 15th, 2009, 22:50
fraenki, devel:
I have added your requests to the latest version.

f-andrey
April 15th, 2009, 23:06
I wonder why some of you guys get these:

Cannot 'status' ipxrouted. Set ipxrouted_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'

does anyone have an idea? I don't get it on my machines....interesting. That's the reason you got those ps errors.

I got those ps errors.
# sh -x ./sysinfo -a -v 1
...
Cannot 'status' kpasswdd. Set kpasswdd_server_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
ps: illegal argument: to
...
Cannot 'status' yppasswdd. Set nis_yppasswdd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.
ps: illegal argument: to
...

danger@
April 15th, 2009, 23:28
These messages are probably 8.0 feature (I don't run 8.0 personally, so I can't test), because I have tested several 7.x machines and they do not experience this bug.

Graaf_van_Vlaanderen
April 16th, 2009, 15:28
Here is my info from 'sysinfo -a'
There is actually only "one" hyper-threaded CPU.

[root@Hjordis /home/depaepe/Technical/sysinfo]# sh sysinfo -a
CPU information

Machine class: amd64
CPU Model: Intel(R) Xeon(TM) CPU 3.40GHz
Number of CPUs: 2

RAM information

System memory summary
Total real memory available: 2035 MB
Logically used memory: 309 MB
Logically available memory: 1725 MB

Swap information
Device 1K-blocks Used Avail Capacity
/dev/da0s1b 4160032 0B 4.0G 0%

Operating system information

Operating system release: FreeBSD 7.1-RELEASE-p4
OS architecture: amd64
Hostname: Hjordis
Kernel build dir location: /usr/obj/usr/src/sys/GENERIC
Currently booted kernel: /boot/kernel/kernel

No additional kernel modules are currently loaded.

INFO: For security recommendations see the security(7) man page.
INFO: For system tuning advice, see the tuning(7) man page.
INFO: To view various system statistics use the systat(1) tool.

Storage information

Available hard drives:
da1: <COMPAQ RAID 0 VOLUME OK> Fixed Direct Access SCSI-0 device
da1: 135.168MB/s transfers
da1: 69459MB (142253280 512 byte sectors: 255H 32S/T 17433C)
da0: <COMPAQ RAID 0 VOLUME OK> Fixed Direct Access SCSI-0 device
da0: 135.168MB/s transfers
da0: 69459MB (142253280 512 byte sectors: 255H 32S/T 17433C)

Raid controllers:
ciss0:
vendor='Compaq Computer Corp (Now owned by Hewlett-Packard)'
device='Smart Array 64xx Controller'

Currently mounted filesystems:
/dev/da0s1a on /
devfs on /dev
/dev/da0s1e on /tmp
/dev/da0s1f on /usr
/dev/da0s1d on /var


I/O statistics:
tty da0 da1 pass0 cpu
tin tout KB/t tps MB/s KB/t tps MB/s KB/t tps MB/s us ni sy in id
0 91 20.17 2 0.03 1.94 0 0.00 0.00 0 0.00 79 0 0 0 20
INFO: Run iostat(8) or gstat(8) to see live statistics.

Disk usage:
Filesystem Size Used Avail Capacity Mounted on
/dev/da0s1a 496M 354M 102M 78% /
devfs 1.0K 1.0K 0B 100% /dev
/dev/da0s1e 496M 3.7M 452M 1% /tmp
/dev/da0s1f 58G 13G 40G 24% /usr
/dev/da0s1d 2.9G 534M 2.1G 20% /var

Network information

hostname: Hjordis

Currently available network devices:
bge0 bge1 lo0

Basic configuration for currently available NICs:

bge0:
MAC address:
00:12:79:94:19:60
IPv4 addresses:
192.168.1.4 netmask 0xffffff00

bge1:
MAC address:
00:12:79:94:19:5f

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
fe80::1%lo0 prefixlen 64
::1 prefixlen 128

Default route:
192.168.1.1 via bge0
INFO: For a complete routing table please run netstat -rn.

Firewall related information:
WARNING: No firewall is being used on this system.
INFO: There are several firewall packages on FreeBSD.
INFO: You may want to check http://www.freebsd.org/doc/en/books/handbook/firewalls.html.

Resolver name servers:
192.168.1.1

Socket statistics:
There are currently 13 listening (11 TCP/2 UDP) and 15 connected connections.
INFO: For more information please see sockstat(8) manual.

Packages information

There are 527 packages installed in the system and 0 of them needs updating.
Note that this number may be inaccurate, as your ports tree may be outdated too.

INFO: Run pkg_info(1) to see a full list of installed packages.
INFO: Use pkg_version(1) to inspect what packages are outdated.
INFO: Use the portsnap(8) or csup(1) tool to update your ports tree.

Information related to services

Services status
cupsd is not running.
dbus is not running.
ffserver is not running.
hald is not running.
xfs is not running.
cron is running as pid 732.
devd is running as pid 524.
newsyslog is not running.
sendmail_submit is running as pid 722.
sendmail_clientmqueue is running as pid 726.
sshd is running as pid 716.
syslogd is running as pid 591.
wpa_supplicant is not running.

INFO: Configuration of system-wide services is located in the /etc/ directory.
INFO: Configuration of 3rd party services can be found in the /usr/local/etc/ directory.

Misc information

Graphic card information:
vendor='ATI Technologies Inc'
device='Rage XL PCI'
INFO: Check pciconf(8) for more information.

Currently logged-in users:
depaepe p3 192.168.1.2 12:44PM - w -hi
depaepe p1 192.168.1.2 12:43PM - bash
depaepe p2 192.168.1.2 12:44PM 40 /usr/local/libexec/octave/3.0.5/exec/amd64-portbld-freebsd7.1/octave-3.0.5
depaepe p0 192.168.1.2 12:43PM 2:38 top -uP

Top 10 logged-in users this month:
ac: /var/log/wtmp.0: No such file or directory

System uptime:
System is booted since Thu Apr 16 12:41:13 2009
3:23PM up 2:42, 4 users, load averages: 0.08, 0.42, 1.06

irado
April 17th, 2009, 16:51
sorry, but I have no expertise to just read a bunch of scripts and know what to do :( :r

so, besides a novice (in that matter) I think that I desperately need your script <G> but:

HOW can I configure the rc.conf? the sysinfo script is asking to put variables there but.. which ones is it asking for?

thank you

bsdsx
April 17th, 2009, 21:00
First, thanks for you great work.
Second, sorry for my english.
Third, i have many comments in my /etc/resolv.conf but sysinfo
parse each lines.

modules/040.network


subsect "\nResolver name servers:"
awk '/^#/ { next } /nameserver/ { print $2 }' /etc/resolv.conf


Skip the comment line (without "grep" :) and print ip

danger@
April 18th, 2009, 01:27
Thanks, I didn't think about comments in /etc/resolv.conf in my code.
I have inspired myself by your advise, however have used a bit different code in my local new version

awk '/^nameserver/ {print $2}' /etc/resolv.conf

Hope that will work for you.

gnemmi
April 18th, 2009, 01:29
Marvelous work!
Works really well in here and it shows a lot more info than what I was expecting !

One thing though .. just a suggestion .. could you please consider doing something like:


Services status

Running
..
..
..

Not running
...
...
...


I'll be using your script _a_lot_ !!!

Thanks once again and please keep up the good work you are doing :D

PS: sysinfo-150409.tar.gz

danger@
April 18th, 2009, 12:02
do you run 8.0-CURRENT?

irado
April 18th, 2009, 14:46
sorry, but I have no expertise to just read a bunch of scripts and know what to do :( :r

so, besides a novice (in that matter) I think that I desperately need your script <G> but:

HOW can I configure the rc.conf? the sysinfo script is asking to put variables there but.. which ones is it asking for?

thank you

sure enough this is a so stupid question that not even desserves a "bad comment", it is more contundent just being ignored.

thanks, anyway.

Mel_Flynn
April 18th, 2009, 18:44
Hello guys,

The point of this script is to provide some descriptive information about unknown system's configuration (hardware and software) for administrator who has no idea about the given system.


If by this you mean, like inheriting a system from a previous admin that left no docs around, then this is what I find out:

/boot/loader.conf
diff /boot/device.hints /usr/src/sys/$arch/conf/GENERIC.hints
Which settings from /etc/defaults/rc.conf have been changed, mostly local_startup and ldconfig_paths are of interest
Users in wheel with valid shell
sockstat -l
files in /etc/rc.d that should not be there (comparison with /usr/src/etc/rc.d)
Modification time of /var/db/mergemaster.mtree
portaudit -a
df -h, jls, mount -p, kldstat
pci devices without driver
geom modules status (gmirror, geli etc)
Whether NSS is enabled and what backends
Whether sshd allows root login, allows password based login and subsystems running
Number of physical CPU's, cores and logical ones.


That's pretty much my main list, hope this helps.

Hello,

it's me again! I have put up a new version of SysInfo (0.5), which can be downloaded from http://people.freebsd.org/~danger/sysinfo/sysinfo-140409.tar.gz.


Missing which of available network interfaces are UP.
Should really call onestatus for rc.d services

Other then that, good work! :stud

MG
April 18th, 2009, 20:15
sysinfo misc:

Top 10 logged-in users this month:
ac: /var/log/wtmp.0: No such file or directory

I have only binary file wtmp in /var/log

plamaiziere
April 19th, 2009, 04:54
Thanks for this script.

(tests with version 0.8)

The test to see if the CPU supports amd64 returns a wrong result with AMD Geode CPU (because the script looks for "AMD Features"):


CPU: Geode(TM) Integrated Processor by AMD PCS (499.91-MHz 586-class CPU)
Origin = "AuthenticAMD" Id = 0x5a2 Stepping = 2
Features=0x88a93d<FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CLFLUSH,MMX>
AMD Features=0xc0400000<MMX+,3DNow!+,3DNow!>


No a bug but on this box (a Soekris Net5501) dmidecode does not return anything:

# dmidecode -t bios
# dmidecode 2.9
# No SMBIOS nor DMI entry point found, sorry.

hbokh
April 19th, 2009, 11:10
Nice script indeed!
One small issue: I run FreeBSD 6.4-RELEASE-p1 on an old Pentium2 400MHz so I think to run amd64 on this would be impossible... ;)

# ./sysinfo cpu
CPU information

Machine class: i386
CPU Model: Pentium II/Pentium II Xeon/Celeron
No. of Cores: 1

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.

danger@
April 19th, 2009, 13:47
Ah, it should check against /var/log/wtmp for the current month...thanks.

danger@
April 19th, 2009, 13:49
Could you guys test with SysInfo 0.8.1 (http://people.freebsd.org/~danger/sysinfo/sysinfo-0.8.1.tar.gz) please?

f-andrey
April 19th, 2009, 14:11
Could you guys test with SysInfo 0.8.1 (http://people.freebsd.org/~danger/sysinfo/sysinfo-0.8.1.tar.gz) please?

Thanks, now works correctly on amd64 FreeBSD-CURRENT :)

graudeejs
April 19th, 2009, 14:13
CPU information

Machine class: i386
CPU Model: Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores: 2
Cores per CPU:

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.


Warnings are wrong.... [i ran this script on target pc using ssh]
laptop that i'm using atm (i'm not at home) is in fact amd64

P4 doesn't support AMD64, i bought that computer when 64bit for desktop wasn't around yet


also: does amd64 in 64bit mode run faster than in 32bin mode??????? I'm not sure, i did some research few years ago, and that time it was false.

danger@
April 19th, 2009, 14:15
can you please paste the output of sysinfo -v cpu please? thanks.

graudeejs
April 19th, 2009, 14:21
output of
$ sysinfo -v -c cpu
CPU information

Machine class: i386
CPU Model: Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores: 2
Cores per CPU:


CPU Features:
Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,P GE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SS E,SSE2,SS,HTT,TM,PBE>
Features2=0x441d<SSE3,DTES64,MON,DS_CPL,CNXT-ID,xTPR>

Interrupt statistics:
interrupt total rate
irq1: atkbd0 2 0
irq14: ata0 85824 1
irq15: ata1 101 0
irq16: uhci0 uhci3 3 0
irq17: pcm0 522 0
irq18: rl0 uhci2+ 71669446 1125
irq23: ehci0 1 0
cpu0: timer 123139964 1934
cpu1: timer 123139668 1934
Total 318035531 4995

CPU usage statistics:
CPU: 2.8% user, 0.0% nice, 9.0% system, 4.7% interrupt, 83.5% idle

Number of processor slots on main board: 1
Voltage: 1.3 V
External Clock: 204 MHz
Max Speed: 4000 MHz
Current Speed: 3060 MHz
Upgrade: ZIF Socket

INFO: Run `dmidecode -t processor` to see further information.

perhaps it's because of DTES64


warnings are not included in stdout (they are probably directed to stderr)


P.S.
Max Speed: 4000 MHz
Didn't knew that
Max i have tried was something about 3.45 then it shutdown :D
I was using abit software


EDIT
I've attached full output

danger@
April 19th, 2009, 14:32
Can you test with the attached patch applied?

graudeejs
April 19th, 2009, 14:35
Can you test with the attached patch applied?

ok just tell me hot to apply patch (i've never done that :( )


Ok, patched it (hopefully right)
CPU information

Machine class: i386
CPU Model: Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores: 2
Cores per CPU:

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.

CPU usage statistics:
CPU: 0.9% user, 0.0% nice, 3.2% system, 1.9% interrupt, 94.0% idle



SysInfo v0.8.2 by Daniel Gerzo for FreeBSD Operating System


EDIT:

modules/cpu wan't pached for some reason
I manually removed !
at line 26 and everything is fine now

CPU information

Machine class: i386
CPU Model: Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores: 2
Cores per CPU:

CPU usage statistics:
CPU: 2.8% user, 0.0% nice, 1.9% system, 3.4% interrupt, 91.9% idle

danger@
April 19th, 2009, 14:49
you sure it applied correctly to modules/cpu? :) it should contain the following code now:


# Check whether our CPU supports amd64 and if so, tell user about
# it when it is not yet used
if [ "$arch" != "amd64" ] &&
( grep -qE 'AMD Features.*LM.*' $DMESG ); then
echo
warn "Your CPU supports amd64 architecture, however you are running $arch."
warn "You may want to switch to amd64 to get a better performance."
fi


BTW I am a bit confused now, because in the output of -a which you have attached in your previous post, there isn't that warning, hm?

graudeejs
April 19th, 2009, 14:55
you sure it applied correctly to modules/cpu? :) it should contain the following code now:


# Check whether our CPU supports amd64 and if so, tell user about
# it when it is not yet used
if [ "$arch" != "amd64" ] &&
( grep -qE 'AMD Features.*LM.*' $DMESG ); then
echo
warn "Your CPU supports amd64 architecture, however you are running $arch."
warn "You may want to switch to amd64 to get a better performance."
fi


I'm not sure
plz, tell me what to execute to patch correctly



BTW I am a bit confused now, because in the output of -a which you have attached in your previous post, there isn't that warning, hm?

warnings are redirected to /dev/stderr what i posted is output of sysinfo -c -a, but i redirected output to file, because i'm doing this with ssh (because i did redirection to file, stderr and stdout were separated, 1 to screen the other one to file).

i suggest that you use echo for warnings as well

graudeejs
April 19th, 2009, 15:00
ok i did
patch < sysinfo.diff
in sysinfo dir

checked, seams now patching was ok
the output seams also ok

CPU information

Machine class: i386
CPU Model: Intel(R) Pentium(R) 4 CPU 3.00GHz
No. of Cores: 2
Cores per CPU:

CPU usage statistics:
CPU: 1.3% user, 0.0% nice, 0.9% system, 1.3% interrupt, 96.4% idle

output copied directly from screen

danger@
April 19th, 2009, 15:12
Good to hear that, thanks for verifying. I have also uploaded the full package for 0.8.2 now.

christias
April 19th, 2009, 19:39
sysinfo-0.8.2 tested on FreeBSD 7.1-amd64, 7.1-i386, 7.0-i386 and 6.2-i386.

RAM information

System memory information
Maximum Capacity: 16 GB
Number Of Devices: 8

could add the number of installed modules (or even the size of each one).

Basic configuration for currently available NICs:

lo0:
IPv4 addresses:
127.0.0.1 netmask 0xff000000
IPv6 addresses:
::1 prefixlen 128
fe80::1%lo0 prefixlen 64

Input errors: 55624005647
Output errors: 55624323881
Collisions:

Ipkts and Opkts are reported for localhost instead of Ierrs and Oerrs.


Default route:
147.102.222.200 via em0
fe80::208:7cff:fe63:e400%em0 via

Interface for IPv6 default route is missing. See "netstat -rn" IPv6 output in case you do not have an IPv6 ready box:


Internet6:
Destination Gateway Flags Netif Expire
::/96 ::1 UGRS lo0 =>
default fe80::208:7cff:fe63:e400%em0 UGS em0

Also:


modules/network:
# TCP Wrappers - they are only useful when inetd is enabled

Not true. A lot of non inetd services use tcp wrappers. See sshd, sendmail, snmpd, mysqld, slapd, bacula, smbd, imapd etc.

hbokh
April 19th, 2009, 21:27
FYI: "sysinfo-0.8.2" fixed the CPU-issue I reported this morning (amd64 on an old PII).

f-andrey
April 19th, 2009, 23:54
As of the argument parsing, this is a common issue with shell scripts (or maybe I am missing something), you have to live with that, sorry :(

Maybe this (http://floppsie.comp.glam.ac.uk/Glamorgan/gaius/scripting/4.html) will help :q

danger@
April 20th, 2009, 01:05
Also:


modules/network:
# TCP Wrappers - they are only useful when inetd is enabled

Not true. A lot of non inetd services use tcp wrappers. See sshd, sendmail, snmpd, mysqld, slapd, bacula, smbd, imapd etc.

I have understood from http://www.freebsd.org/doc/en/books/handbook/tcpwrappers.html that you need inetd in order to make use of TCP Wrappers. Is Handbook correct or needs fixing?

As of the other stuff in your message - I will look at it tommorrow now it's time to get some sleep :)

gnemmi
April 20th, 2009, 02:32
Running services

cron is running as pid 540.
devd is running as pid 353.
inetd is running as pid 561.
sendmail_submit is running as pid 528.
sendmail_clientmqueue is running as pid 534.
sshd is running as pid 522.
syslogd is running as pid 400.

Not running services

uuidd is not running.
newsyslog is not running.
wpa_supplicant is not running.


Thank you !!!
And thanks a lot for having implemented some of Mel_Flynn ideas !!!
This is becoming a _must_have_ tool ! :D
Congratulations on an already Great Work!

PS: Just in case, i got that using sysinfo-8.0.2 on a 7.0 REL (my desktop =P) and a 7.1 REL (an internal server).
PS2: "Running services" seems to be sorted by service name but "Not running services" appears not to be sorted .. didn't have time to take a look at your code .. but maybe you forgot to pass a "sort" there .. or maybe sorting not running services wasn't your intention at all .. I don't know .. that just caught my attention and thought maybe you would like to know .. .

Once again .. thanks a lot for your really usefull work =)

fronclynne
April 20th, 2009, 02:43
Not running services

. . .
newsyslog is not running.
Doesn't newsyslog run from cron?

gnemmi
April 20th, 2009, 03:06
Running services

cupsd is running as pid 756.
hpssd is running as pid 743.
cron is running as pid 845.
devd is running as pid 493.
sendmail_submit is running as pid 835.
sendmail_clientmqueue is running as pid 839.
sshd is running as pid 829.
syslogd is running as pid 624.

Not running services

apache is not running.
bsdstats is not running.
dbus is not running.
ffserver is not running.
hald is not running.
mdnsd is not running.
snmpd is not running.
snmptrapd is not running.
svnserve is not running.
tinderd is not running.
uuidd is not running.
xfs is not running.
newsyslog is not running.
wpa_supplicant is not running.


1st post is from my local server. This one is from my desktop (7.1 REL, 7.0 REL, respectively).

Yes ... it does:


[gonzalo@inferna ~]% grep newsyslog /etc/crontab
0 * * * * root newsyslog
[gonzalo@inferna ~]%

christias
April 20th, 2009, 10:31
I have understood from http://www.freebsd.org/doc/en/books/handbook/tcpwrappers.html that you need inetd in order to make use of TCP Wrappers. Is Handbook correct or needs fixing?

It is outdated and incomplete. Most of standalone network services are linked against libwrap and thus using directly the tcp wrappers framework.

danger@
April 20th, 2009, 10:47
Okay, I have removed the inetd_enable check and modified the message a bit, thanks.

christias
April 20th, 2009, 10:48
Yes ... it does:


[gonzalo@inferna ~]% grep newsyslog /etc/crontab
0 * * * * root newsyslog
[gonzalo@inferna ~]%


Thinking out loud, may be sysinfo should check only rc.d scripts that make use of *enable and/or *pidfile variables.

danger@
April 20th, 2009, 10:49
It does. However it has a rc script in /etc/rc.d, that's why it is being checked. I will disable it, however there may be other false-positives.

danger@
April 20th, 2009, 11:34
I have checked that now, and it seems like it does not work very well :(

Mel_Flynn
April 20th, 2009, 16:53
All services should theoretically REQUIRE: DAEMON, maybe that's a good entry point.

danger@
April 21st, 2009, 07:59
Unfortunately that doesn't work either (for example rc.d/nfsd, ezjail, pure-ftpd) :(

danger@
April 28th, 2009, 22:43
Just a quick update:
the tool is now available from ports too: sysutils/sysinfo

robertclemens
April 30th, 2009, 20:13
@danger:

Just stumbled upon your sysinfo script. Pretty nice output with lots of information. Could be great for providing "background info" when asking for help on the forum to see where problems reside.

Keep up the good work and thank you sir.

edhunter
May 3rd, 2009, 12:45
Hello,
really nice tool

I havent tested it very hard,
I just noticed one error on running
sysinfo -c -a | more
here it is:
...
...
Hostname: test.xxxxxx
Kernel build dir location: /usr/obj/usr/src/sys/TESTPC
Currently booted kernel: /boot/kernel/kernel

Currently loaded kernel modules (kldstat(8)):
linux.ko
--More--(byte 1514)sysctl: unknown oid 'net.inet6.ip6.forwarding'
[: -eq: unexpected operator


May be that is because I use custom kernel with commented inet6.

Latest version from ports:
sysinfo-0.8.6 Utility used to gather system configuration information

machine:
FreeBSD test.xxxxxxx 7.1-STABLE FreeBSD 7.1-STABLE #0: Wed Feb 11 15:11:25 EET 2009 root@xxxxxx:/usr/obj/usr/src/sys/TESTPC i386

kamikaze
May 3rd, 2009, 13:37
Test is allergic to empty strings in numeriacal comparisons. I normally use something like this:
value="$(sysctl -n net.inet6.ip6.forwarding 2> /dev/null)"
if [ ${value:-0} -eq ...

danger@
May 3rd, 2009, 22:58
Thanks, it will be fixed in the next release

irado
May 4th, 2009, 13:45
thank you very much.. this is a nice and clever tool, indeed.

trev
May 17th, 2009, 11:10
Version from /ports/sysutils (perhaps the first line of the output should include the version number?)


RAM information

Memory information from dmidecode(8)
Maximum Memory Module Size: 1024 MB
Maximum Total Memory Size: 4096 MB
Maximum Capacity: 2 GB
Number Of Devices: 4


Why 4096 MB but then 2 GB ?

There are just two 2GB DIMMs populating two slots, and two empty slots. The memory module size seems wrong at 1GB. Later dmidecode "Memory module information" has correct "installed size" specified.


System is booted since Sat Apr 11 23:07:16 2009


Maybe better English to say "System is up since ..." or "System was booted on ..."


Currently mounted filesystems:
...
linprocfs on /usr/compat/linux/proc

WARNING: Not found in fstab(5): linprocfs on /usr/compat/linux/proc


It is in /etc/fstab, but as
linprocfs /compat/linux/proc linprocfs

Note: compat is linked to /usr/compat (I believe this is standard.)


Users in wheel group (allowed to use su(1)):
root


Other users are missing because they are not listed in /etc/groups. You need to also check /etc/passwd.


WARNING: bsdstats is supposed to be running, but it doesn't appear to.


"but it doesn't appear to." -> "but it isn't."

Of course, it is a one-shot script, so it'll probably never be running :)


Running services
...
winbindd is not running. <<<<<----- !!
...
Not running services

applix_lic_mgr is not running.
bsdstats is not running.
snmpd is not running.
snmptrapd is not running.
uuidd is not running.
wpa_supplicant is not running.
xfs is not running.


Ooops.

Otherwise, great improvement over the last version I tried 4 pages back :)

danger@
May 17th, 2009, 12:49
Version from /ports/sysutils (perhaps the first line of the output should include the version number?)


Try to run sysinfo with no arguments, that will display its version. The current version in ports is 1.0. Not sure if you run that though (see below).



RAM information

Memory information from dmidecode(8)
Maximum Memory Module Size: 1024 MB
Maximum Total Memory Size: 4096 MB
Maximum Capacity: 2 GB
Number Of Devices: 4


Why 4096 MB but then 2 GB ?

There are just two 2GB DIMMs populating two slots, and two empty slots. The memory module size seems wrong at 1GB. Later dmidecode "Memory module information" has correct "installed size" specified.


This appears like a bug in dmidecode(8). Could you please verify? In that case I cannot fix that for you :(



System is booted since Sat Apr 11 23:07:16 2009


Maybe better English to say "System is up since ..." or "System was booted on ..."


Fixed, thanks.



Currently mounted filesystems:
...
linprocfs on /usr/compat/linux/proc

WARNING: Not found in fstab(5): linprocfs on /usr/compat/linux/proc


It is in /etc/fstab, but as
linprocfs /compat/linux/proc linprocfs

Note: compat is linked to /usr/compat (I believe this is standard.)


I will look at this one this week.



Users in wheel group (allowed to use su(1)):
root


Other users are missing because they are not listed in /etc/groups. You need to also check /etc/passwd.


Heh. Nice one, thanks. I will implement this later this week. I usually don't set wheel group as my users' primary group.



WARNING: bsdstats is supposed to be running, but it doesn't appear to.


"but it doesn't appear to." -> "but it isn't."

Of course, it is a one-shot script, so it'll probably never be running :)


Language fixed. Yeah, I know about this problems with "services" which have rc.d scripts but actually are not a real services... I didn't come up to a proper solution yet :(



Running services
...
winbindd is not running. <<<<<----- !!
...
Not running services

applix_lic_mgr is not running.
bsdstats is not running.
snmpd is not running.
snmptrapd is not running.
uuidd is not running.
wpa_supplicant is not running.
xfs is not running.


Ooops.


Now that is interesting. I had a similar report in the past and I beleive that the current version should not have this bug. Could you please verify that you're actually running 1.0?


Otherwise, great improvement over the last version I tried 4 pages back :)

Thanks :-)
You may want to run the script with -v as well :P

graudeejs
May 17th, 2009, 13:30
Currently loaded kernel modules (kldstat(8)):
zfs.ko
opensolaris.ko
geom_eli.ko
crypto.ko
zlib.ko
snd_ich.ko
sound.ko
acpi.ko
radeon.ko
drm.ko
agp.ko
WARNING: The zfs.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The opensolaris.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The crypto.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The zlib.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The sound.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The acpi.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The radeon.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The drm.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The agp.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.

i boot from flash, and this loader.conf is not synced (just for the record)

Currently mounted filesystems:
/dev/ufs/root on /
devfs on /dev
sys/home on /home
sys/home/Archive on /home/Archive
sys/home/Archive/music on /home/Archive/music
data on /home/Files
data/torrents on /home/Files/torrents
sys/home/Share on /home/Share
sys/home/killasmurf86 on /home/killasmurf86
sys/jails on /jails
sys/jails/test on /jails/test
sys/tmp on /tmp
sys/usr_local on /usr/local
sys/usr_obj on /usr/obj
sys/usr_ports on /usr/ports
sys/usr_ports/distfiles on /usr/ports/distfiles
sys/usr_ports/packages on /usr/ports/packages
sys/usr_src on /usr/src
sys/var on /var

WARNING: Not found in fstab(5): sys/home on /home
WARNING: Not found in fstab(5): sys/home/Archive on /home/Archive
WARNING: Not found in fstab(5): sys/home/Archive/music on /home/Archive/music
WARNING: Not found in fstab(5): data on /home/Files
WARNING: Not found in fstab(5): data/torrents on /home/Files/torrents
WARNING: Not found in fstab(5): sys/home/Share on /home/Share
WARNING: Not found in fstab(5): sys/home/killasmurf86 on /home/killasmurf86
WARNING: Not found in fstab(5): sys/jails on /jails
WARNING: Not found in fstab(5): sys/jails/test on /jails/test
WARNING: Not found in fstab(5): sys/tmp on /tmp
WARNING: Not found in fstab(5): sys/usr_local on /usr/local
WARNING: Not found in fstab(5): sys/usr_obj on /usr/obj
WARNING: Not found in fstab(5): sys/usr_ports on /usr/ports
WARNING: Not found in fstab(5): sys/usr_ports/distfiles on /usr/ports/distfiles
WARNING: Not found in fstab(5): sys/usr_ports/packages on /usr/ports/packages
WARNING: Not found in fstab(5): sys/usr_src on /usr/src
WARNING: Not found in fstab(5): sys/var on /var

ZFS :D
you could check if zfs.ko is loaded, and then run

zpool status
zpool list
zfs list

and probably show warning that zfs is still experimental



Geli information
Name Status Components
ad0.eli N/A ad0
ad4.eli N/A ad4

What should be in status? (just in case it's a bug)
They bough are mounted....


IPv4 addresses:
192.168.128.100 netmask 0xffffff00
192.168.128.99 netmask 0xffffff00

perhaps it's worth mentioning that 192.168.128.99 is alias


These users are allowed to use their own crontab:
root
at can also be source of evil.
You should check it as well


This is output of sysinfo-1.0_1

trev
May 18th, 2009, 15:19
Try to run sysinfo with no arguments, that will display its version. The current version in ports is 1.0. Not sure if you run that though (see below).


SysInfo v1.0 by Daniel Gerzo for FreeBSD Operating System

I could not even read this line on my LCD - bright cyan writing on a bright white background! Also outputting to files is nasty with those control sequences scattered throughout. Yes, I know, use another command line switch, but... not sure many programs default to colour output as they generally follow the principle that you shouldn't surprise your user without good reason, and colour is probably not a good reason and is not a Unix "convention", though it might be a Linux convention (in my very limited Linux experience).


This appears like a bug in dmidecode(8). Could you please verify? In that case I cannot fix that for you :(


I *think* the bug is yours. The 2GB DIMM uses 1Gb memory modules. The maximum total memory size is 4GB (ie max memory for a single slot). This is all correct. I think you are misinterpreting the information. The later dmidecode output is also correct, but is probably what you should be using to say what is actually installed. I hope I have explained it better this time :)

My other comment had to do with some output being in MB and some in GB. I was, subtly, suggesting you pick one and convert consistently to that. So, 4096MB -> 4GB, or 2GB -> 2048MB, but not some being in MB and some being in GB. Picky, I know, but I'm a lawyer and a programmer, and a former editor.


Yeah, I know about this problems with "services" which have rc.d scripts but actually are not a real services... I didn't come up to a proper solution yet :(


Is there not a hint in the scripts? For example:

# PROVIDE: bsdstats
# REQUIRE: LOGIN <<<<-----
# KEYWORD: shutdown

For services which do run all the time, is it not usually REQUIRE: DAEMON ?


Now that is interesting. I had a similar report in the past and I believe that the current version should not have this bug. Could you please verify that you're actually running 1.0?


Yep, I was running v1.0.

danger@
May 18th, 2009, 16:40
SysInfo v1.0 by Daniel Gerzo for FreeBSD Operating System

I could not even read this line on my LCD - bright cyan writing on a bright white background! Also outputting to files is nasty with those control sequences scattered throughout. Yes, I know, use another command line switch, but... not sure many programs default to colour output as they generally follow the principle that you shouldn't surprise your user without good reason, and colour is probably not a good reason and is not a Unix "convention", though it might be a Linux convention (in my very limited Linux experience).

Well I personally don't use white background in my terminal (it's always black) so I didn't realize this problem. However it is possible to disable the colorful output in the config file (/usr/local/etc/sysinfo.conf) if you don't want to use -c switch.

The colors are there mainly because it's easier to distinguish between sections of the output.


I *think* the bug is yours. The 2GB DIMM uses 1Gb memory modules. The maximum total memory size is 4GB (ie max memory for a single slot). This is all correct. I think you are misinterpreting the information. The later dmidecode output is also correct, but is probably what you should be using to say what is actually installed. I hope I have explained it better this time :)

I will need to check further details.


My other comment had to do with some output being in MB and some in GB. I was, subtly, suggesting you pick one and convert consistently to that. So, 4096MB -> 4GB, or 2GB -> 2048MB, but not some being in MB and some being in GB. Picky, I know, but I'm a lawyer and a programmer, and a former editor.


I currently have no plans in changing this :)


Is there not a hint in the scripts? For example:

# PROVIDE: bsdstats
# REQUIRE: LOGIN <<<<-----
# KEYWORD: shutdown

For services which do run all the time, is it not usually REQUIRE: DAEMON ?


Not really:


root@[lightstorm /data/jails/hosting.cia.sk/www/hmc.sk/www]# grep REQUIRE /services/usr/local/etc/rc.d/*
/services/usr/local/etc/rc.d/amavisd:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/clamav-clamd:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/clamav-freshclam:# REQUIRE: LOGIN clamd
/services/usr/local/etc/rc.d/dovecot:# REQUIRE: LOGIN mysql
/services/usr/local/etc/rc.d/mysql-server:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/postfix:# REQUIRE: LOGIN cleanvar mysql
/services/usr/local/etc/rc.d/postgrey:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/rsyncd:# REQUIRE: LOGIN
/services/usr/local/etc/rc.d/sa-spamd:# REQUIRE: LOGIN



Yep, I was running v1.0.


Well that's interesting. I will check then what's going on.

vermaden
October 21st, 2009, 16:03
I would like to mention some bugs/suggestions:

version: sysinfo-1.0.1

CPU usage statistics:
CPU: [3;6H 0.0% user, 0.0% nice, 0.0% system, 0.0% interrupt, 100% idle
Color even with -c in that section.

WARNING: Your CPU supports amd64 architecture, however you are running i386.
WARNING: You may want to switch to amd64 to get a better performance.
... and miss WINE and some MPLAYER codecs, FLASH and more, rather useless WARNING.


WARNING: The linprocfs.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
Its loaded automatically when you mount linprocfs from /etc/fstab, no need for /boot/loader.conf entry.

WARNING: The linux.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
Can be also set in /etc/rc.conf by linux_enable="YES"

WARNING: The wpifw.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
Its loaded by if_wpi.ko, no need for entry.

WARNING: The i915.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
WARNING: The drm.ko module is loaded, however it is not being loaded upon the system boot time from /boot/loader.conf.
These two are loaded automatically by starting xorg.

WARNING: inetd(8) is enabled, however none of its services are enabled. Check /etc/inetd.conf.
Its not enabled and its not running.

WARNING: dmesg is supposed to be running, but it isn't.
WARNING: mixer is supposed to be running, but it isn't.
WARNING: virecover is supposed to be running, but it isn't.
Supossed to? What for?

WARNING: moused is supposed to be running, but it isn't.
WARNING: powerd is supposed to be running, but it isn't.
WARNING: sshd is supposed to be running, but it isn't.
WARNING: syslogd is supposed to be running, but it isn't.
WARNING: devd is supposed to be running, but it isn't.
They are running.

abi is not running.
addswap is not running.
adjkerntz is not running.
archdep is not running.
auto_linklocal is not running.
automounter is not running.
avahi_daemon is not running.
avahi_dnsconfd is not running.
background-fsck is not running.
bluetooth is not running.
bridge is not running.
Useless, most scripts start and end their job.

Regards.

tiko
April 19th, 2010, 03:19
Hi,

Is this no longer available from the author (the link is obviously 404)? If so, does anyone have a copy online they could share?

vermaden
April 19th, 2010, 06:27
@tiko

Use the Ports Luke:
% cat /usr/ports/sysutils/sysinfo/pkg-descr

Sysinfo is a shell script, the purpose of which is to automatically
gather system information and document the hardware and software
configuration of the given host system. The goal is to provide a
system operator with descriptive information about an unknown FreeBSD
installation.

WWW: http://forums.freebsd.org/showthread.php?t=3282