Files
shopdb/refreshzabbixcache.asp
cproudlock 249bfbba8c Standardize ASP filenames: remove underscores
Renamed 45 ASP files to follow lowercase concatenated naming convention:
- Direct handlers: save_machine_direct.asp -> savemachinedirect.asp
- USB files: checkin_usb.asp -> checkinusb.asp
- API files: api_usb.asp -> apiusb.asp
- Map files: network_map.asp -> networkmap.asp
- Printer files: printer_lookup.asp -> printerlookup.asp

Also:
- Updated 84+ internal references across all ASP and JS files
- Deleted 6 test/duplicate files (editmacine.asp, test_*.asp)
- Updated production migration guide with filename changes
- Added rename scripts for Linux (bash) and Windows (PowerShell)
2025-12-10 20:40:05 -05:00

61 lines
1.4 KiB
Plaintext

<%
' Background cache refresh endpoint
' Called asynchronously to update cache without blocking users
' DO NOT call this directly in browser - it's for internal async calls only
Response.Buffer = True
Response.ContentType = "text/plain"
Dim hostIP, cacheKey
hostIP = Request.QueryString("ip")
' Validate IP parameter
If hostIP = "" Then
Response.Write("Error: No IP specified")
Response.End
End If
' Include Zabbix functions
%>
<!--#include file="./includes/zabbix.asp"-->
<%
cacheKey = "zabbix_" & hostIP
' Fetch fresh data from Zabbix
Dim zabbixConnected, pingStatus, tonerJSON, resultData(2)
On Error Resume Next
zabbixConnected = ZabbixLogin()
If zabbixConnected = "1" Then
pingStatus = GetPrinterPingStatus(hostIP)
tonerJSON = GetPrinterTonerLevels(hostIP)
Else
pingStatus = "-1"
tonerJSON = ""
End If
If Err.Number <> 0 Then
Response.Write("Error: " & Err.Description)
Application.Lock
Application(cacheKey & "_refreshing") = "false"
Application.Unlock
Response.End
End If
On Error Goto 0
' Update cache with fresh data
resultData(0) = zabbixConnected
resultData(1) = pingStatus
resultData(2) = tonerJSON
Application.Lock
Application(cacheKey) = resultData
Application(cacheKey & "_time") = Now()
Application(cacheKey & "_refreshing") = "false"
Application.Unlock
Response.Write("OK: Cache updated for " & hostIP & " at " & Now())
%>