#  This is NETMONd & TkNetmon configuration file
#
#  Created by vfom at ΠΤ ΞΟΡ 10 16:20:17 NOVT 2006 with TkNetmon-2.0.7a
#          on FreeBSD ipsec.sicex.ru 5.5-STABLE i386
#
RootDir      "/var/netmon"
Polling      60
Timeout      2
Retries      3
TimeFmt      "%d/%m%G %z %H:%M:%S"
Saving       300
UserName     "netmon"
GroupName    "netmon"
Port 3333 {
	Timeout 1
	Permit "^localhost$"
	Permit "^127.0.0.1$"
	Deny ".*"
}
Method "rcmd-get-loadave" {
	Timeout 3	# specific reply timeout (optional)
	Retries 1	# specific retries number (optional)
	TCP Port 514	# TCP or UDP requested server port (mandatory)
	Localport 512 1023 # range of local ports to be used (optional)

	# ChatScript (suggested)
	# Set the testing algorithm of the method.
	# It consist of Send/Expect pairs of strings to match right
	# state in reply and extract required value of variable.
	# The Expect string is a regex(3) pattern with optional tags.
	ChatScript {
		Send "0"	# no stderr stream
		Send "$1"	# local user
		Send "$1"	# remote user
		Send "$2"	# remote command
		Expect "^$"	# expect null string
		Expect "averages: ([0-9]+\.[0-9]*)" { $LoadAve }

		# It may expect so many strings and tags as you want!
		# Expect "([0-9]+)[ ]+[0-9]+%[ ]+/" { $FreeSpace_root }
		# Expect "([0-9]+)[ ]+[0-9]+%[ ]+/usr" { $FreeSpace_usr }
	}
}
Method "http" {
	tcp port 80
	ChatScript {
		Send	"GET $1 HTTP/1.0\r\n\r\n"
		Expect	"^HTTP/1.1 200 OK$"
	}
}
Method "pop3" {
	tcp port 110
	ChatScript { Send "" Expect "^\\+OK " Send "QUIT\r\n" Expect "" }
}
Method "smtp" {
	tcp port 25
	ChatScript { Send "" Expect "^220-" Send "QUIT\r\n" Expect "" }
}
Method "ftp" {
	tcp port 21
	ChatScript { Send "" Expect "^220 " Send "QUIT\r\n" Expect "" }
}
Method "nntp" {
	tcp port 119
	ChatScript { Send "" Expect "^200 " Send "QUIT\r\n" Expect "" }
}
Method "ssh" {
	tcp port 22
	ChatScript { Send "" Expect "^SSH-" Send "QUIT\r\n" Expect "" }
}
Save "host-overload-alarm" {
	# There are three HOW OUTPUT methods:
	#	File	- write to file in defined format
	#	Pipe	- output to pipe specified string
	#	Exec	- execute program with list of arguments
	# The "filename" would be constracted according strftime(3).

	# File "%Y.%m.%d"
	Pipe "mail2staff"

	# There are three WHEN OUTPUT methods:
	#	Data	- absolute periodic saving (by Saving interval)
	#	State	- when state of object has changed (UP/DOWN/..)
	#	When	- when condition of expression is TRUE

	# Data "$time $LoadAve"
	# State "$time $State"
	When "$LoadAve >= 2.5" 180 "Host $Name overloaded during 3 min"
}
Save "change-state-alarm" {
	Pipe "mail2staff"
	State "$time $1 $name $state"
}
Save "host-state-alarm" {
    File "/var/netmon/events.log"
    State "$time $name state changed to $state"
}
Save "if-state-alarm" {
    File "/var/netmon/events.log"
    State "$time \"$1\" $name state changed to $state"
}
Save "service-state-alarm" {
    File "/var/netmon/events.log"
    State "$time \"$1\" $name state changed to $state"
}
Save "bgp-state-alarm" {
    File "/var/netmon/events.log"
    State "$time \"$1\" $name state changed to $state"
}
Save "dns-alarm" {
	Pipe "mail2staff"
	State "$time $1 $name $state $dns"
}
SrcAddress		"0.0.0.0"
/*
Preferences {
	wm geometry . 		"1049x725+151+102"
	set ::globalFG		"white"
	set ::globalBG		"black"
	BGImage 		""
	set ::browserProg	"mozilla"
	set ::myLogFile		"~/.Tknetmon/TkNetmon.log"
	set ::menuVisible	"yes"
	set ::scrollVisible	"yes"
	set ::statusVisible	"yes"
	set ::editEnable		"yes"
	set ::lineWidth		"1"
	set ::lineColor		"white"
	set ::textAnchor	"center"
	set ::textJust		"center"
	set ::textFont		"-cronyx-helvetica-medium-r-normal-*-*-100-*-*-p-*-koi8-r"
	set ::textFontColor	"white"
	set ::linkWidth		"l"
	set ::linkColor		"white"
	set ::nodeIcon		"pc32"
	set ::nodeUpSound	""
	set ::nodeDownSound	""
	set ::nodeFont		"-cronyx-helvetica-medium-r-normal-*-*-100-*-*-p-*-koi8-r"
	set ::nodeFontColor	"white"
	set ::nodeIP		"127.0.0.1"
	set ::node_SrcIP	"0.0.0.0"
	set ::node_SnmpVer	"v2"
	set ::node_getCommunity	"public"
	set ::node_trapCommunity "ahtung"
	set ::node_dblClickCmd	"NodeReport.tcl %X %P %N"
	set ::h_align	"8"
	set ::w_align	"8"
	set ::h_autoplacement	"64"
	set ::w_autoplacement	"92"
	set ::monitor_mode	"disable"
	set ::netStateServer	"vega"
	set ::predIncludeFile	"predinclude.txt"
	set ::postIncludeFile	"postinclude.txt"
	set ::soundPlayCmd	""
	set ::daemonRestartCmd	"sudo -u root  /usr/local/sbin/netmondctl restart"
}
#

ServiceMenus {
	MenuItem 1 Default {type menu}
	MenuItem 2 Ping {type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "ping %H; echo 'Press <ENTER> to exit.'; read K;"} }
	MenuItem 2 Trace {type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "traceroute %H; echo 'Press <ENTER> to exit.'; read K;"} }
	MenuItem 2 Log {type function cmd_line {showObjectEventsLog {} } }
	MenuItem  1 {WinNT}	{type menu}
	MenuItem  2 {Ping}	{type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "ping %H; echo 'Press <ENTER> to exit.'; read K;"} } 
	MenuItem  2 {Trace}	{type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "traceroute %H; echo 'Press <ENTER> to exit.'; read K;"} } 
	MenuItem  2 {Log} 	{type function cmd_line {showObjectEventsLog {} } } 
	MenuItem  2 {VNC} 	{type command cmd_line {/usr/X11R6/bin/vncviewer %H -passwd .vnc/passwd.%N } } 
	MenuItem  1 {Cisco}	{type menu}
	MenuItem  2 {Ping}	{type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "ping %H; echo 'Press <ENTER> to exit.'; read K;"} } 
	MenuItem  2 {Trace}	{type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "traceroute %H; echo 'Press <ENTER> to exit.'; read K;"} } 
	MenuItem  2 {Log} 	{type function cmd_line {showObjectEventsLog {} } } 
	MenuItem  2 {Telnet} 	{type command cmd_line {/usr/X11R6/bin/xterm -bg black -fg white -e telnet %H } } 
	MenuItem  1 {UNIX}	{type menu}
	MenuItem  2 {Ping}	{type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "ping %H; echo 'Press <ENTER> to exit.'; read K;"} } 
	MenuItem  2 {Trace}	{type command cmd_line {/usr/X11R6/bin/xterm -e sh -c "traceroute %H; echo 'Press <ENTER> to exit.'; read K;"} } 
	MenuItem  2 {Log} 	{type function cmd_line {showObjectEventsLog {} } } 
	MenuItem  2 {SSH} 	{type command cmd_line {/usr/X11R6/bin/xterm -bg black -fg white -e ssh %H } } 
}
#
SqlDatabase {
	set ::Sql::dbmethod "mysql"
	set ::Sql::dbhost   ""
	set ::Sql::dbuser   ""
	set ::Sql::dbpwd    ""
	set ::Sql::dbname   "netmon"
}
EventsLog {
	set ::evLog::lastGeometry "800x600+240+212"
	set ::evLog::lastGeometryFilters "697x359+286+341"
	set ::evLog::tbl_cols_width "0 18 1 16 2 16 3 80"
	set ::evLog::direction "down"
	set ::evLog::find ""
	set ::evLog::scope_flt "1"
	set ::evLog::start_t ""
	set ::evLog::stop_t ""
	set ::evLog::objects_flt_flag "0"
	set ::evLog::objects_flt ""
	set ::evLog::bottom_anchor "0"
	array set ::evLog::cat_flags {info 1 warn 1 normal 1 alarm 0 crit 0 debug 1 trap 1}
}
*/
#
%include "predinclude.txt"
#
#
Object "router1" { 
	Address      "192.168.0.2" 
	Method	ping	
	Method	router	v2 "mycommunity"
	Save	router	
	Save	"host-state-alarm"	
	Interface  "Serial0/0" { 
		Description "Link to provider 1"
		Datadir "Serial0_0"
		Save	interface	
		Save	"if-state-alarm"	"router1"
	}
	Interface  "Serial0/1" { 
		Description "Link to provider 2"
		Datadir "Serial0_0"
		Save	interface	
		Save	"if-state-alarm"	"router1"
	}
	Interface  "Ethernet0/0" { 
		Description "internal LAN interface"
		Datadir "Ethernet0_0"
		Save	interface	
		Save	"if-state-alarm"	"router1"
	}
	Bgp 1234 { 
		Description "BGP with provider1"
		Peer "192.168.16.6"
		Save	bgp	
		Save	"bgp-state-alarm"	"router1"
	}
	Bgp 5678 { 
		Description "BGP with provider 2"
		Peer "192.168.17.12"
		Save	bgp	
		Save	"bgp-state-alarm"	"router1"
	}
	/*
	Coords       211.0 153.0
	Icon         cisco32
	Font         {-cronyx-helvetica-medium-r-normal-*-*-100-*-*-p-*-koi8-r}
	FontColor    {white}
	Description  {router}
	*/
}
#
Object "provider1" { 
	Address      "192.168.16.6" 
	Method	ping	
	Save	"host-state-alarm"	
	/*
	Coords       292.0 79.0
	Icon         cisco32
	Font         {-cronyx-helvetica-medium-r-normal-*-*-100-*-*-p-*-koi8-r}
	FontColor    {white}
	Description  {provider1}
	*/
}
#
Object "provider2" { 
	Address      "192.168.17.12" 
	Method	ping	
	Save	"host-state-alarm"	
	/*
	Coords       125.0 75.0
	Icon         cisco32
	Font         {-cronyx-helvetica-medium-r-normal-*-*-100-*-*-p-*-koi8-r}
	FontColor    {white}
	Description  {provider1}
	*/
}
#
Object "inetserver" { 
	Address      "192.168.0.1" 
	Polling	30
	Method	ping	
	Method	"rcmd-get-loadave"	"username uptime"
	Save	"host-state-alarm"	
	Save	"host-overload-alarm"	
	Service "http" { 
		Method	"http"	"/"
		Save	"service-state-alarm"	"inetserver"
	}
	Service "named" { 
		Method	dns	
		Method	dns	"foo.bar"
		Method	dns	"domain.com"
		Save	"dns-alarm"	"inetserver"
	}
	/*
	Coords       211.0 249.0
	Icon         linux32
	Font         {-cronyx-helvetica-medium-r-normal-*-*-100-*-*-p-*-koi8-r}
	FontColor    {white}
	Description  {inetserver}
	*/
}
%include "postinclude.txt"
#
