title: Jenkins: Run a curl command within groovy scrpt
body: <p>I have a requirement where I need to send the status of the jenkins slave to influxdb. To do so I need to run a curl command from Jenkins Groovy script.</p>
  
  <p>My script looks like this : </p>
  
  <pre><code>int value=0;
  for (Node node in Jenkins.instance.nodes) {
     if (!node.toComputer().online){
     value=1;
     }
     else{
     value=0;
     }
  
  curl -i -XPOST http://localhost:8086/write?db=jenkins_db&amp;u=user&amp;p=pass --data-binary 'mymeas,tag=$node.nodeName status=$value'
  </code></pre>
  
  <p>But after running the script values do not appear in influxdb.
  Any Idea what might be wrong here?</p>
  
  <p>PS I also tried</p>
  
  <pre><code>def response = [ 'bash', '-c', "curl", "-i", "-XPOST", "http:/localhost:8086/write?db=jenkins_db&amp;u=user&amp;p=pass", "--data-binary", "\'mymeas tag=$node.nodeName status=$value"\' ].execute().text
  </code></pre>