Friday, November 9, 2018
Getting all running jobs from jenkins
http://hfrdrestsrv.rtp.raleigh.ibm.com:8080/computer/api/xml?tree=computer[oneOffExecutors[currentExecutable[url]]]&xpath=//url&wrapper=build
Sunday, October 21, 2018
mac os x disk mount
Catalina now has restrictions for various applications. You will have to do the following first.
For some reason, now I can only use the sudo to mount a disk
sudo mount -t hfs /dev/disk2s2 /Volumes/tongbackup
I have to create the mount point (/Volumes/tongbackup) first
I did not have to do that before.
For msdos fat file system, do the following.
First Unmount:
Then Mount again:
This mount the msdos file type
- go to System Preferences->Security&Privacy->Privacy->Full Disk Access
- unlock settings (click on lock icon in the left bottom corner and enter password)
- click on + button and select iTerm.app application
- restart iTerm.app and try the mount process again
For some reason, now I can only use the sudo to mount a disk
sudo mount -t hfs /dev/disk2s2 /Volumes/tongbackup
I have to create the mount point (/Volumes/tongbackup) first
I did not have to do that before.
For msdos fat file system, do the following.
First Unmount:
sudo diskutil unmount /dev/disk3s1
Then Mount again:
This mount the msdos file type
sudo mount -w -t msdos /dev/disk3s1 /Volumes/$NAME
or
This mount the exfat file type
sudo mount -w -t exfat /dev/disk3s1 /Volume/$NAME
Then you can write to it.
Monday, October 15, 2018
Jenkins config file provider content
Jenkins has a plugin which provide configuration files to various jobs. The config file managed by this plugin is saved in jenkins_home/org.jenkinsci.plugins.configfiles.GlobalConfigFiles.xml file.
That file is obviously a xml file with content similar to the following:
That file is obviously a xml file with content similar to the following:
<org.jenkinsci.plugins.configfiles.GlobalConfigFiles
plugin="config-file-provider@3.3">
<configs class="sorted-set">
<comparator class="org.jenkinsci.plugins.configfiles.GlobalConfigFiles$1" />
<org.jenkinsci.plugins.configfiles.custom.CustomConfig>
<id>bxproduction</id>
<name>bxproduction</name>
<comment></comment>
<content>
some content
</content>
<providerid>org.jenkinsci.plugins.configfiles.custom.CustomConfig</providerid>
</org.jenkinsci.plugins.configfiles.custom.CustomConfig> </configs>
</org.jenkinsci.plugins.configfiles.GlobalConfigFiles>
Thursday, October 11, 2018
Useful jenkins urls
API token
c2ed2dc5e57d6f8bb4be378cbc0abf73
Get the job queue
http://9.42.40.122:8080/queue/api/json?pretty=true
Get the crumb:
crumbvar=$(curl -u tongli:c2ed2dc5e57d6f8bb4be378cbc0abf73 http://9.42.40.122:8080/crumbIssuer/api/json)
Show the crumb:
echo $crumbvar
Trigger a build:
curl -vvv -H "Jenkins-Crumb:afa4c106b6a34ff9a8caa1ae9ce3f4d2" -X POST \
http://tongli:c2ed2dc5e57d6f8bb4be378cbc0abf73@9.42.40.122:8080/job/testBuild/buildWithParameters?jobCommand=start
The response header:
< HTTP/1.1 201 Created
< Date: Mon, 09 Apr 2018 14:02:29 GMT
< X-Content-Type-Options: nosniff
< Location: http://9.42.40.122:8080/queue/item/216/
< Content-Length: 0
< Server: Jetty(9.4.z-SNAPSHOT)
<
* Connection #0 to host 9.42.40.122 left intact
Get all the builds of a job:
http://9.42.40.122:8080/job/testBuild/api/json?pretty=true
Get build specific info for build testBuild #17
http://9.42.40.122:8080/job/testBuild/17/api/json?pretty=true
Get only desired info for a job build
http://9.42.40.122:8080/job/testBuild/17/api/json?pretty=true&tree=result,id,queueId,url
http://9.42.40.122:8080/job/testBuild/17/api/xml?pretty=true&tree=result,id,queueId,url
Get the build number by using queue id:
This call queries job named testBuild with queue id of 218
http://9.42.40.122:8080/job/testBuild/api/xml?tree=builds[id,number,result,queueId]&xpath=//build[queueId=218]
http://9.42.40.122:8080/job/testBuild/api/json?tree=builds[id,number,result,queueId]
The pattern is tree=keyname[field1,field2,subkeyname[subfield1]] and so on.
@litong01 "username":"bmxbcv1@us.ibm.com",
"password":"m072017j",
"org":"bcstarterplantest1@gmail.com",
"space":"dev",
"apiendpoint":"https://api.stage1.ng.bluemix.net",
"serviceInstanceName": "tmp-instance",
"service":"ibm-blockchain-5-staging",
"servicePlan":"ibm-blockchain-plan-v1-starter-staging",
Wednesday, September 5, 2018
Using cello ansible agent to setup fabric network
docker run -it --rm -v ~/test/vars:/opt/agent/vars hyperledger/cello-ansible-agent ansible-playbook -e "mode=apply env=fabricspec deploy_type=k8s" setupfabric.yml
Thursday, July 26, 2018
Script to start prometheus and grafana using docker
#!/bin/bash
# Start prometheus server
docker run -d -p 9090:9090 --restart unless-stopped \
-v /home/ubuntu/graph/prometheus:/etc/prometheus \
-v /home/ubuntu/graph/prometheus:/prometheus \
--user $(id -u) --name prometheus prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml
# Start prometheus node exporter which collects node resource metrics
docker run -d -p 9100:9100 --restart unless-stopped \
--user $(id -u) --name node-exporter prom/node-exporter
# Start grafana
docker run -d -p 3000:3000 --restart unless-stopped \
-v /home/ubuntu/graph/grafana:/var/lib/grafana \
--user $(id -u) --name grafana grafana/grafana
Assume that directories exists
/home/ubuntu/graph/prometheus
/home/ubuntu/graph/grafana
#Using graphite seems to be the better option since it allows posting data to it.
#Here is how to start it.
docker run -d --name graphite -p 8080:80 -p 2003:2003 sitespeedio/graphite:1.1.3
then access the web UI at 8080.
Run the following command to post some random data.
while true; do echo "fabric.tong.diceroll;nn=$((RANDOM%30));john=100 $((RANDOM % 100)) -1" | nc -q0 192.168.56.32 2003;sleep 3; done
The above command actually post metric named fabric.tong.diceroll with two tags, one is named nn, one is named john.
# Start prometheus server
docker run -d -p 9090:9090 --restart unless-stopped \
-v /home/ubuntu/graph/prometheus:/etc/prometheus \
-v /home/ubuntu/graph/prometheus:/prometheus \
--user $(id -u) --name prometheus prom/prometheus \
--config.file=/etc/prometheus/prometheus.yml
# Start prometheus node exporter which collects node resource metrics
docker run -d -p 9100:9100 --restart unless-stopped \
--user $(id -u) --name node-exporter prom/node-exporter
# Start grafana
docker run -d -p 3000:3000 --restart unless-stopped \
-v /home/ubuntu/graph/grafana:/var/lib/grafana \
--user $(id -u) --name grafana grafana/grafana
Assume that directories exists
/home/ubuntu/graph/prometheus
/home/ubuntu/graph/grafana
#Using graphite seems to be the better option since it allows posting data to it.
#Here is how to start it.
docker run -d --name graphite -p 8080:80 -p 2003:2003 sitespeedio/graphite:1.1.3
then access the web UI at 8080.
Run the following command to post some random data.
while true; do echo "fabric.tong.diceroll;nn=$((RANDOM%30));john=100 $((RANDOM % 100)) -1" | nc -q0 192.168.56.32 2003;sleep 3; done
The above command actually post metric named fabric.tong.diceroll with two tags, one is named nn, one is named john.
VirtuaBox host only network stops working
Once in awhile, virtualbox host only network will stop working. The host will not be able to ping the guest system. Even if the removal and recreate the host only network won't help. What it really helped me was to completely shutdown my macbook machine. do a cold restart, then network started working.
The route table of the host will look like this if the routing is working.
Use this command to show the current routing related to the VB host-only network
netstat -nr | grep 192.168
192.168.56 link#17 UC 3 0 vboxnet
192.168.56.1 a:0:27:0:0:0 UHLWIi 1 6 lo0
192.168.56.3 8:0:27:15:45:66 UHLWI 0 5 vboxnet 1171
192.168.56.255 ff:ff:ff:ff:ff:ff UHLWbI 0 3 vboxnet
When it was not working, the netstat -nr shows no entries like the above.
Regardless the host network is working or not, from the host, you won't be able to ping the gateway of the host network, for example, ping 192.168.56.1 will fail.
If not wantting cold restart the machine, do the following.
sudo route delete 192.168.56.0/24
Then delete host only network and recreate host only network, then restart VM, it will work.
For some reasons, the mac host may not show any route to network 192.168.56.0/24. when that happens, use the following procedure to get it back.
1. Delete all host-only networks from virtualbox
2. Completely shut down the mac host, then reboot the host
3. Recreate the host-only network.
At this point, mac host should show at least the following (using netstat -nr command):
192.168.56 link#17 UC 2 0 vboxnet
After you start a VM which uses host-only network, you should see the following:
192.168.56 link#17 UC 2 0 vboxnet
192.168.56.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 vboxnet
If you actually ping the guest VM with IP 192.168.56.32, and the ping is successful, then you should see the following:
192.168.56 link#17 UC 2 0 vboxnet
192.168.56.32 8:0:27:8f:d9:5e UHLWIi 1 3 vboxnet 1195
192.168.56.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 vboxnet
The route table of the host will look like this if the routing is working.
Use this command to show the current routing related to the VB host-only network
netstat -nr | grep 192.168
192.168.56 link#17 UC 3 0 vboxnet
192.168.56.1 a:0:27:0:0:0 UHLWIi 1 6 lo0
192.168.56.3 8:0:27:15:45:66 UHLWI 0 5 vboxnet 1171
192.168.56.255 ff:ff:ff:ff:ff:ff UHLWbI 0 3 vboxnet
When it was not working, the netstat -nr shows no entries like the above.
Regardless the host network is working or not, from the host, you won't be able to ping the gateway of the host network, for example, ping 192.168.56.1 will fail.
If not wantting cold restart the machine, do the following.
sudo route delete 192.168.56.0/24
Then delete host only network and recreate host only network, then restart VM, it will work.
For some reasons, the mac host may not show any route to network 192.168.56.0/24. when that happens, use the following procedure to get it back.
1. Delete all host-only networks from virtualbox
2. Completely shut down the mac host, then reboot the host
3. Recreate the host-only network.
At this point, mac host should show at least the following (using netstat -nr command):
192.168.56 link#17 UC 2 0 vboxnet
After you start a VM which uses host-only network, you should see the following:
192.168.56 link#17 UC 2 0 vboxnet
192.168.56.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 vboxnet
If you actually ping the guest VM with IP 192.168.56.32, and the ping is successful, then you should see the following:
192.168.56 link#17 UC 2 0 vboxnet
192.168.56.32 8:0:27:8f:d9:5e UHLWIi 1 3 vboxnet 1195
192.168.56.255 ff:ff:ff:ff:ff:ff UHLWbI 0 1 vboxnet
Subscribe to:
Posts (Atom)