Commit afaba612056ad1311a88e6295e33bbf8dbffc683
1 parent
86fa5b81
add file to gather further system information the gnuish way...for now get the number of cpus
Showing
7 changed files
with
127 additions
and
9 deletions
cf-engine-classes.txt
0 → 100644
| 1 | + 127_0_0_1 | |
| 2 | + 192_168_120_40 | |
| 3 | + 2001_4ba0_ffff_138_1__400 | |
| 4 | +64_bit | |
| 5 | +8_cpus | |
| 6 | +?Day15 | |
| 7 | +?Evening | |
| 8 | +?GMT_Hr17 | |
| 9 | +?Hr18 | |
| 10 | +?Hr18_Q2 | |
| 11 | +?Lcycle_1 | |
| 12 | +?March | |
| 13 | +?Min15_20 | |
| 14 | +?Min17 | |
| 15 | +PK_MD5_1cc0a2b13599f57ebb17df5abdc45ae1 | |
| 16 | +?Q2 | |
| 17 | +?Saturday | |
| 18 | +?Yr2014 | |
| 19 | +agent | |
| 20 | +any | |
| 21 | +cfengine | |
| 22 | +cfengine_3 | |
| 23 | +cfengine_3_5 | |
| 24 | +cfengine_3_5_3 | |
| 25 | +community_edition | |
| 26 | +compiled_on_linux_gnu | |
| 27 | +cpu0_high | |
| 28 | +cpu1_high | |
| 29 | +cpu2_high | |
| 30 | +cpu3_high | |
| 31 | +cpu_high | |
| 32 | +diskfree_high_normal | |
| 33 | +entropy_misc_in_low | |
| 34 | +entropy_misc_out_low | |
| 35 | +entropy_postgresql_in_low | |
| 36 | +entropy_postgresql_out_low | |
| 37 | + fe80__14d8_4dff_fed7_9c59 | |
| 38 | +gentoo | |
| 39 | +inform_mode | |
| 40 | +ipv4_127 | |
| 41 | +ipv4_127_0 | |
| 42 | +ipv4_127_0_0 | |
| 43 | +ipv4_127_0_0_1 | |
| 44 | +ipv4_192 | |
| 45 | +ipv4_192_168 | |
| 46 | +ipv4_192_168_120 | |
| 47 | +ipv4_192_168_120_40 | |
| 48 | +ldap_out_high | |
| 49 | + linux | |
| 50 | + linux_3_12_8_hardened_r1 | |
| 51 | + linux_x86_64 | |
| 52 | + linux_x86_64_3_12_8_hardened_r1 | |
| 53 | + linux_x86_64_3_12_8_hardened_r1__4_SMP_Tue_Mar_4_17_38_20_CET_2014 | |
| 54 | +loadavg_low | |
| 55 | +localhost | |
| 56 | + mac_16_d8_4d_d7_9c_59 | |
| 57 | +net_iface_eth0 | |
| 58 | +net_iface_lo | |
| 59 | +rootprocs_high | |
| 60 | +ssh_in_high | |
| 61 | +test | |
| 62 | +users_high | |
| 63 | +verbose_mode | |
| 64 | + x86_64 | ... | ... |
classes.sh
0 → 100755
| 1 | +#!/bin/dash | |
| 2 | + | |
| 3 | +## | |
| 4 | +# This creates function that will gather some system informations | |
| 5 | +# and propagate them as environment variables. | |
| 6 | +# | |
| 7 | + | |
| 8 | +. ./utils.sh | |
| 9 | +include_once system_information.sh | |
| 10 | +include_once interface_information.sh | |
| 11 | + | |
| 12 | +has_class() { | |
| 13 | + if [ 1 -ne $# ] | |
| 14 | + then | |
| 15 | + logger -p syslog.err 'has_class: no class given' | |
| 16 | + exit 1 | |
| 17 | + fi | |
| 18 | + | |
| 19 | + test "${CLASSES}" != "${CLASSES%${1}*}" | |
| 20 | +} | |
| 21 | + | |
| 22 | +# vim: set ts=4 sw=4: | ... | ... |
gnu_information.sh
0 → 100755
| 1 | +#!/bin/dash | |
| 2 | + | |
| 3 | +## | |
| 4 | +# This creates function that will gather some system informations | |
| 5 | +# and propagate them as environment variables. | |
| 6 | +# | |
| 7 | + | |
| 8 | +. ./utils.sh | |
| 9 | +include_once system_information.sh | |
| 10 | + | |
| 11 | +echo "foo ${NPROC}" | |
| 12 | +CPUS=$(${NPROC}) | |
| 13 | + | |
| 14 | +export CLASSES="${CLASSES}${CPUS}cpus " | |
| 15 | + | |
| 16 | +# vim: set ts=4 sw=4: | ... | ... |
| ... | ... | @@ -10,9 +10,9 @@ |
| 10 | 10 | # |
| 11 | 11 | |
| 12 | 12 | . ./utils.sh |
| 13 | -include_once ./system_information.sh | |
| 14 | -include_once ../sysman/interface_information.sh | |
| 15 | -include_once /home/ghopp/sysman/network_tools.sh | |
| 13 | +include_once system_information.sh | |
| 14 | +include_once interface_information.sh | |
| 15 | +include_once network_tools.sh | |
| 16 | 16 | |
| 17 | 17 | ## |
| 18 | 18 | # report everysthing |
| ... | ... | @@ -24,6 +24,7 @@ ${PRINTF} "%15s : %s\n" "VERSION" "${VERSION}" |
| 24 | 24 | ${PRINTF} "%15s : %s\n" "PLATFORM" "${PLATFORM}" |
| 25 | 25 | ${PRINTF} "%15s : %s\n" "DIST" "${DIST}" |
| 26 | 26 | ${PRINTF} "%15s : %s\n" "HOSTNAME" "${HOSTNAME}" |
| 27 | +${PRINTF} "%15s : %s\n" "CPUS" "${CPUS}" | |
| 27 | 28 | ${PRINTF} "%15s : %s\n" "# INTERFACES" "${NINTERFACES}" |
| 28 | 29 | |
| 29 | 30 | NO=1 |
| ... | ... | @@ -44,3 +45,4 @@ echo $(mask2cidr 255.255.128.0) |
| 44 | 45 | echo $(cidr2mask 17) |
| 45 | 46 | eval echo \$\(cidr2mask $(mask2cidr 255.255.128.0)\) |
| 46 | 47 | |
| 48 | +# vim: set ts=4 sw=4: | ... | ... |
| ... | ... | @@ -12,7 +12,7 @@ then |
| 12 | 12 | |
| 13 | 13 | if [ 1 -ne $# ] |
| 14 | 14 | then |
| 15 | - logger -p syslog.err 'filename2sybol: missing filename' | |
| 15 | + ${LOGGER} -p syslog.err 'filename2sybol: missing filename' | |
| 16 | 16 | exit 1 |
| 17 | 17 | fi |
| 18 | 18 | |
| ... | ... | @@ -29,11 +29,16 @@ then |
| 29 | 29 | echo "${SYM}" |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - canonify_name() { | |
| 32 | + ## | |
| 33 | + # create an absolute filename from a given relative one. | |
| 34 | + # This deals only with leading ./ and ../ it does not | |
| 35 | + # handle then when they are in the middle of the name. | |
| 36 | + # | |
| 37 | + abs_filename() { | |
| 33 | 38 | local FILE="${1}" |
| 34 | 39 | local DIR="${PWD}" |
| 35 | 40 | |
| 36 | - # if FILE starts with a / its already canonified | |
| 41 | + # if FILE starts with a / its already absolute | |
| 37 | 42 | if [ "${FILE}" != ${FILE#/} ] |
| 38 | 43 | then |
| 39 | 44 | echo "${FILE}" |
| ... | ... | @@ -56,19 +61,19 @@ then |
| 56 | 61 | } |
| 57 | 62 | |
| 58 | 63 | include_once() { |
| 59 | - local FILE="$(canonify_name "${1}")" | |
| 64 | + local FILE="$(abs_filename "${1}")" | |
| 60 | 65 | local SYM="$(filename2symbol "${FILE}")" |
| 61 | 66 | |
| 62 | 67 | if [ 1 -ne $# ] |
| 63 | 68 | then |
| 64 | - logger -p syslog.err 'include_once: missing filename' | |
| 69 | + ${LOGGER} -p syslog.err 'include_once: missing filename' | |
| 65 | 70 | exit 1 |
| 66 | 71 | fi |
| 67 | 72 | |
| 68 | 73 | if eval [ -z \"\${SOURCED_${SYM}}\" ] |
| 69 | 74 | then |
| 70 | - . ${FILE} | |
| 71 | 75 | eval export SOURCED_${SYM}=\"\${FILE}\" |
| 76 | + . ${FILE} | |
| 72 | 77 | fi |
| 73 | 78 | } |
| 74 | 79 | |
| ... | ... | @@ -88,6 +93,7 @@ then |
| 88 | 93 | [ -z "${TR}" ] && TR="$(${WHICH} tr)" |
| 89 | 94 | [ -z "${PRINTF}" ] && PRINTF="$(${WHICH} printf)" |
| 90 | 95 | [ -z "${LOGGER}" ] && LOGGER="$(${WHICH} logger)" |
| 96 | + [ -z "${NPROC}" ] && NPROC="$(${WHICH} nproc)" | |
| 91 | 97 | [ -z "${IP}" ] && IP="$(${WHICH} ip)" |
| 92 | 98 | [ -z "${IFCONFIG}" ] && IFCONFIG="$(${WHICH} ifconfig)" |
| 93 | 99 | ... | ... |
Please
register
or
login
to post a comment