2d275
![]() |
|
|
|
|
|||||||
| Userland Programming & Scripting C, C++, Python, Perl, Shell, etc. |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
||||
|
||||
|
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.
__________________
Looking for administrator? http://www.syscare.sk |
| The Following 4 Users Say Thank You to danger@ For This Useful Post: | ||
fender0107401 (April 21st, 2009), hbokh (April 19th, 2009), mfaridi (April 15th, 2009), tingo (July 15th, 2011) | ||
|
#2
|
||||
|
||||
|
I get an error in the part handled by the 020-mem script.
Code:
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 Code:
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
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki Before you post: How to ask questions the smart way If you must know .. So, what does an Administrator/Moderator do? ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#3
|
||||
|
||||
|
does http://people.freebsd.org/~rse/dist/freebsd-memory work for you well?
__________________
Looking for administrator? http://www.syscare.sk Last edited by DutchDaemon; April 8th, 2009 at 20:17. |
|
#4
|
|||
|
|||
|
no errors and all true
Code:
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
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 Last edited by DutchDaemon; April 8th, 2009 at 20:16. Reason: QINC! [quote] is not [code] |
|
#5
|
||||
|
||||
|
Quote:
Code:
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
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki Before you post: How to ask questions the smart way If you must know .. So, what does an Administrator/Moderator do? ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#6
|
|||
|
|||
|
I also get an error in the memory section:
Code:
expr: illegal option -- 1 usage: expr [-e] expression expr: syntax error Code:
physmem: 3744890880 activemem: 140959744 inactmem: -1125810176 cachemem: 142274560 allmem: -616513536 wiremem: 211468288 freemem: 13770752 Code:
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 |
|
#7
|
||||
|
||||
|
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.
__________________
Looking for administrator? http://www.syscare.sk |
|
#8
|
||||
|
||||
|
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.
__________________
Looking for administrator? http://www.syscare.sk |
|
#9
|
||||
|
||||
|
what does
% expr 3744890880 / 1048576 give you?
__________________
Looking for administrator? http://www.syscare.sk |
|
#10
|
|||
|
|||
|
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: Code:
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% |
|
#11
|
||||
|
||||
|
I thought that will be a problem
![]() can you please test http://people.freebsd.org/~danger/sy...9-alpha.tar.gz for me?
__________________
Looking for administrator? http://www.syscare.sk |
|
#12
|
||||
|
||||
|
Daniel, that's a very nice script!
![]() Code:
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 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 Code:
Default route: 192.168.10.1 |
|
#13
|
|||
|
|||
|
Quote:
|
|
#14
|
||||
|
||||
|
No errors here.
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki Before you post: How to ask questions the smart way If you must know .. So, what does an Administrator/Moderator do? ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
|
#15
|
|||
|
|||
|
Code:
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
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
|
|
#16
|
||||
|
||||
|
Quote:
Could you please send me the output of your ifconfig, so I can fix it for P2P devices? Feature added in my local version, thanks for an idea. Quote:
Quote:
![]() It's nice to hear such words, thanks ![]() Actually it's being developed as part of my bachelor thesis.
__________________
Looking for administrator? http://www.syscare.sk Last edited by danger@; April 9th, 2009 at 23:55. |
|
#17
|
||||
|
||||
|
Quote:
I will release new version probably during the weekend so you will be welcome to test it ![]() Quote:
Quote:
__________________
Looking for administrator? http://www.syscare.sk |
|
#18
|
|||
|
|||
|
Quote:
Code:
% 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
Code:
% 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
![]() And one more small thing, when started without parameters it show help message followed by Code:
./sysinfo: ERROR: Not enough arguments provided. |
|
#19
|
|||
|
|||
|
The script seems to work correctly on my Soekris.
|
|
#20
|
||||
|
||||
|
Hello guys,
I have packaged a new version of my script. It can be downloaded from http://people.freebsd.org/~danger/sy...-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!
__________________
Looking for administrator? http://www.syscare.sk |
|
#21
|
|||
|
|||
|
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. |
|
#22
|
|||
|
|||
|
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 Code:
Cannot 'status' snmpd. Set snmpd_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'. |
|
#23
|
|||||||||
|
|||||||||
|
Quote:
Quote:
Quote:
Quote:
![]() Quote:
Quote:
Quote:
Quote:
Quote:
Nice job! |
|
#24
|
||||
|
||||
|
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/sy...-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.
__________________
Looking for administrator? http://www.syscare.sk |
|
#25
|
||||
|
||||
|
Two quirks:
Double: Code:
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 Code:
Firewall related information: [: -ne: unexpected operator
__________________
FreeBSD Forums: Information for New Members | FreeBSD Forums Rules FreeBSD Resources: The FreeBSD Handbook | Manuals | FAQ | Wiki Before you post: How to ask questions the smart way If you must know .. So, what does an Administrator/Moderator do? ---> Do not PM me with FreeBSD questions. I do not work here. <--- |
![]() |
| Tags |
| sysinfo, system configuration, system documentation |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Useful scripts | Dr_Phoenix | Userland Programming & Scripting | 216 | May 7th, 2013 12:40 |
| [Solved] [OpenVPN] How to set up a client? | fonz | Web & Network Services | 9 | February 18th, 2009 16:08 |
| a couple of scripts for screen users | rbelk | Userland Programming & Scripting | 13 | February 11th, 2009 23:20 |
| how to set time? | hirohitosan | General | 13 | January 22nd, 2009 11:42 |
| Blender & external scripts directory | Ole | Installation and Maintenance of FreeBSD Ports or Packages | 1 | December 25th, 2008 22:24 |