- Timestamp:
- Mar 6, 2009, 5:25:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dasscm/dasscm
r276 r277 27 27 my $RETURN_OK = 0; 28 28 my $RETURN_NOK = 1; 29 30 # Nagios return codes 31 my $RETURN_WARN = 1; 32 my $RETURN_CRIT = 2; 33 my $RETURN_UNKNOWN = 3; 29 34 30 35 # file to store permissions … … 88 93 print " diff <path>\n"; 89 94 print " status <path>\n"; 95 print " check\n"; 90 96 print " cleanup\n"; 91 97 print " permissions\n"; … … 1023 1029 if (%removedfiles) { 1024 1030 print "deleted files (found in repository, but not in system):\n"; 1025 foreach my $key ( values %removedfiles ) {1031 foreach my $key ( keys %removedfiles ) { 1026 1032 print "$key\n"; 1027 1033 } … … 1043 1049 } 1044 1050 1051 # 1052 # return short status in Nagios plugin conform way 1053 # 1054 sub check() 1055 { 1056 check_env(); 1057 1058 # return code for the shell 1059 # default: error 1060 my $return_code = $RETURN_OK; 1061 my $return_string = "OK: no modified files"; 1062 1063 ( my $refChangedFiles, my $refRemovedFiles ) = 1064 getModifiedFiles( "/" ); 1065 my %changedfiles = %{$refChangedFiles}; 1066 my %removedfiles = %{$refRemovedFiles}; 1067 1068 if ( %removedfiles or %changedfiles ) { 1069 $return_string = "Warning: "; 1070 if( %changedfiles ) { 1071 $return_string .= "changed: " . join( ", ", ( keys %changedfiles ) ) . ". "; 1072 } 1073 if( %removedfiles ) { 1074 $return_string .= "removed: " . join( ", ", ( keys %removedfiles ) ) . ". "; 1075 } 1076 $return_code = $RETURN_WARN; 1077 } 1078 1079 # addition nagios Service Status 1080 #Critical 1081 #Unknown 1082 1083 print $return_string . "\n"; 1084 return $return_code; 1085 } 1086 1087 1045 1088 sub permissions() 1046 1089 { 1047 check_parameter( @_, 1 );1048 1090 check_env(); 1049 1091 … … 1095 1137 sub cleanup() 1096 1138 { 1097 check_parameter( @_, 1 );1098 1139 check_env(); 1099 1140 … … 1184 1225 $command = "status"; 1185 1226 $return_code = status(@ARGV); 1227 } elsif (m/^check$/i) { 1228 $command = "check"; 1229 $return_code = check(); 1186 1230 } elsif (m/^permissions$/i) { 1187 1231 $command = "permissions";
Note:
See TracChangeset
for help on using the changeset viewer.