Support I (idle) process state on procfs+Linux (#3530)
This commit is contained in:
		
							parent
							
								
									93d16a4603
								
							
						
					
					
						commit
						663a5b1f50
					
				|  | @ -30,7 +30,7 @@ Using the environment variable `HOST_PROC` the plugin will retrieve process info | ||||||
|     - zombie |     - zombie | ||||||
|     - dead |     - dead | ||||||
|     - wait (freebsd only) |     - wait (freebsd only) | ||||||
|     - idle (bsd only) |     - idle (bsd and Linux 4+ only) | ||||||
|     - paging (linux only) |     - paging (linux only) | ||||||
|     - total_threads (linux only) |     - total_threads (linux only) | ||||||
| 
 | 
 | ||||||
|  | @ -47,7 +47,7 @@ Linux  FreeBSD  Darwin  meaning | ||||||
|   Z       Z       Z     zombie |   Z       Z       Z     zombie | ||||||
|   X      none    none   dead |   X      none    none   dead | ||||||
|   T       T       T     stopped |   T       T       T     stopped | ||||||
|  none     I       I     idle (sleeping for longer than about 20 seconds) |   I       I       I     idle (sleeping for longer than about 20 seconds) | ||||||
|   D      D,L      U     blocked (waiting in uninterruptible sleep, or locked) |   D      D,L      U     blocked (waiting in uninterruptible sleep, or locked) | ||||||
|   W       W      none   paging (linux kernel < 2.6 only), wait (freebsd) |   W       W      none   paging (linux kernel < 2.6 only), wait (freebsd) | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | @ -85,6 +85,7 @@ func getEmptyFields() map[string]interface{} { | ||||||
| 		fields["dead"] = int64(0) | 		fields["dead"] = int64(0) | ||||||
| 		fields["paging"] = int64(0) | 		fields["paging"] = int64(0) | ||||||
| 		fields["total_threads"] = int64(0) | 		fields["total_threads"] = int64(0) | ||||||
|  | 		fields["idle"] = int64(0) | ||||||
| 	} | 	} | ||||||
| 	return fields | 	return fields | ||||||
| } | } | ||||||
|  | @ -174,6 +175,8 @@ func (p *Processes) gatherFromProc(fields map[string]interface{}) error { | ||||||
| 			fields["stopped"] = fields["stopped"].(int64) + int64(1) | 			fields["stopped"] = fields["stopped"].(int64) + int64(1) | ||||||
| 		case 'W': | 		case 'W': | ||||||
| 			fields["paging"] = fields["paging"].(int64) + int64(1) | 			fields["paging"] = fields["paging"].(int64) + int64(1) | ||||||
|  | 		case 'I': | ||||||
|  | 			fields["idle"] = fields["idle"].(int64) + int64(1) | ||||||
| 		default: | 		default: | ||||||
| 			log.Printf("I! processes: Unknown state [ %s ] in file %s", | 			log.Printf("I! processes: Unknown state [ %s ] in file %s", | ||||||
| 				string(stats[0][0]), filename) | 				string(stats[0][0]), filename) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue