mirror of
				https://github.com/centreon/centreon-plugins.git
				synced 2025-10-31 03:13:49 +01:00 
			
		
		
		
	bug #288 for plugins meta service
git-svn-id: http://svn.centreon.com/trunk/plugins-2.x@6899 6bcd3966-0018-0410-8128-fd23d134de7e
This commit is contained in:
		
							parent
							
								
									63c61b7ecb
								
							
						
					
					
						commit
						73148dc5b5
					
				| @ -134,7 +134,13 @@ sub return_value($$$$){ | ||||
| 		    } | ||||
| 		} | ||||
|     } elsif (!defined($warning) || !defined($critical)) { | ||||
| 	print "Result : " . $result . "|value=" . $result . "\n"; | ||||
| 		if ($output) { | ||||
| 	    	if ($output) { | ||||
| 		    	print $output. "|value=" . $result . "\n"; | ||||
| 		    } else { | ||||
| 				print "OK result : " . $result . "|value=" . $result . "\n"; | ||||
| 			} | ||||
| 		} | ||||
| 		exit $ERRORS{'OK'}; | ||||
|     } else { | ||||
| 		print "ERROR : warnig level = critical level"; | ||||
| @ -151,7 +157,7 @@ my $host_id; | ||||
| 
 | ||||
| sub get_value_in_database_metric_id($$$$){ | ||||
|     ## Get last entry in perfparse database for this service | ||||
|     my $str = "SELECT value FROM data_bin WHERE id_metric = '".$metric_id."'"; | ||||
|     my $str = "SELECT value FROM data_bin WHERE id_metric = '".$metric_id."' ORDER BY ctime DESC LIMIT 1"; | ||||
|     if ($debug) {print $str . "\n";} | ||||
|     my $sth_deb2 = $dbh2->prepare($str); | ||||
|     if (!$sth_deb2->execute) {die "Error:" . $sth_deb2->errstr . "\n";} | ||||
| @ -175,7 +181,7 @@ service.service_id = host_service_relation.service_service_id AND service.servic | ||||
|     my $data = $host_data->fetchrow_hashref(); | ||||
|      | ||||
|     ## Get last entry in perfparse database for this service | ||||
|     my $sth_deb2 = $dbh2->prepare("SELECT value FROM metrics m, data_bin d, index_data i WHERE i.host_name = '".$data->{'host_name'}."' AND i.service_description = '".$data->{'service_description'}."' AND and m.index_id=i.id AND m.metric_id = d.id_metric AND m.metric_name = '".$metric."'"); | ||||
|     my $sth_deb2 = $dbh2->prepare("SELECT value FROM metrics m, data_bin d, index_data i WHERE i.host_name = '".$data->{'host_name'}."' AND i.service_description = '".$data->{'service_description'}."' AND and m.index_id=i.id AND m.metric_id = d.id_metric AND m.metric_name = '".$metric."' ORDER BY ctime DESC LIMIT 1"); | ||||
|     if (!$sth_deb2->execute) {die "Error:" . $sth_deb2->errstr . "\n";} | ||||
|     my $sth_deb2_data = $sth_deb2->fetchrow_hashref(); | ||||
|     return $sth_deb2_data->{'value'}; | ||||
| @ -195,7 +201,7 @@ sub get_value_in_database_by_host($$$$$){ | ||||
| 
 | ||||
|     ## Get last entry in perfparse database for this service | ||||
| 
 | ||||
|     my $sth_deb2 = $dbh2->prepare("SELECT value FROM metrics m, data_bin d, index_data i WHERE i.host_name = '".$data->{'host_name'}."' AND i.service_description = '".$data->{'service_description'}."' AND m.index_id=i.id AND m.metric_id = d.id_metric AND m.metric_name = '".$metric."'"); | ||||
|     my $sth_deb2 = $dbh2->prepare("SELECT value FROM metrics m, data_bin d, index_data i WHERE i.host_name = '".$data->{'host_name'}."' AND i.service_description = '".$data->{'service_description'}."' AND m.index_id=i.id AND m.metric_id = d.id_metric AND m.metric_name = '".$metric."' ORDER BY ctime DESC LIMIT 1"); | ||||
|     if (!$sth_deb2->execute) {die "Error:" . $sth_deb2->errstr . "\n";} | ||||
|     my $sth_deb2_data = $sth_deb2->fetchrow_hashref(); | ||||
|     return $sth_deb2_data->{'value'}; | ||||
| @ -220,7 +226,7 @@ sub get_value_in_database_by_hg($$$$$$){ | ||||
|      | ||||
|     ## Get last entry in perfparse database for this service | ||||
|      | ||||
|     my $sth_deb2 = $dbh2->prepare("SELECT value FROM metrics m, data_bin d, index_data i WHERE i.host_name = '".$host_data->{'host_name'}."' AND i.service_description = '".$service_data->{'service_description'}."' AND m.index_id=i.id AND m.metric_id = d.id_metric AND m.metric_name = '".$metric."'"); | ||||
|     my $sth_deb2 = $dbh2->prepare("SELECT value FROM metrics m, data_bin d, index_data i WHERE i.host_name = '".$host_data->{'host_name'}."' AND i.service_description = '".$service_data->{'service_description'}."' AND m.index_id=i.id AND m.metric_id = d.id_metric AND m.metric_name = '".$metric."' ORDER BY ctime DESC LIMIT 1"); | ||||
|     if (!$sth_deb2->execute) {die "Error:" . $sth_deb2->errstr . "\n";} | ||||
|     my $sth_deb2_data = $sth_deb2->fetchrow_hashref(); | ||||
|     return $sth_deb2_data->{'value'}; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user