title: Telegraf - inputs.procstat pgrep plugin issue
body: <p><strong>Telegraf v1.0.1</strong> </p>
  
  <p>I'm not able to see <strong>telegraf[._]</strong> (tree) metric anymore after I enabled <strong>[[inputs.procstat]]</strong> plugin.</p>
  
  <p>Telegraf is installed successfully. Process is running. I'm pretty much using the normal settings for inputs plugins and output plugin.</p>
  
  <p>This is what I got:</p>
  
  <pre><code>ubuntu@jenkins:/tmp/giga_aks_testing/ansible$ grep -C 2 jenkins /etc/telegraf/telegraf.d/telegraf-custom-host-services-processes.conf; echo ; ps -eAf|grep jenkins; echo; pgrep -f jenkins; echo; cat -n /var/log/telegraf/telegraf.log; echo date; echo; ps -eAf|grep telegraf; echo ; sudo service telegraf status
  
  [[inputs.procstat]]
    exe = "jenkins"
    prefix = "pgrep_serviceprocess"
  
  
  root      2875  3685  0  2016 pts/3    00:00:00 sudo su jenkins
  root      2876  2875  0  2016 pts/3    00:00:00 su jenkins
  jenkins   2877  2876  0  2016 pts/3    00:00:00 bash
  jenkins  11645     1  0  2016 ?        00:00:01 /usr/bin/daemon --name=jenkins --inherit --env=JENKINS_HOME=/var/lib/jenkins --output=/var/log/jenkins/jenkins.log --pidfile=/var/run/jenkins/jenkins.pid -- /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
  jenkins  11647 11645  0  2016 ?        05:33:22 /usr/bin/java -Djava.awt.headless=true -jar /usr/share/jenkins/jenkins.war --webroot=/var/cache/jenkins/war --httpPort=8080
  ubuntu   21973 26885  0 06:57 pts/0    00:00:00 grep --color=auto jenkins
  
  2875
  2876
  11645
  11647
  
       1  2017-01-07T06:54:00Z E! Error: procstat getting process, exe: [jenkins] pidfile: [] pattern: [] user: [] Failed to execute /usr/bin/pgrep. Error: 'exit status 1' 
       2  2017-01-07T06:55:00Z E! Error: procstat getting process, exe: [jenkins] pidfile: [] pattern: [] user: [] Failed to execute /usr/bin/pgrep. Error: 'exit status 1' 
       3  2017-01-07T06:56:00Z E! Error: procstat getting process, exe: [jenkins] pidfile: [] pattern: [] user: [] Failed to execute /usr/bin/pgrep. Error: 'exit status 1' 
       4  2017-01-07T06:57:00Z E! Error: procstat getting process, exe: [jenkins] pidfile: [] pattern: [] user: [] Failed to execute /usr/bin/pgrep. Error: 'exit status 1' 
  date
  
  telegraf 19336     1  0 05:45 pts/0    00:00:04 /usr/bin/telegraf -pidfile /var/run/telegraf/telegraf.pid -config /etc/telegraf/telegraf.conf -config-directory /etc/telegraftelegraf.d
  ubuntu   21977 26885  0 06:57 pts/0    00:00:00 grep --color=auto telegraf
  
  telegraf Process is running [ OK ]
  ubuntu@jenkins:/tmp/giga_aks_testing/ansible$ 
  </code></pre>
  
  <p>Why, the log file is showing an error when the <strong>jenkins</strong> process is running and <code>pgrep -f jenkins</code> is returning valid result. </p>
  
  <p><strong>PS:</strong> <em>[[inputs.procstat]]</em> plugin uses <code>pgrep -f &lt;exe_value_pattern&gt;</code> for it's logic if <code>pattern =</code> method is used, and <code>pgrep &lt;executable&gt;</code> if <code>exe =</code> method is used. </p>
  
  <p>The full <strong>/etc/telegraf/telegraf.d/telegraf-custom-host-services-processes.conf</strong> file is:</p>
  
  <pre><code>[[inputs.procstat]]
    exe = "jenkins"
    prefix = "pgrep_serviceprocess"
  
  [[inputs.procstat]]
    exe = "telegraf"
    prefix = "pgrep_serviceprocess"
  
  [[inputs.procstat]]
    exe = "sshd"
    prefix = "pgrep_serviceprocess"
  </code></pre>