So I wanted to setup Jenkins external monitoring on a web server I have on a Centos VM, and I found a combination of these three blog posts worked!
Firstly, run the following commands :
wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key yum -y install jenkins
… or download the RPM at http://pkg.jenkins-ci.org/redhat/ and run “rpm -Uhv jenkinx*.rpm”
- run the following:
cd /usr/lib/jenkins unzip /usr/lib/jenkins/jenkins.war
- Install OpenJDK while you’re at it.
- Go to Jenkins and create a “Monitor an external job” called “New Job”
* Create an environment variable by $export JENKINS_HOME=http://jenkins_host:8080 , replacing "jenkins_host" with the server running Jenkins
- To have Jenkins monitor a script, run a command like the following…
java -jar /usr/lib/jenkins/WEB-INF/lib/jenkins-core-*.jar “New Job” /path_to/myreport.sh 2>&1 > /dev/null
And you can put that command in a cron job too!