diff --git a/check-samba b/check-samba deleted file mode 100755 index 401a68b7..00000000 --- a/check-samba +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/zsh -## -## check-samba -## -## Made by stransky -## Login stransky -## -## Started on jeu 01 oct 2000 19:25:35 CET Jérôme Kieffer -## Last update sam 01 fév 2003 00:24:11 CET Nicolas STRANSKY -## -# surveillance de nmbd - -LOG=/var/log/cransMisc/samba-master.log - -master=$(smbclient -N -L zamok |grep -A20 "Workgroup *Master" |grep ' CRANS ' | awk '{print $2}') - -if [ "$master" != 'ZAMOK' ]; -then - echo "$(date) : Crans local master is \"$master\" ; waiting to confirm..." >> $LOG - # on attend pour être sûr que zamok n'est pas justement en train de déclencher une élection : - sleep 35 - # on refait le test : - master=$(smbclient -N -L zamok |grep -A20 "Workgroup *Master" |grep ' CRANS ' | awk '{print $2}') - # Si on est sûr que ça chie, on sort les armes : - if [ "$master" != 'ZAMOK' ]; - then - echo "$(date) : Crans local master is \"$master\" ; restarting samba" >> $LOG - echo -n "$(date) : " >> $LOG - /id/samba stop >> $LOG 2>&1 - sleep 1 - echo -n "$(date) : " >> $LOG - (killall -9 nmbd && echo "remaining nmbd process killed") >> $LOG 2>&1 # tant qu'à faire on peut killer complètement nmbd - echo -n "$(date) : " >> $LOG - /id/samba start >> $LOG 2>&1 - else - echo "$(date) : Well done, good boy" >> $LOG - fi -fi diff --git a/mailcrans.sh b/mailcrans.sh deleted file mode 100755 index f885322a..00000000 --- a/mailcrans.sh +++ /dev/null @@ -1,67 +0,0 @@ -#! /bin/sh - -# The author of this code is Manuel Sabban -# -# Copyright (c) 2002, 2004 Vincent Bernat, Manuel Sabban. -# -# Permission to use, copy, and modify this software with or without fee -# is hereby granted, provided that this entire notice is included in -# all source code copies of any software which is or includes a copy or -# modification of this software. -# -# THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR -# IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY -# REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE -# MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR -# PURPOSE. - -# Envoie un mail à tous les adhérents ayant un compte sur zamok, c'est-à-dire -# ceux qui ont une adresse mail en @crans.org - -# Emplacement temporaire de la liste d'adresses email -EMAILS=/tmp/emails$$ - -# Fichier contenant les adresses vers lesquelles l'envoi n'a pas réussi -FAILED=/tmp/failed$$ - -# Canevas du mail -CANEVAS=/tmp/canevas$$ - -# En cas d'interruption du script, on efface les fichiers temporaires -trap "rm -f $EMAILS $CANEVAS 2> /dev/null ; exit 5" 1 2 15 0 - -# Construction de la liste des adresses mails -ldapsearch -LLL -x 'uid=*' uid | awk -F': ' '/^uid: / {print $2"@crans.org"}' >$EMAILS - -# Construction du canevas du mail -echo "From: Crans "> $CANEVAS -# Edition du mail - -echo -n "Subject: " >> $CANEVAS - -${EDITOR:-"jed"} $CANEVAS -echo >> $CANEVAS - -# Visualisation du mail -cat $CANEVAS -echo -echo '--------------' -echo 'Ce mail va être envoyé à tous les adhérents. Entrée pour continuer, Ctrl-C pour arrêter.' -read - -# Envoi du mail à toutes les adresses comprises dans `EMAILS' -# Les envois non réussis sont stockés dans $FAILED. -rm -f $FAILED 2> /dev/null - -while read EMAIL -do - echo -n "Envoi à $EMAIL... " - cat $CANEVAS | formail -I "To: $EMAIL" | sendmail $EMAIL || (echo -n "Pas " ; echo $MAIL >> FAILED) - echo "OK" -done < $EMAILS - -if [ -f $FAILED ]; then - echo "Il y a eu des erreurs, voir $FAILED pour les adresses emails qui ont posé problème." -fi - -echo "Terminé." diff --git a/snmp/Des5200.mib b/snmp/Des5200.mib deleted file mode 100644 index b86012d8..00000000 --- a/snmp/Des5200.mib +++ /dev/null @@ -1,1277 +0,0 @@ --- DES-3216 SWITCH HUB MIB V0.02 08/02/97 - - DES3216-MIB - - DEFINITIONS ::= BEGIN - - IMPORTS - enterprises, IpAddress, - TimeTicks,Counter - FROM RFC1155-SMI - DisplayString, PhysAddress - FROM RFC1213-MIB - TRAP-TYPE - FROM RFC-1215 - OBJECT-TYPE - FROM RFC-1212; - - -- OwnerString ::= DisplayString - -- This data type is used to model an administratively - -- assigned name of the owner of a resource. This - -- information is taken from the NVT ASCII character set. - -- It is suggested that this name contain one or more - -- of the following: - -- IP address, management station name, network manager's - -- name, location, or phone number. - -- SIZE (0..xx) - - - dlink OBJECT IDENTIFIER ::= { enterprises 171 } - dlink-products OBJECT IDENTIFIER ::= { dlink 10 } - dlink-Des3216Prod OBJECT IDENTIFIER ::= { dlink-products 9 } - dlink-Des3216ProdId OBJECT IDENTIFIER ::= { dlink-Des3216Prod 1 } - des3216SwHub OBJECT IDENTIFIER ::= { dlink-Des3216Prod 2 } - - - dlink-mgmt OBJECT IDENTIFIER ::= { dlink 11 } - - agentConfigInfo OBJECT IDENTIFIER ::= { dlink-mgmt 1 } - des3216series OBJECT IDENTIFIER ::= { dlink-mgmt 9 } - - -- agentBasicInfo - - agentBasicInfo OBJECT IDENTIFIER ::= { agentConfigInfo 1 } - - agentRuntimeSwVersion OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..12)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This is a textual description of the runtime software version - and revision. If the version number is one and revision number is - zero agentRuntimeSwVersion would be 'Ver. 1.0'" - ::= { agentBasicInfo 1 } - - agentPromFwVersion OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..12)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This is a textual description of the agent PROM firmware version - and revision. If the version number is one and revision number is - zero agentPromFwVersion would be 'Ver. 1.0'" - ::= { agentBasicInfo 2 } - - agentHwRevision OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..12)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This is a textual description of the hardware revision. - The display string should look like 'Rev. A1'" - ::= { agentBasicInfo 3 } - - agentMgmtProtocolCapability OBJECT-TYPE - SYNTAX INTEGER { - other(1), - snmp-ip(2), - snmp-ipx(3), - snmp-ip-ipx(4) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The network management protocol(s) supported by this agent." - ::= { agentBasicInfo 4 } - - -- agentMibcapabilityTable - - agentMibCapabilityTable OBJECT-TYPE - SYNTAX SEQUENCE OF AgentMibCapabilityEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of MIB capability entries supported by this agent." - ::= { agentBasicInfo 5 } - - agentMibCapabilityEntry OBJECT-TYPE - SYNTAX AgentMibCapabilityEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A MIB capability entry contains objects describing a particular MIB - supported by this agent." - INDEX { agentMibCapabilityIndex } - ::= { agentMibCapabilityTable 1 } - - AgentMibCapabilityEntry ::= SEQUENCE { - agentMibCapabilityIndex - INTEGER, - agentMibCapabilityDescr - DisplayString, - agentMibCapabilityVersion - INTEGER, - agentMibCapabilityType - INTEGER - } - - agentMibCapabilityIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "A list of agentMibCapabilityDescr entries." - ::= { agentMibCapabilityEntry 1 } - - agentMibCapabilityDescr OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..16)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The name of the MIB supported by the agent." - - ::= { agentMibCapabilityEntry 2 } - - agentMibCapabilityVersion OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The version of the MIB specified in this entry." - ::= { agentMibCapabilityEntry 3 } - - agentMibCapabilityType OBJECT-TYPE - SYNTAX INTEGER { - other(1), - standard(2), - proprietary(3), - experiment(4) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The type of the MIB specified in this entry." - ::= { agentMibCapabilityEntry 4 } - - -- agentMgmtRole OBJECT-TYPE - -- SYNTAX INTEGER { - -- other(1), - -- primary-master(2), - -- backup-master(3) - -- } - -- ACCESS read-only - -- STATUS mandatory - -- DESCRIPTION - -- "The role of this agent within this particular hub stack" - -- ::= { agentBasicInfo 6 } - - - -- agentBasicConfig - - agentBasicConfig OBJECT IDENTIFIER ::= { agentConfigInfo 2 } - - agentSwUpdateMode OBJECT-TYPE - SYNTAX INTEGER { - other(1), - network-load(2), - out-of-band-load(3) - } - ACCESS read-write - STATUS - mandatory - DESCRIPTION - "The download media used by the system to download the - runtime software." - ::= { agentBasicConfig 1 } - - agentSwUpdateCtrl OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Current status of software download control. The setting - is effective the next time you reset or power on the hub." - ::= { agentBasicConfig 2 } - - agentBootFile OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..64)) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The name of the file to be downloaded from the TFTP server when - software update is enabled." - ::= { agentBasicConfig 3 } - - agentSystemReset OBJECT-TYPE - SYNTAX INTEGER { - other(1), - reset(2), - no-reset(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object indicates the agent system reset state. - Setting this object to no-reset(3) has no effect. - Setting this object to reset(2) will reset the agent. - The agent always returns no-reset(3) when this object is read." - ::= { agentBasicConfig 4 } - - agentRs232PortConfig OBJECT-TYPE - SYNTAX INTEGER { - other(1), - console(2), - out-of-band(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The current setting of RS-232C port. - The RS-232C port can be configured as the console port or - used for out-of-band connection." - ::= { agentBasicConfig 5 } - - agentOutOfBandBaudRateConfig OBJECT-TYPE - SYNTAX INTEGER { - other(1), - baudRate-1200 (2), - baudRate-2400 (3), - baudRate-9600 (4), - baudRate-19200(5) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The baud rate setting for out of band connection. - The baud rate for the console interface is always 9600." - ::= { agentBasicConfig 6 } - - agentOutOfBandDialNumber OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..32)) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The dial out phone number for out of band to establish - a connection. This entry is used for reference only." - ::= { agentBasicConfig 7 } - - - - -- agentIpProtocolConfig - - agentIpProtoConfig OBJECT IDENTIFIER ::= { agentConfigInfo 3 } - - agentIpNumOfIf OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The total number of IP interfaces supported by this agent." - ::= { agentIpProtoConfig 1 } - - agentIpIfTable OBJECT-TYPE - SYNTAX SEQUENCE OF AgentIpIfEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of IP interface entries supported by the agent." - ::= { agentIpProtoConfig 2 } - - agentIpIfEntry OBJECT-TYPE - SYNTAX AgentIpIfEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "An agentIPIfEntry contains information about a particular - IP interface." - INDEX { agentIpIfIndex } - ::= { agentIpIfTable 1 } - - AgentIpIfEntry ::= SEQUENCE { - agentIpIfIndex - INTEGER, - agentIpIfAddress - IpAddress, - agentIpIfNetMask - IpAddress, - agentIpIfDefaultRouter - IpAddress, - agentIpIfMacAddr - PhysAddress, - agentIpIfType - INTEGER - } - - agentIpIfIndex OBJECT-TYPE - SYNTAX INTEGER (1..255) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object uniquely identifies the IP interface number - in agentIpIfTable. - This value should never greater than agentIpNumOfIf" - ::= { agentIpIfEntry 1 } - - agentIpIfAddress OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The IP address of the interface." - ::= { agentIpIfEntry 2 } - - agentIpIfNetMask OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The IP net mask for this interface." - ::= { agentIpIfEntry 3 } - - agentIpIfDefaultRouter OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The default gateway for this IP interface." - ::= { agentIpIfEntry 4 } - - agentIpIfMacAddr OBJECT-TYPE - SYNTAX PhysAddress - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The MAC address of this IP interface. - For interfaces which do not have such an address - (e.g., a serial line), this object should contain - an octet string of zero length." - ::= { agentIpIfEntry 5 } - - agentIpIfType OBJECT-TYPE - SYNTAX INTEGER { - other(1), -- none of the following - ethernet-csmacd(6), - slip(28) -- generic SLIP - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The physical layer interface of the IP interface." - ::= { agentIpIfEntry 6 } - - agentIpBootServerAddr OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The IP Address of Boot Server." - ::= { agentIpProtoConfig 3 } - - agentIpBootProtocol OBJECT-TYPE - SYNTAX INTEGER { - other(1), - bootp-tftp(2), - tftp(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The software download protocol used for software update." - ::= { agentIpProtoConfig 4 } - - agentIpGetIpFromBootpServer OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object indicates whether the agent get its system IP address - from BootP server at start up." - ::= { agentIpProtoConfig 5 } - - agentIpUnauthAddr OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The IP address of an unauthorized SNMP packet." - ::= { agentIpProtoConfig 6 } - - agentIpUnauthComm OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..20)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The community string of an unauthorized SNMP packet." - ::= { agentIpProtoConfig 7 } - - agentIpLastBootServerAddr OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The last IP address used as Boot server IP address." - ::= { agentIpProtoConfig 8 } - - agentIpLastIpAddr OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The last IP address used as the agent system IP address." - ::= { agentIpProtoConfig 9 } - - -- agentIptrapMangerTable - - agentIpTrapManagerTable OBJECT-TYPE - SYNTAX SEQUENCE OF AgentIpTrapManagerEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of trap manager entries to which to send SNMP traps ." - ::= { agentIpProtoConfig 10 } - - agentIpTrapManagerEntry OBJECT-TYPE - SYNTAX AgentIpTrapManagerEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "This entry contains the particular trap manager settings." - INDEX { agentIpTrapManagerIpAddr } - ::= { agentIpTrapManagerTable 1 } - - AgentIpTrapManagerEntry ::= SEQUENCE { - agentIpTrapManagerIpAddr - IpAddress, - agentIpTrapManagerComm - DisplayString, - agentIpTrapManagerStatus - INTEGER - } - - agentIpTrapManagerIpAddr OBJECT-TYPE - SYNTAX IpAddress - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The IP address to receive SNMP traps from this device." - ::= { agentIpTrapManagerEntry 1 } - - agentIpTrapManagerComm OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..20)) - ACCESS read-write - STATUS mandatory - DESCRIPTION - "The community string of the SNMP trap packet sent to - the trap manager." - ::= { agentIpTrapManagerEntry 2 } - - agentIpTrapManagerStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object indicates whether or not the trap should be send to this - trap manager." - ::= { agentIpTrapManagerEntry 3 } - - - - des3216MIB OBJECT IDENTIFIER ::= { des3216series 1 } - swDevicePackage OBJECT IDENTIFIER ::= { des3216MIB 1 } - swPortPackage OBJECT IDENTIFIER ::= { des3216MIB 2 } - - swDeviceInfo OBJECT IDENTIFIER ::= { swDevicePackage 1 } - - swDevInfoTotalNumOfPort OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of ports within this switch hub. This value - is the sum of the ports of each group within this - switch hub." - ::= { swDeviceInfo 1 } - - swDevInfoNumOfPortOnUse OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of ports in this switch hub connected to the - segment or end stations." - ::= { swDeviceInfo 2 } - - -- swDevInfoSerialNum OBJECT-TYPE - -- SYNTAX INTEGER - -- ACCESS read-only - -- STATUS mandatory - -- DESCRIPTION - -- "The serial number of this switch hub." - -- ::= { swDeviceInfo 3 } - - swDevInfoDesc OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..64)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "A textual description of this switch hub." - ::= { swDeviceInfo 3 } - - -- swDevInfoRepeaterType OBJECT-TYPE - -- SYNTAX INTEGER { - -- other(1), - -- baseband-10-Mb(2), - -- baseband-100-Mb-class-I(3), - -- baseband-100-Mb-class-II(4) - -- } - -- ACCESS read-only - -- STATUS mandatory - -- DESCRIPTION - -- "This objects indicates the CSMA/CD repeater type. The type - -- value matches the clause number of the standard that specifies - -- the particular repeater, with further numerical identification - -- for the repeater classes within the same clause." - -- ::= { swDeviceInfo 5 } - - swDevInfoPortType OBJECT-TYPE - SYNTAX INTEGER { - other(1), - portType-UTP(2), - portType-AUI(3), - portType-Fiber(4), - portType-BNC(5), - portType-Option-module-RAS(6), - portType-Option-module-100Bridge(7) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The connector type of this port." - ::= { swDeviceInfo 4 } - - swDevInfoHwRev OBJECT-TYPE - SYNTAX DisplayString (SIZE (0..12)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "A textual description of the hardware revision of - this switch bub." - ::= { swDeviceInfo 5 } - - swDevInfoSystemUpTime OBJECT-TYPE - SYNTAX TimeTicks - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The value of sysUpTime at the time the switch - entered its current operational state. If the - current state was entered prior to the last re- - initialization, then this object contains a zero - value." - ::= { swDeviceInfo 6 } - - swDevInfoFrontPanelLedStatus OBJECT-TYPE - SYNTAX OCTET STRING (SIZE (0..127)) - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The current status of front panel LED." - ::= { swDeviceInfo 7 } - - -- swDevInfoMdiSwitch OBJECT-TYPE - -- SYNTAX INTEGER { - -- other(1), - -- mdi(2), - -- mdi-x(3) - -- } - -- ACCESS read-only - -- STATUS mandatory - -- DESCRIPTION - -- "The current setting of the MDI switch." - -- ::= { swDeviceInfo 9 } - - swDevInfoDramSize OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The DRAM size of the switch hub" - ::= { swDeviceInfo 8 } - - swDevInfoGroupTypeTable OBJECT-TYPE - SYNTAX SEQUENCE OF SwDevInfoGroupTypeEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of MIB capability entries supported by this agent." - ::= { swDeviceInfo 9 } - - swDevInfoGroupTypeEntry OBJECT-TYPE - SYNTAX SwDevInfoGroupTypeEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A MIB capability entry contains objects describing a particular MIB - supported by this agent." - INDEX { swDevInfoGroupIndex } - ::= { swDevInfoGroupTypeTable 1 } - - SwDevInfoGroupTypeEntry ::= SEQUENCE { - swDevInfoGroupIndex - INTEGER, - swDevInfoGroupMediaType - INTEGER - } - - swDevInfoGroupIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - ::= { swDevInfoGroupTypeEntry 1 } - - swDevInfoGroupMediaType OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - ::= { swDevInfoGroupTypeEntry 2 } - - - - - swDeviceCtl OBJECT IDENTIFIER ::= { swDevicePackage 2 } - - swDevCtrlDisableLearningState OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This Object indicate the switch hub wether or not learn any - new addresses from the Ethernet ports." - ::= { swDeviceCtl 1 } - - swDevCtrlReset OBJECT-TYPE - SYNTAX INTEGER { - other(1), - reset(2), - no-reset(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "This object indicates the switch hub reset state. - Setting this object to no-reset(3) has no effect. - Setting this object to reset(2) will reset the agent. - The agent always returns no-reset(3) when this object is read." - ::= { swDeviceCtl 2 } - - swPortInfoTable OBJECT-TYPE - SYNTAX SEQUENCE OF SwPortInfoEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of port information entries." - ::= { swPortPackage 1 } - - swPortInfoEntry OBJECT-TYPE - SYNTAX SwPortInfoEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "This entry contains the port information, like porttype, - linkstatus..." - INDEX { swPortInfoGroupIndex,swPortInfoIndex } - ::= { swPortInfoTable 1 } - - SwPortInfoEntry ::= SEQUENCE { - swPortInfoGroupIndex - INTEGER, - swPortInfoIndex - INTEGER, - swPortInfoType - INTEGER, - swPortInfoPartitionStatus - INTEGER, - swPortInfoLinkStatus - INTEGER, - swPortInfoDuplexMode - INTEGER, - swPortInfoNegotiationStatus - INTEGER, - swPortInfoSpeedStatus - INTEGER - } - - swPortInfoGroupIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object identifies the port within the group for - which this entry contains infomation." - ::= { swPortInfoEntry 1 } - - swPortInfoIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object indicate switch hub port number." - ::= { swPortInfoEntry 2 } - - swPortInfoType OBJECT-TYPE - SYNTAX INTEGER { - other(1), - portType-UTP(2), - portType-AUI(3), - portType-Fiber(4), - portType-BNC(5), - portType-Option-module-RAS(6), - portType-Option-module-100Bridge(7) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The connector type of this port." - ::= { swPortInfoEntry 3 } - - swPortInfoPartitionStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - no-partion(2), - partion(3) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This Object indicate the port partition status." - ::= { swPortInfoEntry 4 } - - swPortInfoLinkStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - link-pass(2), - link-fail(3) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This Object indicate the port link test status." - ::= { swPortInfoEntry 5 } - - swPortInfoDuplexMode OBJECT-TYPE - SYNTAX INTEGER { - other(1), - half(2), - full(3) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This Object indicate the port work in which duplex mode." - ::= { swPortInfoEntry 6 } - - swPortInfoNegotiationStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This Object indicate the port work in auto negotiation - enabled or disabled." - ::= { swPortInfoEntry 7 } - - swPortInfoSpeedStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - speed-10M(2), - speed-100M(3) - } - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This Object indicate the port trasmit rate is in 10M bps - or 100M bps ." - ::= { swPortInfoEntry 8 } - - swPortCtrlTable OBJECT-TYPE - SYNTAX SEQUENCE OF SwPortCtrlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of port state control entries." - ::= { swPortPackage 2 } - - swPortCtrlEntry OBJECT-TYPE - SYNTAX SwPortCtrlEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "This entry control the port state, like filter broadcast, - linkstatus..." - INDEX { swPortCtrlGroupIndex,swPortCtrlIndex } - ::= { swPortCtrlTable 1 } - - SwPortCtrlEntry ::= SEQUENCE { - swPortCtrlGroupIndex - INTEGER, - swPortCtrlIndex - INTEGER, - swPortCtrlAdminState - INTEGER, - swPortCtrlDuplexState - INTEGER, - swPortCtrlLinkStatusAlarmState - INTEGER, - swPortCtrlFilterBcastState - INTEGER, - swPortCtrlForwardUnknowState - INTEGER, - swPortCtrlPartitionStatus - INTEGER, - swPortCtrlNegotiationStatus - INTEGER, - swPortCtrlSpeedStatus - INTEGER - } - - swPortCtrlGroupIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object identifies the port within the group for - which this entry contains infomation." - ::= { swPortCtrlEntry 1 } - - swPortCtrlIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object indicate switch hub port number." - ::= { swPortCtrlEntry 2 } - - swPortCtrlAdminState OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Port control administration state." - ::= { swPortCtrlEntry 3 } - - swPortCtrlDuplexState OBJECT-TYPE - SYNTAX INTEGER { - other(1), - half(2), - full(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Indicating the port work in half/full duplex mode." - ::= { swPortCtrlEntry 4 } - - swPortCtrlLinkStatusAlarmState OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Depending on this object to determine wether send a trap or - not when link status change ." - ::= { swPortCtrlEntry 5 } - - swPortCtrlFilterBcastState OBJECT-TYPE - SYNTAX INTEGER { - other(1), - forward(2), - discard(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Port control filter broadcast to all port or discard." - ::= { swPortCtrlEntry 6 } - - swPortCtrlForwardUnknowState OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Port control forward unknow packet state." - ::= { swPortCtrlEntry 7 } - - swPortCtrlPartitionStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Depending on this object determine to send a trap or not when - the port was partition." - ::= { swPortCtrlEntry 8 } - - swPortCtrlNegotiationStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - disabled(2), - enabled(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Depending on this object determine to enable NWAY or disable." - ::= { swPortCtrlEntry 9 } - - swPortCtrlSpeedStatus OBJECT-TYPE - SYNTAX INTEGER { - other(1), - speed-10M(2), - speed-100M(3) - } - ACCESS read-write - STATUS mandatory - DESCRIPTION - "Depending on this object to determining this port transmit - rate is 10M bps or 100M bps." - ::= { swPortCtrlEntry 10} - - swPortCounterTable OBJECT-TYPE - SYNTAX SEQUENCE OF SwPortCounterEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "A list of port MIB statistic Counter entries." - ::= { swPortPackage 3 } - - swPortCounterEntry OBJECT-TYPE - SYNTAX SwPortCounterEntry - ACCESS not-accessible - STATUS mandatory - DESCRIPTION - "This entry include all the port Counter which support by - DES3216, like Bytes received, Bytes Sent ..." - INDEX { swPortCounterGroupIndex,swPortCounterIndex } - ::= { swPortCounterTable 1 } - - SwPortCounterEntry ::= SEQUENCE { - swPortCounterGroupIndex - INTEGER, - swPortCounterIndex - INTEGER, - swPortBytesReceived - Counter, - swPortBytesSent - Counter, - swPortFramesReceived - Counter, - swPortFramesSent - Counter, - swPortTotalBytesReceived - Counter, - swPortTotalFramesReceived - Counter, - swPortBroadcastFramesReceived - Counter, - swPortMulticastFramesReceived - Counter, - swPortCRCError - Counter, - swPortOversizeFrames - Counter, - swPortFragments - Counter, - swPortJabber - Counter, - swPortCollision - Counter, - swPortLateCollision - Counter, - swPortFrames64Bytes - Counter, - swPortFrames65To127Bytes - Counter, - swPortFrames128To255Bytes - Counter, - swPortFrames256To511Bytes - Counter, - swPortFrames512To1023Bytes - Counter, - swPortFrames1024To1522Bytes - Counter, - swPortMACRxError - Counter - } - - swPortCounterGroupIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object identifies the port within the group for - which this entry contains infomation." - ::= { swPortCounterEntry 1 } - - swPortCounterIndex OBJECT-TYPE - SYNTAX INTEGER - ACCESS read-only - STATUS mandatory - DESCRIPTION - "This object indicate switch hub port number." - ::= { swPortCounterEntry 2 } - - swPortBytesReceived OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good bytes received. Local and dropped packets - increment the counter as well." - ::= { swPortCounterEntry 3 } - - swPortBytesSent OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good bytes sent." - ::= { swPortCounterEntry 4 } - - swPortFramesReceived OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good frames received. Local and dropped packets - increment the counter as well." - ::= { swPortCounterEntry 5 } - - swPortFramesSent OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good frames sent." - ::= { swPortCounterEntry 6 } - - swPortTotalBytesReceived OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of bytes received(good and bad)." - ::= { swPortCounterEntry 7 } - - swPortTotalFramesReceived OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of frames bytes received(good and bad)." - ::= { swPortCounterEntry 8 } - - swPortBroadcastFramesReceived OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good broadcast frames received. Local and dropped - packets increment the counter as well." - ::= { swPortCounterEntry 9 } - - swPortMulticastFramesReceived OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good multicast frames received. Local and dropped - packets increment the counter as well." - ::= { swPortCounterEntry 10 } - - swPortCRCError OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of frames with valid packet length and CRC error or - misaligned(odd number of nibbles) - increment the counter as well." - ::= { swPortCounterEntry 11 } - - swPortOversizeFrames OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good frames with length more than 1518 bytes ( - or 1522 bytes for LongEn = 1)." - ::= { swPortCounterEntry 12 } - - swPortFragments OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good bytes received. Local and dropped packets - increment the counter as well." - ::= { swPortCounterEntry 13 } - - swPortJabber OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of frames with length more than 1518 bytes and with - CRC error or misaligned." - ::= { swPortCounterEntry 14 } - - swPortCollision OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of Collisions" - ::= { swPortCounterEntry 15 } - - swPortLateCollision OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of Late Collision(collision occurring later than - 576th transmitted bit" - ::= { swPortCounterEntry 16 } - - swPortFrames64Bytes OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets with length of 64 bytes " - ::= { swPortCounterEntry 17 } - - swPortFrames65To127Bytes OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets with length between 65 to 127 bytes " - ::= { swPortCounterEntry 18 } - - swPortFrames128To255Bytes OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets with length between 128 to 255 bytes " - ::= { swPortCounterEntry 19 } - - swPortFrames256To511Bytes OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets with length between 256 to 511 bytes " - ::= { swPortCounterEntry 20 } - - swPortFrames512To1023Bytes OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets with length between 512 to 1023 bytes " - ::= { swPortCounterEntry 21 } - - swPortFrames1024To1522Bytes OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of good packets with length between 1024 to 1522 bytes " - ::= { swPortCounterEntry 22 } - - swPortMACRxError OBJECT-TYPE - SYNTAX Counter - ACCESS read-only - STATUS mandatory - DESCRIPTION - "The number of frames with RX MAC Error " - ::= { swPortCounterEntry 23 } - - -- swPortDroppedFrames OBJECT-TYPE - -- SYNTAX Counter - -- ACCESS read-only - -- STATUS mandatory - -- DESCRIPTION - -- "The number of dropped frames.Dropped packets are those which a - -- receive buffer could not be allocated." - -- ::= { swPortCounterEntry 24 } - - - - -- link up/down Trap - - linkChangeEvent TRAP-TYPE - ENTERPRISE dlink - VARIABLES { - swPortInfoIndex, - swPortInfoType, - swPortInfoPartitionStatus, - swPortInfoLinkStatus, - swPortInfoDuplexMode - } - DESCRIPTION - "The trap is sent whenever the link state of a port changes - from link up to link down or from link down to link up" - ::= 1 - - - portPartition TRAP-TYPE - ENTERPRISE dlink - VARIABLES { - swPortInfoIndex, - swPortInfoType, - swPortInfoPartitionStatus, - swPortInfoLinkStatus, - swPortInfoDuplexMode - } - DESCRIPTION - "The trap is sent whenever the port state enter the Partion - mode when more than 32 collisions occur while trasmitting." - ::= 2 - - END - \ No newline at end of file diff --git a/snmp/iog-crans b/snmp/iog-crans deleted file mode 100755 index acf37a8a..00000000 --- a/snmp/iog-crans +++ /dev/null @@ -1,804 +0,0 @@ -#!/usr/bin/perl -# -# IOG v1.0 - Input/Output Grapher -# Copyright (c) 2000-2002 James Dogopoulos -# -# Please read the "Artistic" license included. -# -# E-mail iog@dynw.com with any bug reports, -# fixes or comments. -# - -BEGIN{ -if ($ARGV[0] eq "NT") { $main::OS = 'NT'; } else { $main::OS = 'UNIX'; } - -$main::SL = { UNIX=>'/', NT=>'\\' }->{$main::OS}; -$main::PS = { UNIX=>':', NT=>';' }->{$main::OS}; - -$main::binpath =""; - if ($0 =~ /^(.+\Q${main::SL}\E)/) { $main::binpath="$1"; - } - else { - foreach $pathname ( split ${main::PS}, $ENV{'PATH'}) { - if ((($main::OS eq 'NT') && (-e "$pathname${main::SL}$0")) || - (-x "$pathname${main::SL}$0")) { - $main::binpath=$pathname; - last; - } - } - } -unshift (@INC,$main::binpath); -} - -use SDBM_File; -use BER; -use SNMP_Session; -use Fcntl; - -my($inoid,$outoid,$host,$community,$snmpget,$datafile,$cfgfile,%inf); -my($inoctets,$outoctets,$path,$iogver,$hostreset,$kbsize,$mbsize,$gbsize); - -$cfgfile="/etc/iog.cfg"; -$iogver="v1.0"; - -# Default Byte Sizes - -$kbsize="1024"; -$mbsize="1048576"; -$gbsize="1073"; - -# Date/Time stuff -# - -my @weekdays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday); - -my @months = qw(January February March April May June July August September -October November December); - -my %days = (1 => "1st", 2 => "2nd", 3 => "3rd", 21 => "21st", 22 => "22nd", -23 => "23rd", 31 => "31st"); - -my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); -$lday = $mday - 1; - -sub last_mday { -my ($month, $year) = @_; -( qw(31 0 31 30 31 30 31 31 30 31 30 31) )[$month] || -28 + (($year % 100 && !($year % 4))|| !($year % 400)); -} - -if ($days{$mday}) { $pday = $days{$mday}; $nday = $days{$lday}; } -else { $pday = $mday."th"; $nday = $lday."th"; } - -# Read config file. -# - -open(CONFIG,$cfgfile) || die("Cannot open $cfgfile!"); - - while () { - s/\s+$//g; # remove whitespace at the end of the line - s/\s/ /g; # replace whitespace by space - next if /^\s*\#/; # ignore comment lines - next if /^\s*$/; # ignore empty lines - if ($_ =~ /\[.*.\]/) { chkuptime($_); next; } - my($name,$host,$community,$inoid,$outoid,$path) = split(/:/, $_); - $path =~ s/\n//; - $datafile = "$name".".dat"; - my @results = snmpget2($host,$community,$inoid,$outoid); - next if ($results[0] eq "error"); - $inoctets = $results[0]; - $outoctets = $results[1]; - main($name,$host,$community,$inoid,$outoid,$path,$datafile); - } - -close(CONFIG); - - -# SNMP Get routine. Thanks to Simon Leinen for the SNMP module. -# http://www.switch.ch/misc/leinen/snmp/perl/ -# - -sub snmpget { - my($host, $community, $inoid, $outoid) = @_; - my($response, $bindings, $binding, $value, $oid, $session, @results); - - my %oidnames = qw(ifInOctets 1.3.6.1.2.1.2.2.1.10 - ifOutOctets 1.3.6.1.2.1.2.2.1.16 - ifHCInOctets 1.3.6.1.2.1.31.1.1.1.6 - ifHCOutOctets 1.3.6.1.2.1.31.1.1.1.10); - - my ($inoidname,$inoidport) = split(/\./, $inoid); - my ($outoidname,$outoidport) = split(/\./, $outoid); - - $inoid = encode_oid(split(/\./, ($oidnames{$inoidname} . ".$inoidport"))); - $outoid = encode_oid(split(/\./, ($oidnames{$outoidname} . ".$outoidport"))); - - my @oids = ($inoid,$outoid); - - if ($inoidname =~ /HC/i or $outoidname =~ /HC/i) { - $session = SNMPv2c_Session->open($host, $community, 161) or return "error"; - } else { - $session = SNMP_Session->open($host, $community, 161) or return "error"; - }; - - if ($session->get_request_response (@oids)) { - $response = $session->pdu_buffer; - ($bindings) = $session->decode_get_response ($response); - - while ($bindings ne '') { - ($binding,$bindings) = decode_sequence ($bindings); - ($oid,$value) = decode_by_template ($binding, "%O%@"); - push (@results, pretty_print($value)); - } - return @results; - } else { warn "SNMP Error: $SNMP_Session::errmsg\n"; - return "error"; } -} - -sub snmpgetup { - my($host, $community, $inoid) = @_; - my($response, $bindings, $binding, $value, $oid, $result); - - my %oidnames = qw(sysUpTime 1.3.6.1.2.1.1.3 - sysUpTime.0 1.3.6.1.2.1.1.3.0); - - $inoid = encode_oid(split(/\./, $oidnames{$inoid})); - - my $session = SNMP_Session->open($host, $community, 161) or return "0"; - - if ($session->get_request_response ($inoid)) { - $response = $session->pdu_buffer; - ($bindings) = $session->decode_get_response ($response); - - while ($bindings ne '') { - ($binding,$bindings) = decode_sequence ($bindings); - ($oid,$value) = decode_by_template ($binding, "%O%@"); - $result = pretty_print($value); - } - return $result; - } else { warn "SNMP Error: $SNMP_Session::errmsg\n"; - return 0; } - -} - - -##################################################################################### -# Section personnalisée pour faire du SNMP en TCP. -# NS 22/02/03 -##################################################################################### -sub snmpget2 { - my($host, $community, $inoid, $outoid) = @_; - - open IN, "snmpget -T TCP $host $community interfaces.ifTable.ifEntry.$inoid |"; - my $inresult = ; - chomp($inresult); - close(IN); - - open OUT, "snmpget -T TCP $host $community interfaces.ifTable.ifEntry.$outoid |"; - my $outresult = ; - chomp($outresult); - close(OUT); - - my @intable = split(/ /,$inresult ); - my @outtable = split(/ /,$outresult ); - - my @results = ($intable[-1],$outtable[-1]); - - return @results; -} - -sub snmpgetup2 { - my($host, $community, $upoid) = @_; - - open UP, "snmpget -T TCP $host $community $upoid |"; - my $uptimeresult = ; - chomp($uptimeresult); - close(UP); - - $uptimeresult =~ s/^.*\) //; - $uptimeresult =~ s/...$//; - - return $uptimeresult; -} -#################################################################################### - - -sub chkuptime { - - $_ =~ s/\[|\]//g; - my($uphost,$upip,$upcommunity,$upoid,$upfile) = split (/:/, $_); - my $upresult = snmpgetup2($upip,$upcommunity,$upoid); - - tie(%inf, 'SDBM_File', ($upfile."$main::SL"."uptimes"), O_RDWR|O_CREAT, 0640) - or print "WARNING: Error opening uptime database file!\n"; - - if ($upresult < $inf{$uphost} && $upresult > "1") { $hostreset = "1"; } - else { $hostreset = "0"; } - - if ($upresult > "1") { $inf{$uphost} = $upresult; } - - untie(%inf); - -} - -sub main { -my($name,$host,$community,$inoid,$outoid,$path,$datafile) = @_; - -tie(%inf, 'SDBM_File', ($path."$main::SL".$datafile), O_RDWR|O_CREAT, 0640) or -print "Error opening database file for $name at $host\n"; - - if (-s (($path."$main::SL".$datafile) . ".pag")) { - - if ($inf{day} != $mday && $hour > "0") { newday(); - dailyhtml($name,$host,$path); } - - if ($inf{month} != $mon) { - $newmon = "1"; - newday(); - dailyhtml($name,$host,$path); - newmonth($name,$path); - monthlyhtml($name,$host,$path); - } - - if ($inf{year} != ($year + "1900")) { newyear($name,$path); } - - if (!$newmon) { updatedata(); } - - if ($inf{day} != $mday) { $newday = "1"; } else { $newday = "0"; } - - hourlyhtml($name,$host,$path,$newday); - - } else { createdata(); hourlyhtml($name,$host,$path); } - -untie(%inf); -} - -# create data file if ! exist -# - -sub createdata { -%inf = (lastin => $inoctets, lastout => $outoctets, - month => $mon, day => $mday, year => ($year + "1900")); -} - -# -# - -sub newyear { - -my($name,$path) = @_; -my($count); - -$count = 0; - - while ($count <= "11") { - delete $inf{"m" . $count}; - $count++; - } - - # move yearly html file. - - $oldfile="$path"."$main::SL"."$name"."-months".".html"; - $newfile="$path"."$main::SL"."$name"."-year".($year).".html"; - - if ($main::OS eq "NT") { system("move /Y $oldfile $newfile"); } - else { system("mv $oldfile $newfile"); } - -$inf{year} = ($year + "1900"); -} - -# -# - -sub newmonth { - -my($name,$path) = @_; -my($count,$intotal,$outtotal,$inoct,$outoct); - - # get MB total for the month and store it. - - $count = 1; - while ($count <= "31") { - if ($inf{"d" . $count}) { - ($inoct,$outoct) = split(/:/, $inf{"d" . $count}); - $intotal += $inoct; - $outtotal += $outoct; - } - $count++; - } - -$intotal = ($intotal / $mbsize); -$outtotal = ($outtotal / $mbsize); - -$inf{"m" . $inf{month}} = "$intotal:$outtotal"; - - # clear days - - $count = 1; - while ($count <= "31") { - delete $inf{"d" . $count}; - $count++; - } - - # move monthly html file. - - $oldfile="$path"."$main::SL"."$name"."-days".".html"; - $newfile="$path"."$main::SL"."$name"."-month".($mon).".html"; - - if ($main::OS eq "NT") { system("move /Y $oldfile $newfile"); } - else { system("mv $oldfile $newfile"); } - -# set $inf{month} to the new month. -$inf{month} = $mon; -} - - -# newday: -# run every time the day of the month changes on the system. -# - -sub newday { - -my($count,$nmday,$intotal,$outtotal,$inoct,$outoct); - - # get megabyte total for the day and store it. - # - - $count = 0; - while ($count <= "23") { - if ($inf{$count}) { - ($inoct,$outoct) = split(/:/, $inf{$count}); - $intotal += $inoct; - $outtotal += $outoct; - } - $count++; - } - -if ($newmon) { $nmday = last_mday($inf{month}, $inf{year}); } -else { $nmday = ($mday - 1); } - -$inf{"d" . $nmday} = "$intotal:$outtotal:" . ($intotal + $outtotal); - - # clear hours - # - - $count = 0; - while ($count <= "23") { - delete $inf{$count}; - $count++; - } - -$inf{day} = $mday; -} - - -# update DBM file. -# - -sub updatedata { -my ($lasthour,$wrapin,$wrapout); -my $intwrap="4294967296"; - - if ($hour eq "0") { $lasthour = "23"; } else { $lasthour = ($hour - "1"); } - - if ($hostreset == "1") { $inf{lastin} = $inf{lastout} = "0"; } - - # detect if a counter has wrapped and adjust. - # - if ($inoctets < $inf{lastin}) { - $wrapin = $inoctets; - $inoctets = ($intwrap - $inf{lastin}) + $inoctets; - $inf{lastin} = "0"; - } - - if ($outoctets < $inf{lastout}) { - $wrapout = $outoctets; - $outoctets = ($intwrap - $inf{lastout}) + $outoctets; - $inf{lastout} = "0"; - } - -$inf{$lasthour} = (($inoctets - $inf{lastin}).":".($outoctets - $inf{lastout})); -if ($wrapin) { $inf{lastin} = $wrapin } else { $inf{lastin} = $inoctets } -if ($wrapout) { $inf{lastout} = $wrapout } else { $inf{lastout} = $outoctets } -} - -sub footer { -print DHTML "


- -
IOG $iogver - Input Output Grapher
--
James Dogopoulos <jd\@dynw.com>
-Questions or comments to iog\@dynw.com -

"; -} - -# make the hourly html -# - -sub hourlyhtml { - -my($name,$host,$path,$newday) = @_; - -# make todays graph -# - -my $enddays = last_mday($mon, ($year + "1900")); - -my $count = "0"; -my ($besthour,$bestday,$inoct,$outoct) = "0"; - - # find busiest hour - # - while ($count <= "23") { - if ($inf{$count}) { ($inoct,$outoct) = split(/:/, $inf{$count}); } - else { $inoct = $outoct = "0"; } - if ($inoct > $besthour) { $besthour = $inoct; } - if ($outoct > $besthour) { $besthour = $outoct; } - $count++; - } - -my $hscalemax = ($besthour / "1000000"); -my ($hscaleunit,$intotal,$outtotal) = 0; - -if ($hscalemax > "0") { $hscaleunit = ("450" / $hscalemax); } - - open(DHTML, ">>$path".$main::SL."$name".".html") or print "can't open in $name $host $!"; - flock(DHTML, 2) or print "can't flock $name $host: $!"; - truncate(DHTML, 0); - - print DHTML "IOG $iogver - $host - -
"; - - my $dexist = (-f "$path".$main::SL."$name"."-days.html"); - my $mexist = (-f "$path".$main::SL."$name"."-months.html"); - - if ($newday != "1") { - if ($dexist && $mexist) { - print DHTML " [ Today | This Month - | Previous Months ]

"; - } else { - if ($dexist && !$mexist) { - print DHTML " [ Today | This - Month | Previous Months ]

"; - } else { - if (!$dexist && $mexist) { - print DHTML " [ Today | This Month - | Previous Months ]

"; - } else { print DHTML "[ Today | This Month | Previous Months ]"; } - } - } - } - else { - if ($dexist && $mexist) { - print DHTML " [ This Month - | Previous Months ]

"; - } else { - if ($dexist && !$mexist) { - print DHTML " [ This - Month | Previous Months ]

"; - } else { - if (!$dexist && $mexist) { - print DHTML " [ This Month - | Previous Months ]

"; - } - } - } - - } - - if ($newday eq "1") { $tday = "$nday"; } else { $tday = "$pday"; } - - print DHTML "

$months[$mon] $tday - Network I/O for $name ($host)

"; - print DHTML ""; - - $count = "0"; - - while ($count <= "23") { - my($inwidth,$outwidth); - - if ($inf{$count}) { - ($inoct,$outoct) = split(/:/, $inf{$count}); - $intotal += $inoct; - $outtotal += $outoct; - $inwidth = ($inoct / "1000000" * $hscaleunit); - $outwidth = ($outoct / "1000000" * $hscaleunit); - } else { $count++; next; } - - # if day is over 1gb, switch to GB/MB display. - # - my($gstring,$gbin,$gbout,$mbin,$mbout); - - $mbin = sprintf("%.1f", $inoct / $mbsize); - $mbout = sprintf("%.1f", $outoct / $mbsize); - - if ($mbin > $gbsize or $mbout > $gbsize) { - $gbin = sprintf("%.1f", $mbin / $gbsize); - $gbout = sprintf("%.1f", $mbout / $gbsize); - - $gstring = ""; - } - else { - $gstring = "\n"; - - print DHTML $gstring; - - $count++; - } - -$intotal = sprintf("%.f", ($intotal / $mbsize)); -$outtotal = sprintf("%.f", ($outtotal / $mbsize)); - -print DHTML "
In: $gbin GB - ($mbin MB)
Out: $gbout GB ($mbout MB) -
In: $mbin MB (". - sprintf("%.f", $inoct / $kbsize)." KB)
Out: $mbout - MB (".sprintf("%.f", $outoct / $kbsize)." KB)"; - } - - $inwidth = (sprintf("%.f", $inwidth) + 1); - $outwidth = (sprintf("%.f", $outwidth) + 1); - - print DHTML "
"."$count".":00
\n"; - print DHTML "

"; - - if ($intotal > $gbsize or $outtotal > $gbsize) { - my $gbtotal = sprintf("%.1f", ($intotal + $outtotal) / $gbsize); - print DHTML "Today's Total: $gbtotal GB
-In: $intotal MB - Out: - $outtotal MB
"; - } - else { - print DHTML "Today's Total: ".($intotal + $outtotal)." MB
-In: $intotal MB - Out: - $outtotal MB
"; - } - -footer(); - -flock(DHTML, 8); -close(DHTML); -} - -sub monthlyhtml { - -my ($name,$host,$path) = @_; -my ($bestmonth,$m_intotal,$m_outtotal,$m_total); -my $count = 0; - - # find busiest month - - while ($count <= "11") { - if ($inf{"m" . $count}) { - ($m_intotal,$m_outtotal) = split(/:/, $inf{"m" . $count}); - if ($m_intotal > $bestmonth) { $bestmonth = $m_intotal; } - if ($m_outtotal > $bestmonth) { $bestmonth = $m_outtotal; } - } - $count++; - } - -my $mscalemax = $bestmonth; -my ($mscaleunit,$intotal,$outtotal) = 0; - -if ($mscalemax > "0") { $mscaleunit = ("450" / $mscalemax); } - -open(DHTML, ">>$path".$main::SL."$name"."-months.html") or print "can't open $name $host $!"; -flock(DHTML, 2) or print "can't flock $name $host : $!"; -truncate(DHTML, 0); - -print DHTML "IOG $iogver - $host -
"; - -my $dexist = (-f "$path".$main::SL."$name"."-days.html"); - -if ($dexist) { -print DHTML "[ Today | -This Month | Previous Months ]

"; -} else { -print DHTML "[ Today | -This Month | Previous Months ]

"; -} - -print DHTML "

Monthly Network I/O for $name ($host)

"; -print DHTML ""; - - $count = "0"; - - while ($count <= "11") { - my($inwidth,$outwidth,$intotal,$outtotal,$inoct,$outoct,$mtotal); - - if ($inf{"m" . $count}) { - ($inoct,$outoct,$mtotal) = split(/:/, $inf{"m" . $count}); - $intotal += $inoct; - $outtotal += $outoct; - $inwidth = ($inoct * $mscaleunit); - $outwidth = ($outoct * $mscaleunit); - } else { $count++; next; } - - # if day is over 1gb, switch to GB/MB display. - # - my($gstring,$gbin,$gbout,$gbtotal,$mbin,$mbout); - - $mbin = sprintf("%.f", $inoct); - $mbout = sprintf("%.f", $outoct); - - $gbin = sprintf("%.1f", $mbin / $gbsize); - $gbout = sprintf("%.1f", $mbout / $gbsize); - $gbtotal = sprintf("%.1f", ($gbin + $gbout)); - - $gstring = ""; - - $inwidth = (sprintf("%.f", $inwidth) + 1); - $outwidth = (sprintf("%.f", $outwidth) + 1); - - if (-f "$path".$main::SL."$name"."-month".($count + "1").".html") { - $mlink = "$months[$count]"; - } else { $mlink = "$months[$count]"; } - - print DHTML "\n"; - - print DHTML $gstring; - - $count++ - } - -print DHTML "
In: $gbin GB - ($mbin MB)
Out: $gbout GB ($mbout MB) -
$mlink
$gbtotal GB
-
\n"; - print DHTML "

"; - -footer(); - -flock(DHTML, 8); -close(DHTML); -} - -sub dailyhtml { - -my ($bestday,$d_intotal,$d_outtotal) = 0; -my ($name,$host,$path) = @_; -my $count = 1; -my $endday = last_mday($inf{month}, $inf{year}); - - if ($endday eq $mday) { $lastday="1"; } else { $lastday="0"; } - - # fix math errors from previous sub - if ($newmon) { $mon--; } - - # move Today's html file unless it's a new month. - - if (!$newmon) { - $oldfile="$path"."$main::SL"."$name".".html"; - $newfile="$path"."$main::SL"."$name"."-day".($mday - "1").".html"; - if ($main::OS eq "NT") { system("move /Y $oldfile $newfile"); } - else { system("mv $oldfile $newfile"); } - } - - # find busiest day (should be merged with totals) - - while ($count <= $endday) { - if ($inf{"d" . $count}) { - ($d_intotal,$d_outtotal) = split(/:/, $inf{"d" . $count}); - if ($d_intotal > $bestday) { $bestday = $d_intotal; } - if ($d_outtotal > $bestday) { $bestday = $d_outtotal; } - } - $count++; - } - -my $dscalemax = ($bestday / "1000000"); -my ($dscaleunit,$intotal,$outtotal) = 0; - -if ($dscalemax > "0") { $dscaleunit = ("450" / $dscalemax); } - -open(DHTML, ">>$path".$main::SL."$name"."-days.html") or print "can't open $name $host $!"; -flock(DHTML, 2) or print "can't flock $name $host : $!"; -truncate(DHTML, 0); - -print DHTML "IOG $iogver - $host -
"; - - if (-f "$path".$main::SL."$name"."-months.html") { - print DHTML "[ Today | - This Month | Previous Months ]

"; - } else { - print DHTML "[ Today | This Month - | Previous Months ]

"; - } - -print DHTML "

$months[$mon] - Network I/O for $name ($host)

"; -print DHTML ""; - - $count = "1"; - - while ($count <= $endday) { - my($inwidth,$outwidth,$inoct,$outoct,$pday); - - if ($inf{"d" . $count}) { - ($inoct,$outoct) = split(/:/, $inf{"d" . $count}); - $intotal += $inoct; - $outtotal += $outoct; - $inwidth = ($inoct / "1000000" * $dscaleunit); - $outwidth = ($outoct / "1000000" * $dscaleunit); - } else { $count++; next; } - - # if day is over 1gb, switch to GB/MB display. - # - my($gstring,$gbin,$gbout,$mbin,$mbout); - - $mbin = sprintf("%.f", $inoct / $mbsize); - $mbout = sprintf("%.f", $outoct / $mbsize); - - if ($mbin > $gbsize or $mbout > $gbsize) { - $gbin = sprintf("%.1f", $mbin / $gbsize); - $gbout = sprintf("%.1f", $mbout / $gbsize); - - $gstring = ""; - } - else { - $gstring = "\n"; - print DHTML $gstring; - - $count++; - } - -$intotal = sprintf("%.f", ($intotal / $mbsize)); -$outtotal = sprintf("%.f", ($outtotal / $mbsize)); - -my $gbtotal = sprintf("%.1f", (($intotal + $outtotal) / $gbsize)); - -print DHTML "
In: $gbin GB - ($mbin MB)
Out: $gbout GB ($mbout MB) -
In: $mbin MB (". - sprintf("%.f", $inoct / $kbsize)." KB)
Out: $mbout - MB (".sprintf("%.f", $outoct / $kbsize)." KB)"; - } - - $inwidth = (sprintf("%.f", $inwidth) + 1); - $outwidth = (sprintf("%.f", $outwidth) + 1); - - if ($days{$count}) { $pday = $days{$count}; } else { $pday = $count."th"; } - - if (-f "$path".$main::SL."$name"."-day".$count.".html" && $lastday eq "0" - && ($newmon ne "1")) { - $pday = "$pday"; - } - - print DHTML "
$pday -
\n"; - print DHTML "

"; -print DHTML "Monthly Total: $gbtotal GB
-In: $intotal MB - Out: $outtotal MB
"; - -footer(); - -flock(DHTML, 8); -close(DHTML); - - # reverse math errors - if ($newmon) { $mon++; } - -} - - -# END - - - - - - - - - - - - - - - -# -# IOG v1.0 - Input/Output Grapher -# Copyright 2000-2002 (c) James Dogopoulos -# - - diff --git a/unref.py b/unref.py deleted file mode 100755 index 072b2e66..00000000 --- a/unref.py +++ /dev/null @@ -1,29 +0,0 @@ -#! /usr/bin/python -# recursively print links, Sam K (2000) -import os,string,getopt,sys - -def simplif(base,n) : - return os.path.normpath(os.path.join(base,n)) - -optlist, args = getopt.getopt(sys.argv[1:], "") -n=args[0] -print n -cur=os.path.abspath(".") -i=0 -while i<2000 and os.path.islink(os.path.join(cur,n)) : - print "%d-level link : %s -> %s" % (i,n,os.readlink(n)) - n2=simplif(os.path.dirname(n),os.readlink(n)) -# print " - > %s" % n2 - i=i+1 - n=n2 -if i>=2000 : - print "Circular links : %s / %s " % (cur,args[0]) - raise "circular_link" - -print "real File : %s" % n -if os.path.isfile(n) : - os.system('ls -lF '+n) - os.system("file "+n) -else : - print "Broken Link !!" -