Thread Nagios Plugin: check_mozybackup (3 answers)
Opened by hund at 2010-08-26 10:47

havi
 2010-08-31 15:29
#141073 #141073
User since
2003-08-04
2036 Artikel
BenutzerIn
[Homepage]
user image
2010-08-26T08:47:54 hund
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
sub checkSizeType { 
        if ( $type ne 'MB' ) {
                if ( $type ne 'mb' ) {
                        if ( $type ne 'GB' ) {
                                if ( $type ne 'gb' ) {
                                        $np->nagios_die('size can only mb,Mb,gb,GB');
                                }
                        }
                }
        }
}


Code (perl): (dl )
1
2
3
4
5
sub checkSizeType {
   if ($type !~ m/^mb$|^gb$/i) {
      $np->nagios_die('size can only mb,Mb,gb,GB');
   }
}



2010-08-26T08:47:54 hund
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
                #size in gb umwandeln
                if ( $type eq 'gb' ) {
                        $size = ( $size / $GB );
                        $size = sprintf( "%.2f", $size );#rundet size auf 2 stellen auf
                }
                if ( $type eq 'GB' ) {
                        $size = ( $size / $GB );
                        $size = sprintf( "%.2f", $size );#rundet size auf 2 stellen auf
                }
                if ( $type eq 'MB' ) {
                        $size = ( $size / $MB );
                        $size = sprintf( "%.2f", $size );#rundet size auf 2 stellen auf
                }
                if ( $type eq $MB ) {
                        $size = ( $size / $MB );
                        $size = sprintf( "%.2f", $size );#rundet size auf 2 stellen auf
                }


Code (perl): (dl )
1
2
3
4
5
6
if ( $type =~ m/^gb$/i ) {
        $size = sprintf( "%.2f", $size / $GB );
}
if ( $type =~ m/^mb$/i ) {
        $size = sprintf( "%.2f", $size / $MB );
}

Last edited: 2010-08-31 15:32:57 +0200 (CEST)

View full thread Nagios Plugin: check_mozybackup