【问题标题】:Nagios download reportNagios 下载报告
【发布时间】:2017-04-27 14:33:18
【问题描述】:

经过一些教程后,我正在尝试通过 shell cmds 下载报告:

wget -v –user 'nagUser' –password '.C|n#q.U$#r' –no-check-certificate -O report.html "http://[IP]/nagios/cgi-bin/avail.cgi?show_log_entries=&hostgroup=all&timeperiod=lastweek"

但我收到以下错误:

--2017-04-27 09:23:05--  http://xn--user-z86a/
Resolving –user (xn--user-z86a)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--user-z86a’
--2017-04-27 09:23:05--  http://xn--user-z86a/
Resolving –user (xn--user-z86a)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--user-z86a’
--2017-04-27 09:23:05--  http://nagUser/
Resolving nagUser(nagUser)... failed: Name or service not known.
wget: unable to resolve host address ‘nagUser’
--2017-04-27 09:23:05--  http://xn--password-rn3d/
Resolving –password (xn--password-rn3d)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--password-rn3d’
--2017-04-27 09:23:05--  http://xn--password-rn3d/
Resolving –password (xn--password-rn3d)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--password-rn3d’
--2017-04-27 09:23:05--  http://.c%7Cn/
Resolving .c|n (.c|n)... failed: Name or service not known.
wget: unable to resolve host address ‘.c|n’
--2017-04-27 09:23:05--  http://xn--no-check-certificate-2t2l/
Resolving –no-check-certificate (xn--no-check-certificate-2t2l)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--no-check-certificate-2t2l’
--2017-04-27 09:23:05--  http://xn--no-check-certificate-2t2l/
Resolving –no-check-certificate (xn--no-check-certificate-2t2l)... failed: Name or service not known.
wget: unable to resolve host address ‘xn--no-check-certificate-2t2l’
--2017-04-27 09:23:05--  http://[IP]/nagios/cgi-bin/avail.cgi?show_log_entries=&hostgroup=all&timeperiod=lastweek
Connecting to [IP]:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2017-04-27 09:23:05 ERROR 404: Not Found.

也许我错过了一个论点?

【问题讨论】:

  • 您可能需要转义 VERTICAL BAR | 字符。如果你使用'.C^|n#q.U$#r'会发生什么?

标签: shell cmd nagios


【解决方案1】:

经过数小时的痛苦,我设法按照以下步骤下载了报告:

  • 在 hosts 文件配置中包含 de IP [IP] [URL Name]
  • 使用插入 IP 的 URL(奇怪但真实)
  • cmd:wget -q --user='nagiosUser' --password='nagiosPassword' --no-check-certificate -O [fileName.ext] "[report link]"
  • 举报链接:http://[URL]/nagios/cgi-bin/avail.cgi?show_log_entries=&host=all&timeperiod=[TIMEPERIOD]&rpttimeperiod=&assumeinitialstates=yes&assumestateretention=yes&assumestatesduringnotrunning=yes&includesoftstates=no&initialassumedhoststate=0&initialassumedservicestate=0&backtrack=4&csvoutput=

注意'封装了用户和密码,--user='user'之间也没有空格,密码相同,不需要转义特殊字符。和" 链接。我也使用-q 进行安静模式,否则使用-v 冗长。

我希望输出报告为 csv 文件,因此请在链接中注明 &csvoutput=,否则它将下载为 HTML

这些是有效的时间段: 今天 => 今天

last24hours  => Last 24 hours
yesterday    => Yesterday
thisweek     => This week
last7days    => Last 7 days
lastweek     => Last week
thismonth    => This month
last31days   => Last 31 days
lastmonth    => Last month (default)
thisyear     => This year
lastyear     => Last year

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    相关资源
    最近更新 更多