#!/bin/bash # # 2007/10/23 gabriel # 2010/11/03 gabriel # 2011/03/30 gabriel - make it generic SITE_NAME='' REMOTE_SERVER=localhost REMOTE_USER='' REMOTE_FOLDER=/var/www/klask/ GRAPH_MODULO=9 GRAPH_SHIFT=1 if [ -f /etc/klask/push-web.conf ] then . /etc/klask/push-web.conf fi TMP='/tmp/klask-push-web' # local command MKDIR=/bin/mkdir DATE=/bin/date CAT=/bin/cat TAIL=/usr/bin/tail HEAD=/usr/bin/head SSH=/usr/bin/ssh SCP=/usr/bin/scp KLASK=/usr/sbin/klask RSYNC=/usr/bin/rsync # remote command DOT=/usr/bin/dot $MKDIR -p ${TMP} if [ ! -d ${TMP} ] then echo "Error: Folder ${TMP} do not exist !" exit 1 fi cd ${TMP} LOCALTIME=$($DATE "+%Y-%m-%d %H:%M") $KLASK exportsw --format dot --modulo ${GRAPH_MODULO} --shift ${GRAPH_SHIFT} > ${TMP}/switch-map.txt $KLASK exportdb > ${TMP}/hostname-db.txt $KLASK exportsw > ${TMP}/switch-db.txt $KLASK ip-free > ${TMP}/ipfree-db.txt $KLASK bad-vlan-id > ${TMP}/badvlan-db.txt $CAT < ${TMP}/index.html

Klask Tool for mapping (png|svg) the local network [${LOCALTIME}] - site ${SITE_NAME}

The main raw results of Klask are accessible directly, via wget or curl for example, for a specific treatment: Computers, Switches, IP available, Bad VLAN ID, Map.

END $KLASK exportdb --format html >> ${TMP}/index.html $CAT <> ${TMP}/index.html END $CAT < ${TMP}/ip-free.html

Klask Tool for mapping (png|svg) the local network [${LOCALTIME}] - site ${SITE_NAME}

The main raw results of Klask are accessible directly, via wget or curl for example, for a specific treatment: Computers, Switches, IP available, Bad VLAN ID, Map.

END $KLASK ip-free --format html >> ${TMP}/ip-free.html $CAT <> ${TMP}/ip-free.html
END $CAT < ${TMP}/bad-vlan-id.html

Klask Tool for mapping (png|svg) the local network [${LOCALTIME}] - site ${SITE_NAME}

The main raw results of Klask are accessible directly, via wget or curl for example, for a specific treatment: Computers, Switches, IP available, Bad VLAN ID, Map.

END $KLASK bad-vlan-id --format html >> ${TMP}/bad-vlan-id.html $CAT <> ${TMP}/bad-vlan-id.html END if [ "${REMOTE_SERVER}" = "localhost" ] then $RSYNC \ /usr/share/klask/sorttable-klask.js \ /usr/share/klask/style-klask.css \ ${TMP}/index.html \ ${TMP}/ip-free.html \ ${TMP}/bad-vlan-id.html \ ${TMP}/*-db.txt \ ${TMP}/switch-map.txt \ ${REMOTE_FOLDER}/ [ -x ${DOT} ] && (cd ${REMOTE_FOLDER}; ${DOT} -T svg switch-map.txt > switch-map.svg; ${DOT} -T png switch-map.txt > switch-map.png) else $RSYNC \ /usr/share/klask/sorttable-klask.js \ /usr/share/klask/style-klask.css \ ${TMP}/index.html \ ${TMP}/ip-free.html \ ${TMP}/bad-vlan-id.html \ ${TMP}/*-db.txt \ ${TMP}/switch-map.txt \ ${REMOTE_USER}@${REMOTE_SERVER}:${REMOTE_FOLDER}/ $SSH ${REMOTE_USER}@${REMOTE_SERVER} "(cd ${REMOTE_FOLDER}; ${DOT} -T svg switch-map.txt > switch-map.svg; ${DOT} -T png switch-map.txt > switch-map.png)" fi