{"id":45,"date":"2023-07-20T10:28:38","date_gmt":"2023-07-20T02:28:38","guid":{"rendered":"https:\/\/guoyingxu.cn\/?p=45"},"modified":"2023-07-20T10:28:38","modified_gmt":"2023-07-20T02:28:38","slug":"install_grafana","status":"publish","type":"post","link":"https:\/\/guoyingxu.cn\/?p=45","title":{"rendered":"install_grafana"},"content":{"rendered":"\n<!doctype html>\n<html>\n<head>\n<meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'>\n<title><\/title>\n<\/head>\n<body><h2 id='installgrafana'>install_grafana<\/h2>\n<pre><code class='language-shell' lang='shell'>#!\/usr\/bin\/bash\ndownload_url=\nservice_status=`systemctl status grafana-server |grep Active |awk &#39;{print $3}&#39;`\nip=`ip addr |grep inet |grep brd |awk &#39;{print $2}&#39; |awk -F &#39;\/&#39; &#39;{print $1}&#39;`\nif [ -e &quot;grafana-8.0.6-1.x86_64.rpm&quot; ];then\n\tyum install -y grafana-8.0.6-1.x86_64.rpm\n\t\/sbin\/chkconfig --add grafana-server\n\tsystemctl enable grafana-server.service\n\tsystemctl start grafana-server\n\tsystemctl status grafana-server &amp;&gt;\/dev\/null\n\tif [[ $service_status == &quot;(running)&quot; ]];then\n\t\techo &quot;\u670d\u52a1\u8fd0\u884c\u6210\u529f,\u8bf7\u901a\u8fc7 http:\/\/$ip:3000 \u8fdb\u884c\u8bbf\u95ee\uff0c\u8d26\u53f7\uff1aadmin \u5bc6\u7801 admin&quot;\n\t\techo &quot;grafana \u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\uff1a\/var\/log\/grafana&quot;\n\t\techo &quot;grafana \u73af\u5883\u6587\u4ef6\u4f4d\u7f6e\uff1a \/etc\/sysconfig\/grafana-server&quot;\n\t\techo &quot;grafana \u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e\uff1a \/etc\/grafana\/grafana.ini&quot;\n\t\techo &quot;grafana \u7684\u56fe\u8868\u901a\u8fc7\u4ee5\u4e0b\u5730\u5740\u8fdb\u884c\u4e0b\u8f7dhttps:\/\/grafana.com\/grafana\/dashboards&quot;\n\tfi\nelse\n\twget $download_url\n\tyum install -y grafana-8.0.6-1.x86_64.rpm\n\t\/sbin\/chkconfig --add grafana-server\n\tsystemctl enable grafana-server.service\n\tsystemctl start grafana-server\n\tsystemctl status grafana-server &amp;&gt;\/dev\/null\n\tif [[ $service_status == &quot;(running)&quot; ]];then\n\t\techo &quot;\u670d\u52a1\u8fd0\u884c\u6210\u529f,\u8bf7\u901a\u8fc7 http:\/\/$ip:3000 \u8fdb\u884c\u8bbf\u95ee\uff0c\u8d26\u53f7\uff1aadmin \u5bc6\u7801 admin&quot;\n\t\techo &quot;grafana \u65e5\u5fd7\u6587\u4ef6\u4f4d\u7f6e\uff1a\/var\/log\/grafana&quot;\n\t\techo &quot;grafana \u73af\u5883\u6587\u4ef6\u4f4d\u7f6e\uff1a \/etc\/sysconfig\/grafana-server&quot;\n\t\techo &quot;grafana \u914d\u7f6e\u6587\u4ef6\u4f4d\u7f6e\uff1a \/etc\/grafana\/grafana.ini&quot;\n\t\techo &quot;grafana \u7684\u56fe\u8868\u901a\u8fc7\u4ee5\u4e0b\u5730\u5740\u8fdb\u884c\u4e0b\u8f7dhttps:\/\/grafana.com\/grafana\/dashboards&quot;\n\tfi\nfi\n<\/code><\/pre>\n<\/body>\n<\/html>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=45"}],"version-history":[{"count":0,"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=\/wp\/v2\/posts\/45\/revisions"}],"wp:attachment":[{"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/guoyingxu.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}