Centos 7.6下安装njmon

网友投稿 676 2022-10-13

Centos 7.6下安装njmon

Centos 7.6下安装njmon

1.查看环境

[root@njmon home]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core) [root@njmon home]# cat /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.56.131 njmon

2.安装njmon​

[root@njmon home]# wget home]# unzip njmon_linux_binaries_v53.zip[root@njmon home]# mv njmon_linux_RHEL7_AMD64_v53 /usr/local/bin/njmon[root@njmon home]# chmod +x /usr/local/bin/njmon[root@njmon home]# njmon -?njmon: help information. Version:53@10/02/2020- Performance stats collector outputing jsON format. Default is stdout- Core syntax: njmon -s seconds -c count- File output: -m directory -f- njmon collector output: -i host -p port -X secret- All options: -? -s seconds : seconds between snapshots of data (default 60 seconds) -c count : number of snapshots (default forever) -m directory : Program will cd to the directory before output -f : Output to file (not stdout) to two files below : Data: hostname__.json : Error: hostname__.err -k : Read /tmp/njmon.pid for a running njmon PID & if found running then this copy exits -P : Add process stats (take CPU cycles and large stats volume) -t percent : Set ignore process percent threshold (default 0.01%) -? or -h : This output and stop -d : Switch on debug tracing (output will no longer be JSON format) -w : Switch off warning messages in error output stream -r : Random pause at the start. Stops cron starting every njmon in sync.Push data to collector: -i ip : IP address or hostname of the njmon central collector -p port : port number on collector host -X secret : Set the remote collector secret or use shell NJMON_SECRETExamples: 1 Every 5 mins all day /home/nag/njmon -s 300 -c 288 -f -m /home/perf 2 Piping to data handler using half a day /home/nag/njmon -s 30 -c 1440 | myprog 3 Use the defaults (-s 60 forever) and save to a file ./njmon > my_server_today.json 4 Crontab entry 0 4 * * * /home/nag/njmon -s 300 -c 288 -f -m /home/perf 5 Crontab - hourly check/restart remote njmon, pipe stats back & insert into local DB * 0 * * * /usr/bin/ssh nigel@server /usr/lbin/njmon -k -s 300 -c 288 | /usr/local/bin/injector 6 Crontab - for pumping data to the njmon central collector * 0 * * * /usr/local/bin/njmon -s 300 -c 288 -i admin.acme.com -p 8181 -X SECRET42 * 0 * * * export NJMON_SECRET=abc123 && /usr/local/bin/njmon -s 300 -c 288 -i influx -p 8181 * 0 * * * export NJMON_SECRET=abc123 && /usr/local/bin/njmon -s 60 -k -i influx -p 8181[root@njmon home]# yum install jq python3 -y[root@njmon home]# njmon -c 1 -s 1 | jq keys[ "cpu_total", "cpuinfo", "cpus", "disks", "filesystems", "identity", "lscpu", "networks", "os_release", "proc_meminfo", "proc_version", "proc_vmstat", "stat_counters", "timestamp", "uptime_output"]

安装njmon_tool​

[root@njmon home]# wget home]# unzip njmon_tools_v50.zip[root@njmon njmon_tools_v50]# cat njmond.conf {"njmon_port": 8181,"njmon_secret": "ignore","data_inject": false,"data_json": true,"directory": "/home/data","influx_host": "localhost","influx_port": 8086,"influx_user": "admin","influx_password": ""njmon","workers": 2,"debug": true,# for njmon2influx.py"batch": 100}

采集数据

[root@njmon njmon_tools_v50]# njmon -s 5 | ./njmon2influx.py njmond.conf{'njmon_port': 8181, 'njmon_secret': 'ignore', 'data_inject': False, 'data_json': True, 'directory': '/home/data', 'influx_host': 'localhost', 'influx_port': 8086, 'influx_user': 'admin', 'influx_password': ''influx_dbname': 'njmon', 'workers': 2, 'debug': True, 'batch': 100}Traceback (most recent call last): File "./njmon2influx.py", line 225, in from influxdb import InfluxDBClientModuleNotFoundError: No module named 'influxdb'[root@njmon ~]# pip3 install influxdb[root@njmon njmon_tools_v50]# nohup njmon -s 5 | ./njmon2influx.py njmond.conf >/dev/null 2>&1 &[root@njmon data]# tail -f /home/njmon/data/njmon2influx.log2022-01-20 20:49:58,snap=100,njmon,db=njmon,json-size=10722,measure-size=,3700

InfluxDB查询数据

[root@njmon njmon_tools_v50]# influx -username admin -password to version 1.8.10InfluxDB shell version: 1.8.10> use njmonUsing database njmon> show measurementsname: measurementsname----cpu_totalcpuinfocpusdisksfilesystemsidentitylscpunetworksos_releaseproc_meminfoproc_versionproc_vmstatstat_counterstimestampuptime_output

LINUX

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:腾讯开源摘星计划培养开源贡献者的实践思考
下一篇:Beanbun 是用 PHP 编写的多进程网络爬虫框架(beans怎么读)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~