Subversion Repositories vnag

Rev

Rev 35 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 daniel-mar 1
// Put this file in /etc/icinga2/conf.d/...
2
 
3
// VNag - Nagios Framework for PHP
4
// Developed by Daniel Marschall, ViaThinkSoft <www.viathinksoft.com>
5
// Licensed under the terms of the Apache 2.0 license
6
//
79 daniel-mar 7
// Revision 2023-10-14
2 daniel-mar 8
 
9
object CheckCommand "vnag_file_timestamp" {
35 daniel-mar 10
	// PLEASE ADJUST THIS PATH
79 daniel-mar 11
	command = [ "/daten/vnag/bin/file_timestamp.phar" ]
2 daniel-mar 12
 
13
	arguments = {
14
		"-f" = {
15
			value = "$vnag_file_timestamp_file$"
16
			description = "File or filemask to be checked. There are two possible checking modes: If you put a # in front of the file mask, only the youngest file of each group will be checked (use this mode e.g. if you want to check if a downloader is regularly downloading files into a download directory). Otherwise, all files of the file group are checked."
17
			repeat_key = true
18
			required = true
19
		}
20
		"-w" = {
21
			value = "$vnag_file_timestamp_warn$"
22
			description = "Max age of file (warning range). You must use a Nagios compatible unit of measure (i.e. seconds)."
23
		}
24
		"-c" = {
25
			value = "$vnag_file_timestamp_crit$"
26
			description = "Max age of file (critical range). You must use a Nagios compatible unit of measure (i.e. seconds)."
27
		}
28
		"-v" = {
29
			set_if = "$vnag_file_timestamp_verbose$"
30
			description = "Additionally list files which are OK, not just the files which are out of the time range."
31
		}
32
	}
33
}
34
 
35
// Example usage:
36
//
37
// apply Service "example_daily_backup_timestamp" {
38
//	import "generic-service"
39
//	check_command = "vnag_file_timestamp"
40
//	vars = {
41
//		vnag_file_timestamp_file = [ "/backup/automatic/timestamps/ts_daily_rsync", "/backup/automatic/timestamps/ts_daily_mysqldump" ]
42
//		vnag_file_timestamp_warn = "86400s"   // 24h
43
//		vnag_file_timestamp_crit = "144000s"  // 40h
44
//		vnag_file_timestamp_verbose = false
45
//	}
46
//	assign where host.name == NodeName
47
// }
48
//
49
// apply Service "example_3month_backup_timestamp" {
50
//	import "generic-service"
51
//	check_command = "vnag_file_timestamp"
52
//	vars = {
53
//		vnag_file_timestamp_file = [ "/backup/automatic/timestamps/ts_raspberry_rsync" ]
54
//		vnag_file_timestamp_warn = "7776000s"   // 3 Months
55
//		vnag_file_timestamp_crit = "15552000s"  // 6 Months
56
//		vnag_file_timestamp_verbose = false
57
//	}
58
//	assign where host.name == NodeName
59
// }
60
//
61
// apply Service "example_downloader_timestamp" {
62
//	import "generic-service"
63
//	check_command = "vnag_file_timestamp"
64
//	// the prepending hashtag means 'check only the youngest file'
65
//	vars = {
66
//		vnag_file_timestamp_file = [ "#/home/test/my_downloader/downloaded_files/*.jpg" ]
67
//		vnag_file_timestamp_warn = "86400s"   // 24h
68
//		vnag_file_timestamp_crit = "144000s"  // 40h
69
//		vnag_file_timestamp_verbose = false
70
//	}
71
//	assign where host.name == NodeName
72
// }